From: Matt S Trout <mst@shadowcat.co.uk>
Date: Sat, 11 Aug 2012 18:06:06 +0000 (+0000)
Subject: tests for TT code
X-Git-Tag: v1.000000~16
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f49292d9c720aace6fb382ae7fc2e3056b9e6357;p=scpubgit%2FHTML-String.git

tests for TT code
---

diff --git a/xt/tt.t b/xt/tt.t
new file mode 100644
index 0000000..b8c16e4
--- /dev/null
+++ b/xt/tt.t
@@ -0,0 +1,26 @@
+use strictures 1;
+use Test::More;
+use HTML::String::TT;
+
+my $tt = HTML::String::TT->new;
+
+sub do_tt {
+    my $output;
+    $tt->process(\$_[0], $_[1], \$output) or die $tt->error;
+    return "$output";
+}
+
+is(
+    do_tt('<tag>[% foo %]</tag>', { foo => 'Hi <bob>' }),
+    '<tag>Hi &lt;bob&gt;</tag>',
+);
+
+is(
+    do_tt(q{[%
+        VIEW myview; BLOCK render; '<tag>'; foo; '</tag>'; END; END;
+        myview.include('render');
+    %]}, { foo => 'Hi <bob>' }),
+    '<tag>Hi &lt;bob&gt;</tag>',
+);
+
+done_testing;