]> gitweb.factorcode.org Git - factor.git/commitdiff
Multiline unit test and bug fix
authorDaniel Ehrenberg <ehrenbed@carleton.edu>
Tue, 11 Dec 2007 06:54:16 +0000 (01:54 -0500)
committerDaniel Ehrenberg <ehrenbed@carleton.edu>
Tue, 11 Dec 2007 06:54:16 +0000 (01:54 -0500)
extra/multiline/multiline-docs.factor
extra/multiline/multiline-tests.factor [new file with mode: 0644]
extra/multiline/multiline.factor

index 15d3ead705751688f4c7e0ae21a9602ed225ceaf..d2d9c7967fde07e06d2926a06ef12a8471592669 100644 (file)
@@ -2,7 +2,7 @@ USING: help.markup help.syntax multiline ;
 
 HELP: STRING:
 { $syntax "STRING: name\nfoo\n;" }
-{ $description "Forms a multiline string literal, or 'here document' stored in the word called name. A semicolon is used to signify the end, and that semicolon must be on a line by itself, not preceeded or followed by any whitespace. The string will have newlines in between lines and at the end." } ;
+{ $description "Forms a multiline string literal, or 'here document' stored in the word called name. A semicolon is used to signify the end, and that semicolon must be on a line by itself, not preceeded or followed by any whitespace. The string will have newlines in between lines but not at the end, unless there is a blank line before the semicolon." } ;
 
 IN: multiline
 ABOUT: POSTPONE: STRING:
diff --git a/extra/multiline/multiline-tests.factor b/extra/multiline/multiline-tests.factor
new file mode 100644 (file)
index 0000000..5ef289f
--- /dev/null
@@ -0,0 +1,9 @@
+USING: multiline tools.test ;
+
+STRING: test-it
+foo
+bar
+
+;
+
+[ "foo\nbar\n" ] [ test-it ] unit-test
index e55112a5f0e2e295c5c46223da06b1725ab62f20..1229dcc6899ec51228b41c6d8926404f81cb3493 100644 (file)
@@ -11,7 +11,7 @@ IN: multiline
     [ drop lexer get next-line ] [ % "\n" % (parse-here) ] if ;
 
 : parse-here ( -- str )
-    [ (parse-here) ] "" make
+    [ (parse-here) ] "" make 1 head*
     lexer get next-line ;
 
 : STRING: