From 6728e60669cfa3011e5ab5f3315feccd6205668d Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Thu, 26 Oct 2006 21:02:21 +0000 Subject: Fixed regression where hostnames with hyphens were rejected (1581402 - Holger Weiss) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1528 f882894a-f735-0410-b71e-b25c423dba1c --- plugins-scripts/t/utils.t | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins-scripts/t/utils.t (limited to 'plugins-scripts/t') diff --git a/plugins-scripts/t/utils.t b/plugins-scripts/t/utils.t new file mode 100644 index 00000000..469988c9 --- /dev/null +++ b/plugins-scripts/t/utils.t @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w -I .. +# +# utils.pm tests +# +# $Id$ +# + +#use strict; +use Test::More; +use NPTest; + +use lib ".."; +use utils; + +my $hostname_checks = { + "www.altinity.com" => 1, + "www.888.com" => 1, + "888.com" => 1, + "host-hyphened.com" => 1, + "rubbish" => 1, + "-start.com" => 0, + "endsindot." => 0, + "lots.of.dots.dot.org" => 1, + "10.20.30.40" => 1, + "10.20.30.40.50" => 0, + "10.20.30" => 0, + }; + +plan tests => scalar keys %$hostname_checks; + +foreach my $h (sort keys %$hostname_checks) { + is (utils::is_hostname($h), $hostname_checks->{$h}, "$h should return ".$hostname_checks->{$h}); +} + -- cgit v1.2.3