# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) BEGIN { $| = 1; print "1..14\n"; } # 1 END {print "not ok 1\n" unless $loaded;} use Apache::SSI; $loaded = 1; &report_result(1); # 2 &quick_test("", $ENV{TERM}); # 3 &quick_test('', 10); # 4 &quick_test('', 17); # 5 &quick_test('', 17); # 6 &quick_test('', 4); # 7: multiple lines &quick_test( qq[], 6); # 8 &quick_test( qq[63], '6' ); # 9 &quick_test('', 5); # 10 &quick_test('', 5); # 11 &quick_test('', 5); # 12: nested conditionals &format_quick_test(< 1 2 3 EOF # 13: nested conditionals &format_quick_test(< 1 2 3 4 5 6 EOF # 14: subclassing { package Apache::tSSI; use vars qw(@ISA); @ISA = qw(Apache::SSI); sub ssi_bozo { my($self, $args) = @_; return 'blah blah'; } my $tp = new Apache::tSSI(''); my $expected = 'blah blah'; &::report_result(($tp->get_output() eq $expected), $tp->get_output() . " eq '$expected'"); } sub report_result { my $bad = !shift; $TEST_NUM++; print "not "x$bad, "ok $TEST_NUM\n"; print $_[0] if ($bad and $ENV{TEST_VERBOSE}); } sub format_quick_test { my $text = shift; $text =~ s/(^\s+)|\n//gm; &quick_test($text, shift()); } sub quick_test { my $ssi = shift; my $expected = shift; my $p = new Apache::SSI($ssi); &report_result(($p->get_output() eq $expected), $p->get_output() . " eq '$expected'\n"); } sub five {5} sub Test::five {5} sub Test::handler {5}