summaryrefslogtreecommitdiffstats
path: root/t/Nagios-Plugin-Getopt-01.t
diff options
context:
space:
mode:
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