diff options
Diffstat (limited to 'plugins/t')
| -rw-r--r-- | plugins/t/negate.t | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/plugins/t/negate.t b/plugins/t/negate.t index 0efa0ca8..3a894f55 100644 --- a/plugins/t/negate.t +++ b/plugins/t/negate.t | |||
| @@ -10,9 +10,8 @@ use strict; | |||
| 10 | use Test::More; | 10 | use Test::More; |
| 11 | use NPTest; | 11 | use NPTest; |
| 12 | 12 | ||
| 13 | # 47 tests if the "map changes to return codes" patch is applied | 13 | # 15 tests in the first part and 32 in the last loop |
| 14 | #plan tests => 47; | 14 | plan tests => 47; |
| 15 | plan tests => 15; | ||
| 16 | 15 | ||
| 17 | my $res; | 16 | my $res; |
| 18 | 17 | ||
| @@ -57,23 +56,17 @@ $res = NPTest->testCmd( './negate $PWD/check_dummy 0 \'$$ a dummy okay\'' ); | |||
| 57 | is( $res->output, 'OK: $$ a dummy okay', 'Proves that $$ is not being expanded again' ); | 56 | is( $res->output, 'OK: $$ a dummy okay', 'Proves that $$ is not being expanded again' ); |
| 58 | 57 | ||
| 59 | 58 | ||
| 60 | # Remove __DATA__ to run tests with future patch | 59 | my %state = ( |
| 61 | __DATA__ | 60 | ok => 0, |
| 62 | 61 | warning => 1, | |
| 63 | TODO: { | 62 | critical => 2, |
| 64 | local $TODO = "Codes can be switched"; | 63 | unknown => 3, |
| 65 | my %state = ( | 64 | ); |
| 66 | ok => 0, | 65 | foreach my $current_state (qw(ok warning critical unknown)) { |
| 67 | warning => 1, | 66 | foreach my $new_state (qw(ok warning critical unknown)) { |
| 68 | critical => 2, | 67 | $res = NPTest->testCmd( "./negate --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" ); |
| 69 | unknown => 3, | 68 | is( $res->return_code, $state{$new_state}, "Got fake $new_state" ); |
| 70 | ); | 69 | is( $res->output, uc($current_state).": Fake $new_state" ); |
| 71 | foreach my $current_state (qw(ok warning critical unknown)) { | ||
| 72 | foreach my $new_state (qw(ok warning critical unknown)) { | ||
| 73 | $res = NPTest->testCmd( "./negate --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" ); | ||
| 74 | is( $res->return_code, $state{$new_state}, "Got fake $new_state" ); | ||
| 75 | is( $res->output, uc($current_state).": Fake $new_state" ); | ||
| 76 | } | ||
| 77 | } | 70 | } |
| 78 | } | 71 | } |
| 79 | 72 | ||
