X-Git-Url: http://git.subgeniuskitty.com/pforth/.git/blobdiff_plain/593eb738c871efd888f6c8652991dc2a413c8727..8bf2fe25c2d6ed80c3d41cc664d13da865d6be6c:/fth/t_file.fth diff --git a/fth/t_file.fth b/fth/t_file.fth index 2817f05..328ae7f 100644 --- a/fth/t_file.fth +++ b/fth/t_file.fth @@ -73,14 +73,11 @@ true value verbose : s= compare 0= ; : $" state IF postpone s" else ['] s" execute THEN ; immediate - -\ FIXME: stubs for missing definition -: flush-file drop -1 ; +\ FIXME: stubs for missing definitions : resize-file drop 2drop -1 ; : rename-file 2drop 2drop -1 ; : file-status 2drop 0 -1 ; - TESTING File Access word set DECIMAL @@ -118,6 +115,23 @@ T{ BUF 100 FID1 @ READ-LINE ROT DUP #CHARS ! -> TRUE 0 LINE1 SWAP DROP }T T{ BUF #CHARS @ LINE1 S= -> TRUE }T T{ FID1 @ CLOSE-FILE -> 0 }T +\ Test with buffer shorter than line. +T{ FN1 R/O OPEN-FILE SWAP FID1 ! -> 0 }T +T{ FID1 @ FILE-POSITION -> 0. 0 }T +T{ BUF 0 FID1 @ READ-LINE ROT DUP #CHARS ! -> TRUE 0 0 }T +T{ BUF 3 FID1 @ READ-LINE ROT DUP #CHARS ! -> TRUE 0 3 }T +T{ BUF #CHARS @ LINE1 DROP 3 S= -> TRUE }T +T{ BUF 100 FID1 @ READ-LINE ROT DUP #CHARS ! -> TRUE 0 LINE1 NIP 3 - }T +T{ BUF #CHARS @ LINE1 3 /STRING S= -> TRUE }T +T{ FID1 @ CLOSE-FILE -> 0 }T + +\ Test with buffer exactly as long as the line. +T{ FN1 R/O OPEN-FILE SWAP FID1 ! -> 0 }T +T{ FID1 @ FILE-POSITION -> 0. 0 }T +T{ BUF LINE1 NIP FID1 @ READ-LINE ROT DUP #CHARS ! -> TRUE 0 LINE1 NIP }T +T{ BUF #CHARS @ LINE1 S= -> TRUE }T +T{ FID1 @ CLOSE-FILE -> 0 }T + \ ---------------------------------------------------------------------------- TESTING S" in interpretation mode (compile mode tested in Core tests)