]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.scaffold: simplify read-unit-test
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 21 Aug 2023 17:31:13 +0000 (10:31 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 21 Aug 2023 17:31:13 +0000 (10:31 -0700)
basis/tools/scaffold/scaffold.factor

index fe306121ba44511fd3d37a32752083f9b5159ee6..c18810c5c5681121f9d0c219edcf3d710bd8b0d5 100644 (file)
@@ -412,12 +412,10 @@ ${example-indent}}
     [ parse-string ] with-file-vocabs V{ } clone swap with-datastack ;
 
 : read-unit-test ( -- str/f )
-    read-contents dup "" = [
-        drop f
-    ] [
+    read-contents [ f ] [
         [ run-string [ unparse ] without-limits ] keep
         make-unit-test
-    ] if ;
+    ] if-empty ;
 
 : read-unit-tests ( -- str )
     [ read-unit-test dup ] [ ] produce nip "\n\n" join ;