summaryrefslogtreecommitdiffstats
path: root/t/blocks.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-02 15:11:59 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-02 15:31:20 -0500
commitf8163f38482ebe4a48b08a3f49080821e62e383b (patch)
tree83398b2cd786e538487d13e4d50a547d91b0bbbf /t/blocks.t
parent5dc5000f75492b6f78d27fab3c56055d4534b5a7 (diff)
downloadtext-handlebars-f8163f38482ebe4a48b08a3f49080821e62e383b.tar.gz
text-handlebars-f8163f38482ebe4a48b08a3f49080821e62e383b.zip
refactor tests
Diffstat (limited to 't/blocks.t')
-rw-r--r--t/blocks.t65
1 files changed, 29 insertions, 36 deletions
diff --git a/t/blocks.t b/t/blocks.t
index bbc22b9..7cc68fe 100644
--- a/t/blocks.t
+++ b/t/blocks.t
@@ -1,57 +1,50 @@
#!/usr/bin/env perl
use strict;
use warnings;
+use lib 't/lib';
use Test::More;
+use Test::Handlebars;
-use Text::Handlebars;
-
-my $tx = Text::Handlebars->new;
-
-is(
- $tx->render_string(
- 'This is {{#shown}}shown{{/shown}}',
- { shown => 1 },
- ),
+render_ok(
+ 'This is {{#shown}}shown{{/shown}}',
+ { shown => 1 },
'This is shown',
+ "true block variable"
);
-is(
- $tx->render_string(
- 'This is {{#shown}}shown{{/shown}}',
- { shown => 0 },
- ),
+render_ok(
+ 'This is {{#shown}}shown{{/shown}}',
+ { shown => 0 },
'This is ',
+ "false block variable"
);
-is(
- $tx->render_string(
- 'This is {{#shown}}shown{{/shown}}',
- { shown => [({}) x 3] },
- ),
+render_ok(
+ 'This is {{#shown}}shown{{/shown}}',
+ { shown => [({}) x 3] },
'This is shownshownshown',
+ "array block variable"
);
-is(
- $tx->render_string(
- 'This is {{#shown}}{{content}}{{/shown}}',
- { shown => { content => 'SHOWN' } },
- ),
+render_ok(
+ 'This is {{#shown}}{{content}}{{/shown}}',
+ { shown => { content => 'SHOWN' } },
'This is SHOWN',
+ "nested hash block variable"
);
-is(
- $tx->render_string(
- 'This is {{#shown}}{{content}}{{/shown}}',
- {
- shown => [
- { content => '3' },
- { content => '2' },
- { content => '1' },
- { content => 'Shown' },
- ],
- },
- ),
+render_ok(
+ 'This is {{#shown}}{{content}}{{/shown}}',
+ {
+ shown => [
+ { content => '3' },
+ { content => '2' },
+ { content => '1' },
+ { content => 'Shown' },
+ ],
+ },
'This is 321Shown',
+ "nested array of hashes block variable"
);
done_testing;