Skip to content

Commit

Permalink
add simple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fcuny authored and bigpresh committed Jun 14, 2010
1 parent 02f9c03 commit 1e8e8f7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
26 changes: 26 additions & 0 deletions t/01-simple.t
@@ -0,0 +1,26 @@
use strict;
use warnings;
use Test::More tests => 2;
use Dancer::FileUtils 'path';

use Dancer::Template::HtmlTemplate;

my $engine;
eval { $engine = Dancer::Template::HtmlTemplate->new };
is $@, '',
"Dancer::Template::HtmlTemplate engine created";

my $template = path('t', 'index.tt');
my $result = $engine->render(
$template,
{ var1 => 1,
var2 => 2,
foo => 'one',
bar => 'two',
baz => 'three'
}
);

my $expected =
'this is var1="1" and var2=2' . "\n\nanother line\n\none two three\n";
is $result, $expected, "processed a template given as a file name";
5 changes: 5 additions & 0 deletions t/index.tt
@@ -0,0 +1,5 @@
this is var1="<TMPL_VAR NAME=var1 >" and var2=<TMPL_VAR NAME= var2 >

another line

<TMPL_VAR NAME=foo> <TMPL_VAR NAME=bar> <TMPL_VAR NAME=baz>

0 comments on commit 1e8e8f7

Please sign in to comment.