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/mustache.t | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) (limited to 't/mustache.t') diff --git a/t/mustache.t b/t/mustache.t index e12f4ef..d1b98d2 100644 --- a/t/mustache.t +++ b/t/mustache.t @@ -1,10 +1,9 @@ #!/usr/bin/env perl use strict; use warnings; +use lib 't/lib'; use Test::More; -use Test::Fatal; - -use Text::Handlebars; +use Test::Handlebars; # from the mustache(5) man page # http://mustache.github.com/mustache.5.html @@ -200,35 +199,4 @@ RENDERED ); } -sub render_ok { - local $Test::Builder::Level = $Test::Builder::Level + 1; - return _render_ok('render_string', @_); -} - -sub render_file_ok { - local $Test::Builder::Level = $Test::Builder::Level + 1; - return _render_ok('render', @_); -} - -sub _render_ok { - my $render_method = shift; - my $opts = ref($_[0]) && ref($_[0]) eq 'HASH' ? shift : {}; - my ($template, $env, $expected, $desc) = @_; - local $Test::Builder::Level = $Test::Builder::Level + 1; - - my $tx = Text::Handlebars->new(%$opts); - - my $exception = exception { - local $Test::Builder::Level = $Test::Builder::Level + 5; - is($tx->$render_method($template, $env), $expected, $desc); - }; - fail("$desc (threw an exception)") if $exception; - local $TODO = undef unless $exception; - is( - $exception, - undef, - "no exceptions for $desc" - ); -} - done_testing; -- cgit v1.2.3-54-g00ecf