summaryrefslogtreecommitdiffstats
path: root/t/mustache.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/mustache.t
parent5dc5000f75492b6f78d27fab3c56055d4534b5a7 (diff)
downloadtext-handlebars-f8163f38482ebe4a48b08a3f49080821e62e383b.tar.gz
text-handlebars-f8163f38482ebe4a48b08a3f49080821e62e383b.zip
refactor tests
Diffstat (limited to 't/mustache.t')
-rw-r--r--t/mustache.t36
1 files changed, 2 insertions, 34 deletions
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;