| 1 | use Test::More tests=>6; |
| 2 | |
| 3 | # Include the test hierarchy |
| 4 | use lib 't/lib'; |
| 5 | |
| 6 | BEGIN { |
| 7 | use_ok('TestApp11'); |
| 8 | use_ok('TestApp12'); |
| 9 | }; |
| 10 | |
| 11 | # Prevent output to STDOUT |
| 12 | $ENV{CGI_APP_RETURN_ONLY} = 1; |
| 13 | |
| 14 | # Usage of error_mode will catch a runtime failure |
| 15 | { |
| 16 | my $app = TestApp11->new; |
| 17 | my $output = $app->run(); |
| 18 | like($output, qr/Success!/, "Errormode works"); |
| 19 | like($output, qr/mode1 failed/, 'Errormode received $@ as value'); |
| 20 | } |
| 21 | |
| 22 | # Need to see what happens when error_mode itself fails |
| 23 | { |
| 24 | my $app = TestApp12->new; |
| 25 | my $output; |
| 26 | eval { |
| 27 | $output = $app->run(); |
| 28 | }; |
| 29 | |
| 30 | ok( defined $@, "Make sure the error_mode did fail" ); |
| 31 | like($@, qr/Oops/, "Errormode fails correctly"); |
| 32 | } |