diff options
author | Gavin Carr <gonzai@users.sourceforge.net> | 2007-03-21 00:52:56 +0000 |
---|---|---|
committer | Gavin Carr <gonzai@users.sourceforge.net> | 2007-03-21 00:52:56 +0000 |
commit | dc31f1cd3841d486e920e59ce42e888ca94e4289 (patch) | |
tree | 14bcc87e8349b99b01a649f27429690321fc21f9 /t/Nagios-Plugin-Getopt-01.t | |
parent | c6cbf050974c8f6642fa1d7bde309710b66cbfa0 (diff) | |
download | monitoring-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.t | 8 |
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'); | |||
104 | like($@, qr/$PARAM{url}/, 'version info includes url'); | 104 | like($@, qr/$PARAM{url}/, 'version info includes url'); |
105 | unlike($@, qr/Usage:/, 'no usage message'); | 105 | unlike($@, qr/Usage:/, 'no usage message'); |
106 | unlike($@, qr/Missing arg/, 'no missing arguments'); | 106 | unlike($@, qr/Missing arg/, 'no missing arguments'); |
107 | |||
107 | @ARGV = ( '--version' ); | 108 | @ARGV = ( '--version' ); |
108 | $ng = setup; | 109 | $ng = setup; |
109 | ok(! defined eval { $ng->getopts }, 'getopts died on version'); | 110 | ok(! defined eval { $ng->getopts }, 'getopts died on version'); |
@@ -128,6 +129,7 @@ like($@, qr/--verbose/, 'help includes default options 2'); | |||
128 | like($@, qr/--warning/, 'help includes custom option 1'); | 129 | like($@, qr/--warning/, 'help includes custom option 1'); |
129 | like($@, qr/--critical/, 'help includes custom option 2'); | 130 | like($@, qr/--critical/, 'help includes custom option 2'); |
130 | unlike($@, qr/Missing arg/, 'no missing arguments'); | 131 | unlike($@, qr/Missing arg/, 'no missing arguments'); |
132 | |||
131 | @ARGV = ( '--help' ); | 133 | @ARGV = ( '--help' ); |
132 | $ng = setup; | 134 | $ng = setup; |
133 | ok(! defined eval { $ng->getopts }, 'getopts died on help'); | 135 | ok(! defined eval { $ng->getopts }, 'getopts died on help'); |
@@ -140,6 +142,6 @@ like($@, qr/Usage:/, 'help includes usage message'); | |||
140 | like($@, qr/--version/, 'help includes default options 1'); | 142 | like($@, qr/--version/, 'help includes default options 1'); |
141 | like($@, qr/--verbose/, 'help includes default options 2'); | 143 | like($@, qr/--verbose/, 'help includes default options 2'); |
142 | like($@, qr/--warning/, 'help includes custom option 1'); | 144 | like($@, qr/--warning/, 'help includes custom option 1'); |
143 | like($@, qr/--critical/, 'help includes custom option 2'); | 145 | like($@, qr/-c, --critical=INTEGER/, 'help includes custom option 2, with expanded args'); |
144 | unlike($@, qr/Missing arg/, 'no missing arguments'); | 146 | unlike($@, qr/Missing arg/, 'no missing arguments'); |
145 | 147 | ||