]> gitweb.factorcode.org Git - factor.git/commitdiff
io.directories: add tests for truncate-file
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 19 May 2023 17:47:23 +0000 (10:47 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 19 May 2023 17:47:23 +0000 (10:47 -0700)
basis/io/directories/directories-tests.factor

index 2d027e88de49be9a68d3724429d60658177b2960..38b0679c2d32d898dd8a1eb11fe684121944cade 100644 (file)
@@ -300,3 +300,16 @@ tools.test ;
 
 { "/foo/bar" } [ P"/foo" P"./bar" append-path ] unit-test
 { "/bar/foo" } [ P"./foo" P"/bar" prepend-path ] unit-test
+
+{ f 16 8 } [
+    [
+        {
+            [ touch-file ]
+            [ binary [ input-stream get stream-length ] with-file-reader ]
+            [ 16 truncate-file ]
+            [ binary [ input-stream get stream-length ] with-file-reader ]
+            [ 8 truncate-file ]
+            [ binary [ input-stream get stream-length ] with-file-reader ]
+        } cleave
+    ] with-test-file
+] unit-test