From 3a58d586f935a35390196bbbb65b36d5c651fe93 Mon Sep 17 00:00:00 2001 From: Gavin Carr Date: Tue, 26 Sep 2006 04:10:37 +0000 Subject: Update Nagios::Plugin with NP::Function wrapper methods, and extras. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1483 f882894a-f735-0410-b71e-b25c423dba1c --- t/Nagios-Plugin-Functions-02.t | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/Nagios-Plugin-Functions-02.t b/t/Nagios-Plugin-Functions-02.t index 981e2eb..1a9351b 100644 --- a/t/Nagios-Plugin-Functions-02.t +++ b/t/Nagios-Plugin-Functions-02.t @@ -1,7 +1,7 @@ # check_messages tests use strict; -use Test::More tests => 33; +use Test::More tests => 37; BEGIN { use_ok("Nagios::Plugin::Functions", ":all") } @@ -160,3 +160,19 @@ is($message, $msg_all_wo, "join_all '$join_all' (critical, warning, \$ok) messag is($code, WARNING, "(warning) code is $STATUS_TEXT{$code}"); is($message, 'D E F', "join_all '$join_all' (critical, warning) message is $message"); +# ------------------------------------------------------------------------- +# Error cases + +# Test failures without required fields +ok(! defined eval { ($code, $message) = check_messages() }, + "check_messages dies without message args"); + +ok(! defined eval { ($code, $message) = check_messages(warning => $arrays{warning}) }, + "check_messages dies without 'critical' message"); + +ok(! defined eval { ($code, $message) = check_messages(critical => $arrays{critical}) }, + "check_messages dies without 'warning' message"); + +ok(defined eval { ($code, $message) = check_messages(critical => $arrays{critical}, warning => $arrays{warning}) }, + "check_messages ok with 'critical' and 'warning' messages"); + -- cgit v1.2.3-74-g34f1