summaryrefslogtreecommitdiffstats
path: root/plugins/t/negate.t
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-09-22 03:00:46 +0000
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-09-22 03:00:46 +0000
commit520f297fa931d391f81af672b5b0e34db71b8c73 (patch)
treee4d4ff4d206490d4a734a7e27c8d2ddf25c16ee0 /plugins/t/negate.t
parent8a39526e1b8754a8b8fbb50f7f6806af4def7baa (diff)
downloadmonitoring-plugins-520f297fa931d391f81af672b5b0e34db71b8c73.tar.gz
Rewrite the "map changes to return codes" patch nearly from scratch.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1785 f882894a-f735-0410-b71e-b25c423dba1c
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