From 67a45638154221708da7f92451143475bdc229ac Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Mon, 5 Jan 2009 22:24:44 +0000 Subject: Check for valid numerical value before returning perfdata object --- t/Nagios-Plugin-Performance.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index e3fac07..8426828 100644 --- a/t/Nagios-Plugin-Performance.t +++ b/t/Nagios-Plugin-Performance.t @@ -16,7 +16,7 @@ my @test = ( }, ); -plan tests => (8 * scalar @test) + 132; +plan tests => (8 * scalar @test) + 135; use_ok('Nagios::Plugin::Performance'); diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; @@ -250,4 +250,10 @@ is( $p[0]->threshold->warning, 60, "warn okay"); is( $p[0]->threshold->critical->is_set, 1, "Critical range has been set"); is( $p[0]->threshold->critical, 120, "warn okay"); +# Some values with funny commas +@p = Nagios::Plugin::Performance->parse_perfstring("time=1800,600,300,0,3600 other=45.6"); +is( $p[0]->label, "other", "Ignored time=1800,600,300,0,3600, but allowed other=45.6"); +is( $p[0]->value, 45.6, "value okay"); +is( $p[0]->uom, "", "uom okay"); + # add_perfdata tests in t/Nagios-Plugin-01.t -- cgit v1.2.3-74-g34f1