commit cd1657df2c8ed88873200cf90b5b334cad865e40
Author: Eirik A. Nygaard <eirikald@pvv.ntnu.no>
Date: Mon Aug 17 08:33:49 2009 +0200
Add testing of exit codes. Enable it for pir tests.
diff --git a/lib/Parrot/Test.pm b/lib/Parrot/Test.pm
index f04d29a..5624fa9 100644
|
a
|
b
|
|
| 582 | 582 | if ( $func =~ m/^pir_.*?output/ ) { |
| 583 | 583 | $code_f = per_test( '.pir', $test_no ); |
| 584 | 584 | } |
| | 585 | elsif ( $func =~ m/^pir_exit_code_/ ) { |
| | 586 | $code_f = per_test( '.pir', $test_no ); |
| | 587 | } |
| 585 | 588 | elsif ( $func =~ m/^pasm_.*?output_/ ) { |
| 586 | 589 | $code_f = per_test( '.pasm', $test_no ); |
| 587 | 590 | } |
| … |
… |
|
| 684 | 687 | my %parrot_test_map = map { |
| 685 | 688 | $_ . '_output_is' => 'is_eq', |
| 686 | 689 | $_ . '_error_output_is' => 'is_eq', |
| | 690 | $_ . '_exit_code_is' => 'is_eq', |
| 687 | 691 | $_ . '_output_isnt' => 'isnt_eq', |
| 688 | 692 | $_ . '_error_output_isnt' => 'isnt_eq', |
| 689 | 693 | $_ . '_output_like' => 'like', |
| … |
… |
|
| 723 | 727 | \$extra{todo} |
| 724 | 728 | if defined $extra{todo}; |
| 725 | 729 | |
| | 730 | if ( $func =~ /_exit_code_is$/ ) { |
| | 731 | $expected = int($expected); |
| | 732 | if ($exit_code == $expected) { |
| | 733 | my $pass = $builder->$meth( $exit_code, $expected, $desc ); |
| | 734 | return $pass; |
| | 735 | } |
| | 736 | else { |
| | 737 | $builder->diag("\nExited with error code: $exit_code, expected: $expected.\n"); |
| | 738 | return 0; |
| | 739 | } |
| | 740 | } |
| | 741 | |
| 726 | 742 | if ( $func =~ /_error_/ ) { |
| 727 | 743 | return _handle_error_output( $builder, $real_output, $expected, $desc ) |
| 728 | 744 | unless $exit_code; |