1 # common.pm - common test driver code
11 # plan for one expected ok() call per test
13 plan( tests => scalar @{$tests} ) ;
15 # loop over all the tests
17 foreach my $test ( @{$tests} ) {
22 if ( $test->{skip} ) {
23 ok( 1, "SKIPPING $test->{name}" ) ;
27 # run any setup sub before this test. this can is used to modify the
28 # object for this test (e.g. delete templates from the cache).
30 if( my $pretest = $test->{pretest} ) {
35 my $sub = $test->{sub} ;
36 my $args = $test->{args} ;
42 # if we had an error and expected it, we pass this test
46 if ( $test->{error} && $@ =~ /$test->{error}/ ) {
48 ok( 1, $test->{name} ) ;
52 print "unexpected error: $@\n" ;
53 ok( 0, $test->{name} ) ;
57 if( my $posttest = $test->{posttest} ) {