From 520f297fa931d391f81af672b5b0e34db71b8c73 Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Sat, 22 Sep 2007 03:00:46 +0000 Subject: 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 --- plugins/t/negate.t | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'plugins/t') 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" ); } } -- cgit v1.2.3