From f8163f38482ebe4a48b08a3f49080821e62e383b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 2 Oct 2012 15:11:59 -0500 Subject: refactor tests --- t/blocks.t | 65 ++++++++++++++++++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 36 deletions(-) (limited to 't/blocks.t') 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; -- cgit v1.2.3-54-g00ecf