summaryrefslogtreecommitdiffstats
path: root/t/Nagios-Plugin-Getopt-01.t
diff options
context:
space:
mode:
authorGavin Carr <gonzai@users.sourceforge.net>2007-03-21 00:52:56 +0000
committerGavin Carr <gonzai@users.sourceforge.net>2007-03-21 00:52:56 +0000
commitdc31f1cd3841d486e920e59ce42e888ca94e4289 (patch)
tree14bcc87e8349b99b01a649f27429690321fc21f9 /t/Nagios-Plugin-Getopt-01.t
parentc6cbf050974c8f6642fa1d7bde309710b66cbfa0 (diff)
downloadmonitoring-plugin-perl-dc31f1cd3841d486e920e59ce42e888ca94e4289.tar.gz
Finished initial --extra-opts support; added Getopt spec-to-help and multiline help support.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1643 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't/Nagios-Plugin-Getopt-01.t')
-rw-r--r--t/Nagios-Plugin-Getopt-01.t8
1 files changed, 5 insertions, 3 deletions
diff --git a/t/Nagios-Plugin-Getopt-01.t b/t/Nagios-Plugin-Getopt-01.t
index b708a5f..bad1367 100644
--- a/t/Nagios-Plugin-Getopt-01.t
+++ b/t/Nagios-Plugin-Getopt-01.t
@@ -27,8 +27,8 @@ sub setup
27 27
28 # Add argument - named version 28 # Add argument - named version
29 $ng->arg( 29 $ng->arg(
30 spec => 'critical|c=s', 30 spec => 'critical|c=i',
31 help => qq(-c, --critical=INTEGER\n Exit with CRITICAL status if less than INTEGER foobars are free), 31 help => qq(Exit with CRITICAL status if less than INTEGER foobars are free),
32 required => 1, 32 required => 1,
33 ); 33 );
34 34
@@ -104,6 +104,7 @@ like($@, qr/$PARAM{version}/, 'version info includes version');
104like($@, qr/$PARAM{url}/, 'version info includes url'); 104like($@, qr/$PARAM{url}/, 'version info includes url');
105unlike($@, qr/Usage:/, 'no usage message'); 105unlike($@, qr/Usage:/, 'no usage message');
106unlike($@, qr/Missing arg/, 'no missing arguments'); 106unlike($@, qr/Missing arg/, 'no missing arguments');
107
107@ARGV = ( '--version' ); 108@ARGV = ( '--version' );
108$ng = setup; 109$ng = setup;
109ok(! defined eval { $ng->getopts }, 'getopts died on version'); 110ok(! defined eval { $ng->getopts }, 'getopts died on version');
@@ -128,6 +129,7 @@ like($@, qr/--verbose/, 'help includes default options 2');
128like($@, qr/--warning/, 'help includes custom option 1'); 129like($@, qr/--warning/, 'help includes custom option 1');
129like($@, qr/--critical/, 'help includes custom option 2'); 130like($@, qr/--critical/, 'help includes custom option 2');
130unlike($@, qr/Missing arg/, 'no missing arguments'); 131unlike($@, qr/Missing arg/, 'no missing arguments');
132
131@ARGV = ( '--help' ); 133@ARGV = ( '--help' );
132$ng = setup; 134$ng = setup;
133ok(! defined eval { $ng->getopts }, 'getopts died on help'); 135ok(! defined eval { $ng->getopts }, 'getopts died on help');
@@ -140,6 +142,6 @@ like($@, qr/Usage:/, 'help includes usage message');
140like($@, qr/--version/, 'help includes default options 1'); 142like($@, qr/--version/, 'help includes default options 1');
141like($@, qr/--verbose/, 'help includes default options 2'); 143like($@, qr/--verbose/, 'help includes default options 2');
142like($@, qr/--warning/, 'help includes custom option 1'); 144like($@, qr/--warning/, 'help includes custom option 1');
143like($@, qr/--critical/, 'help includes custom option 2'); 145like($@, qr/-c, --critical=INTEGER/, 'help includes custom option 2, with expanded args');
144unlike($@, qr/Missing arg/, 'no missing arguments'); 146unlike($@, qr/Missing arg/, 'no missing arguments');
145 147