added test cases for heredoc and triple-single.

master
Timo Paulssen 2011-05-01 02:37:18 +02:00 committed by Joey Hess
parent 505439cc0a
commit 8e120bf718
1 changed files with 8 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
use warnings; use warnings;
use strict; use strict;
use Test::More tests => 33; use Test::More tests => 34;
BEGIN { use_ok("IkiWiki"); } BEGIN { use_ok("IkiWiki"); }
@ -67,10 +67,12 @@ is(IkiWiki::preprocess("foo", "foo", $long, 0, 0), $long,
is(IkiWiki::preprocess("foo", "foo", $long."]]", 0, 0), $long."]]", is(IkiWiki::preprocess("foo", "foo", $long."]]", 0, 0), $long."]]",
"unterminated triple-quoted string is not treated as a bare word"); "unterminated triple-quoted string is not treated as a bare word");
is(IkiWiki::preprocess("foo", "foo", "[[!foo a=<<HEREDOC\n".$multiline."\nHERE]]", 0, 0), is(IkiWiki::preprocess("foo", "foo", "[[!foo a=<<HEREDOC\n".$multiline."\nHEREDOC]]", 0, 0),
"foo(a => $multiline)", "heredoc for key"); "foo(a => $multiline)", "nested strings via heredoc (for key)");
is(IkiWiki::preprocess("foo", "foo", "[[!foo <<HEREDOC\n".$multiline."\nHERE]]", 0, 0), is(IkiWiki::preprocess("foo", "foo", "[[!foo <<HEREDOC\n".$multiline."\nHEREDOC]]", 0, 0),
"foo($multiline)", "heredoc for keyless"); "foo($multiline)", "nested strings via heredoc (without keyless)");
is(IkiWiki::preprocess("foo", "foo", "[[!foo '''".$multiline."''']]", 0, 0),
"foo($multiline)", "triple-single-quoted multiline string");
TODO: { TODO: {
local $TODO = "nested strings not yet implemented"; local $TODO = "nested strings not yet implemented";