diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2007-08-31 13:21:10 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2007-08-31 13:21:10 +0000 |
commit | 95dba9c4213c2e7e8f4b572efd873c1979406221 (patch) | |
tree | c39a8dc0022ae98b09bfe5fa75f2dc67b3c97a69 /t/Nagios-Plugin-Functions-01.t | |
parent | 4421aa3c2a695335cad006f32ece6c9c5da11165 (diff) | |
download | monitoring-plugin-perl-95dba9c4213c2e7e8f4b572efd873c1979406221.tar.gz |
Fixed bug where warn or crit = 0 will raise an error. Optional flag to
tell nagios_die to use die instead of exit so trappable by eval
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1772 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't/Nagios-Plugin-Functions-01.t')
-rw-r--r-- | t/Nagios-Plugin-Functions-01.t | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/t/Nagios-Plugin-Functions-01.t b/t/Nagios-Plugin-Functions-01.t index 70db221..5268255 100644 --- a/t/Nagios-Plugin-Functions-01.t +++ b/t/Nagios-Plugin-Functions-01.t | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | use strict; | 2 | use strict; |
3 | use Test::More tests => 112; | 3 | use Test::More tests => 113; |
4 | 4 | ||
5 | BEGIN { use_ok("Nagios::Plugin::Functions", ":all"); } | 5 | BEGIN { use_ok("Nagios::Plugin::Functions", ":all"); } |
6 | Nagios::Plugin::Functions::_fake_exit(1); | 6 | Nagios::Plugin::Functions::_fake_exit(1); |
@@ -154,3 +154,8 @@ for (@ok) { | |||
154 | $_->[1] . '.*' . $_->[2])); | 154 | $_->[1] . '.*' . $_->[2])); |
155 | } | 155 | } |
156 | 156 | ||
157 | # Check that _use_die set to 1 will catch exceptions correctly | ||
158 | Nagios::Plugin::Functions::_fake_exit(0); | ||
159 | Nagios::Plugin::Functions::_use_die(1); | ||
160 | eval { nagios_die("Using die") }; | ||
161 | is( $@, "NAGIOS-PLUGIN-FUNCTIONS-01 UNKNOWN - Using die\n", "Caught exception"); | ||