summaryrefslogtreecommitdiffstats
path: root/plugins/t/negate.t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t/negate.t')
-rw-r--r--plugins/t/negate.t33
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;
10use Test::More; 10use Test::More;
11use NPTest; 11use 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; 14plan tests => 47;
15plan tests => 15;
16 15
17my $res; 16my $res;
18 17
@@ -57,23 +56,17 @@ $res = NPTest->testCmd( './negate $PWD/check_dummy 0 \'$$ a dummy okay\'' );
57is( $res->output, 'OK: $$ a dummy okay', 'Proves that $$ is not being expanded again' ); 56is( $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 59my %state = (
61__DATA__ 60 ok => 0,
62 61 warning => 1,
63TODO: { 62 critical => 2,
64 local $TODO = "Codes can be switched"; 63 unknown => 3,
65 my %state = ( 64 );
66 ok => 0, 65foreach 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