summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-06-05 16:10:08 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-06-05 16:10:08 -0400
commit763f4b91da9bb8701b3000a1290a1d5f22850551 (patch)
treea5e633088796935815611d5493e9b41ab84c2732
parent1d57a21c987a5e970df01efe10acdf69982c2d61 (diff)
add test case for unterminated """ string
A directive that contains an unterminated """ string should not cause each word of the string to be treated as a bare word. Instead, the directive should fail to parse. There are two tests. One just checks that a complete directive containing such a string fails to parse. The other checks for a case where a directive ends with a very long unterminated """ string, and the directive is itself not closed. While this test won't fail, it does trigger a nasty perl warning.
-rwxr-xr-xt/preprocess.t7
1 files changed, 6 insertions, 1 deletions
diff --git a/t/preprocess.t b/t/preprocess.t
index 7699f56ba..e5026ed64 100755
--- a/t/preprocess.t
+++ b/t/preprocess.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 19;
+use Test::More tests => 21;
BEGIN { use_ok("IkiWiki"); }
@@ -51,6 +51,11 @@ is(IkiWiki::preprocess("foo", "foo", '[[foo a="""'.$multiline.'""" b="foo"]]', 0
"foo(a => $multiline, b => foo)");
is(IkiWiki::preprocess("foo", "foo", '[[foo a="""'."\n".$multiline."\n".'""" b="foo"]]', 0, 0),
"foo(a => $multiline, b => foo)", "leading/trailing newline stripped");
+my $long='[[foo a="""'.("a" x 100000).'';
+is(IkiWiki::preprocess("foo", "foo", $long, 0, 0), $long,
+ "unterminated triple-quoted string inside unterminated directive(should not warn about over-recursion)");
+is(IkiWiki::preprocess("foo", "foo", $long."]]", 0, 0), $long."]]",
+ "unterminated triple-quoted string is not treated as a bare word");
TODO: {
local $TODO = "nested strings not yet implemented";