X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xt%2Ftt.t;h=151152e5062de69dd0882672955e13a271a63f3e;hb=228553e654fa3ec823a029ab75e7ca7cba1454ae;hp=debdbbd508b4f8444c1e55af17cea166c504e19d;hpb=5bee64f99d0f0c221aba7125ae9bd8ddea133467;p=scpubgit%2FHTML-String.git
diff --git a/xt/tt.t b/xt/tt.t
index debdbbd..151152e 100644
--- a/xt/tt.t
+++ b/xt/tt.t
@@ -28,9 +28,50 @@ is(
'Hi ',
);
+# Check we aren't nailed by https://rt.perl.org/rt3/Ticket/Display.html?id=49594
+
is(
do_tt('"$bar"'."\n"),
'"$bar"'."\n"
);
+{ # non-ASCII characters can also trigger the bug
+
+ use utf8;
+
+ is(
+ do_tt('
foo â bar.', {}),
+ 'foo â bar.',
+ );
+}
+
+is(
+ do_tt(
+ '[% FOREACH item IN items %][% item %][% END %]',
+ { items => [ '', '-> & so "on" <-' ] }
+ ),
+ '<script>alert("lalala")</script>'
+ .'-> & so "on" <-'
+);
+
+is( do_tt('"0"', {}), '"0"' );
+
+{
+ my $tmpl = q[
+ [%- MACRO test(name, value) BLOCK;
+ IF !value.length;
+ "ok";
+ END;
+ END; -%]
+[%- test("foo", "") -%]
+];
+
+ my $with_html_string_tt = do_tt($tmpl, {});
+
+ $tt = Template->new(STASH => Template::Stash->new);
+ my $with_template = do_tt($tmpl, {});
+
+ is $with_html_string_tt, $with_template;
+}
+
done_testing;