Browse files

* Applied patch from Leon to extend test coverage

git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@202 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information...
1 parent 990a201 commit 759c73b5372b18054190384881902e2b80eaf318 @abw committed Aug 29, 2001
Showing with 34 additions and 0 deletions.
  1. +10 −0 t/file.t
  2. +24 −0 t/template.t
View
10 t/file.t
@@ -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.
+
View
24 t/template.t
@@ -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.