aboutsummaryrefslogtreecommitdiff
path: root/plugins/t/negate.t
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2007-09-22 03:00:46 +0000
committerGravatar Thomas 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;
use Test::More;
use NPTest;
-# 47 tests if the "map changes to return codes" patch is applied
-#plan tests => 47;
-plan tests => 15;
+# 15 tests in the first part and 32 in the last loop
+plan tests => 47;
my $res;
@@ -57,23 +56,17 @@ $res = NPTest->testCmd( './negate $PWD/check_dummy 0 \'$$ a dummy okay\'' );
is( $res->output, 'OK: $$ a dummy okay', 'Proves that $$ is not being expanded again' );
-# Remove __DATA__ to run tests with future patch
-__DATA__
-
-TODO: {
- local $TODO = "Codes can be switched";
- my %state = (
- ok => 0,
- warning => 1,
- critical => 2,
- unknown => 3,
- );
- foreach my $current_state (qw(ok warning critical unknown)) {
- foreach my $new_state (qw(ok warning critical unknown)) {
- $res = NPTest->testCmd( "./negate --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" );
- is( $res->return_code, $state{$new_state}, "Got fake $new_state" );
- is( $res->output, uc($current_state).": Fake $new_state" );
- }
+my %state = (
+ ok => 0,
+ warning => 1,
+ critical => 2,
+ unknown => 3,
+ );
+foreach my $current_state (qw(ok warning critical unknown)) {
+ foreach my $new_state (qw(ok warning critical unknown)) {
+ $res = NPTest->testCmd( "./negate --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" );
+ is( $res->return_code, $state{$new_state}, "Got fake $new_state" );
+ is( $res->output, uc($current_state).": Fake $new_state" );
}
}