Multiline unit test and bug fix
parent
fd63917d8b
commit
e1346ced8b
|
@ -2,7 +2,7 @@ USING: help.markup help.syntax multiline ;
|
||||||
|
|
||||||
HELP: STRING:
|
HELP: STRING:
|
||||||
{ $syntax "STRING: name\nfoo\n;" }
|
{ $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
|
IN: multiline
|
||||||
ABOUT: POSTPONE: STRING:
|
ABOUT: POSTPONE: STRING:
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
USING: multiline tools.test ;
|
||||||
|
|
||||||
|
STRING: test-it
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
[ "foo\nbar\n" ] [ test-it ] unit-test
|
|
@ -11,7 +11,7 @@ IN: multiline
|
||||||
[ drop lexer get next-line ] [ % "\n" % (parse-here) ] if ;
|
[ drop lexer get next-line ] [ % "\n" % (parse-here) ] if ;
|
||||||
|
|
||||||
: parse-here ( -- str )
|
: parse-here ( -- str )
|
||||||
[ (parse-here) ] "" make
|
[ (parse-here) ] "" make 1 head*
|
||||||
lexer get next-line ;
|
lexer get next-line ;
|
||||||
|
|
||||||
: STRING:
|
: STRING:
|
||||||
|
|
Loading…
Reference in New Issue