From 4f0eadbd97ead5726b35843537dcce6d585b1164 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Fri, 9 Jun 2006 10:53:22 +0000 Subject: Fixed problems parsing in nagiosgraph git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1423 f882894a-f735-0410-b71e-b25c423dba1c --- t/Nagios-Plugin-Performance.t | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index 2fe2326..a00b2db 100644 --- a/t/Nagios-Plugin-Performance.t +++ b/t/Nagios-Plugin-Performance.t @@ -1,6 +1,6 @@ use strict; -use Test::More tests => 42; +use Test::More tests => 43; BEGIN { use_ok('Nagios::Plugin::Performance') }; use Nagios::Plugin::Base; @@ -21,8 +21,9 @@ cmp_ok( $p[1]->uom, 'eq', "MB", "uom okay"); cmp_ok( $p[1]->threshold->warning->end, "==", 9443, "warn okay"); cmp_ok( $p[1]->threshold->critical->end, "==", 9448, "crit okay"); -ok( ! defined Nagios::Plugin::Performance->parse_perfstring("rubbish"), "Errors correctly"); -ok( ! defined Nagios::Plugin::Performance->parse_perfstring(""), "Errors on empty string"); +@p = Nagios::Plugin::Performance->parse_perfstring("rubbish"); +ok( ! @p, "Errors correctly"); +ok( ! Nagios::Plugin::Performance->parse_perfstring(""), "Errors on empty string"); @p = Nagios::Plugin::Performance->parse_perfstring( "time=0.001229s;0.000000;0.000000;0.000000;10.000000"); @@ -49,6 +50,9 @@ cmp_ok( $p[0]->uom, "eq", "", "uom empty"); cmp_ok( $p[0]->threshold->warning, 'eq', "20", "warn okay"); cmp_ok( $p[0]->threshold->critical, 'eq', "50", "crit okay"); +@p = Nagios::Plugin::Performance->parse_perfstring( "users=4;20;50;0\n" ); + ok( @p, "parse correctly with linefeed at end (nagiosgraph)"); + @p = Nagios::Plugin::Performance->parse_perfstring( "time=0.215300s;5.000000;10.000000;0.000000 size=426B;;;0" ); cmp_ok( $p[0]->label, "eq", "time", "label okay"); -- cgit v1.2.3-74-g34f1