Skip to content

Commit

Permalink
* Applied patch from Leon to extend test coverage
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@202 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information
abw committed Aug 29, 2001
1 parent 990a201 commit 759c73b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions t/file.t
Expand Up @@ -168,4 +168,14 @@ foo
[% dir %]/src/foo
[% mtime %]
-- test --
[% TRY -%]
[% USE f = File('') -%]
n: [% f.name %]
[% CATCH -%]
Drat, there was a [% error.type %] error.
[% END %]
-- expect --
Drat, there was a File error.
24 changes: 24 additions & 0 deletions t/template.t
Expand Up @@ -40,4 +40,28 @@ my $error = $tt->error();
ok( $error->type() eq 'file' );
ok( $error->info() eq 'this_file_does_not_exist: not found' );

sub myout {
my $output = shift;
ok($output)
}

ok($tt->process('header', undef, \&myout));

my $out = Myout->new();

ok($tt->process('header', undef, $out));

package Myout;
use Template::Test;

sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless($self, $class);
return $self;
}
sub print {
my $output = shift;
ok($output);
}

0 comments on commit 759c73b

Please sign in to comment.