From 95dba9c4213c2e7e8f4b572efd873c1979406221 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Fri, 31 Aug 2007 13:21:10 +0000 Subject: 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 --- t/Nagios-Plugin-Functions-01.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 't/Nagios-Plugin-Functions-01.t') 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 @@ use strict; -use Test::More tests => 112; +use Test::More tests => 113; BEGIN { use_ok("Nagios::Plugin::Functions", ":all"); } Nagios::Plugin::Functions::_fake_exit(1); @@ -154,3 +154,8 @@ for (@ok) { $_->[1] . '.*' . $_->[2])); } +# Check that _use_die set to 1 will catch exceptions correctly +Nagios::Plugin::Functions::_fake_exit(0); +Nagios::Plugin::Functions::_use_die(1); +eval { nagios_die("Using die") }; +is( $@, "NAGIOS-PLUGIN-FUNCTIONS-01 UNKNOWN - Using die\n", "Caught exception"); -- cgit v1.2.3-74-g34f1