summaryrefslogtreecommitdiffstats
path: root/t/Nagios-Plugin-Getopt-03.t
diff options
context:
space:
mode:
Diffstat (limited to 't/Nagios-Plugin-Getopt-03.t')
-rw-r--r--t/Nagios-Plugin-Getopt-03.t17
1 files changed, 11 insertions, 6 deletions
diff --git a/t/Nagios-Plugin-Getopt-03.t b/t/Nagios-Plugin-Getopt-03.t
index 9dc39da..557a2c6 100644
--- a/t/Nagios-Plugin-Getopt-03.t
+++ b/t/Nagios-Plugin-Getopt-03.t
@@ -1,4 +1,4 @@
1# Nagios::Plugin::Getopt --default-opts tests 1# Nagios::Plugin::Getopt --extra-opts tests
2 2
3use strict; 3use strict;
4use File::Spec; 4use File::Spec;
@@ -27,7 +27,8 @@ for my $efile (glob File::Spec->catfile($tdir, 'expected', '*')) {
27 } 27 }
28} 28}
29 29
30$Nagios::Plugin::Getopt::DEFAULT_CONFIG_FILE = File::Spec->catfile($tdir, 'plugins.cfg'); 30# Override NAGIOS_CONFIG_PATH to use our test plugins.ini file
31$ENV{NAGIOS_CONFIG_PATH} = "/random/bogus/path:$tdir";
31 32
32my %PARAM = ( 33my %PARAM = (
33 version => '0.01', 34 version => '0.01',
@@ -56,14 +57,18 @@ my $arg = [
56 { spec => 'S', help => '-S' }, 57 { spec => 'S', help => '-S' },
57 { spec => 'H=s', help => '-H' }, 58 { spec => 'H=s', help => '-H' },
58 { spec => 'p=s@', help => '-p' }, 59 { spec => 'p=s@', help => '-p' },
60 { spec => 'path=s@', help => '--path' },
59 { spec => 'username|u=s', help => '--username' }, 61 { spec => 'username|u=s', help => '--username' },
60 { spec => 'password=s', help => '--password' }, 62 { spec => 'password=s', help => '--password' },
61 { spec => 'critical=i', help => '--critical' }, 63 { spec => 'critical=s', help => '--critical' },
62 { spec => 'warning=i', help => '--warning' }, 64 { spec => 'warning=s', help => '--warning' },
63 { spec => 'expect=s', help => '--expect' }, 65 { spec => 'expect=s', help => '--expect' },
66 { spec => 'units=s', help => '--units' },
64]; 67];
65 68
66my %SKIP = map { $_ => 1 } qw(05_singlechar1 07_singlechar3); 69#my %SKIP = map { $_ => 1 } qw(05_singlechar1 07_singlechar3);
70#my %SKIP = map { $_ => 1 } qw(06_singlechar2);
71my %SKIP = ();
67 72
68# Process all test cases in $tdir/input 73# Process all test cases in $tdir/input
69my $glob = $ARGV[0] || '*'; 74my $glob = $ARGV[0] || '*';
@@ -82,7 +87,7 @@ for my $infile (glob File::Spec->catfile($tdir, 'input', $glob)) {
82 87
83 # Parse the options 88 # Parse the options
84 SKIP: { 89 SKIP: {
85 skip "Still discussing how overrides with multiple arguments should work ...", 1 if $SKIP{$infile}; 90 skip "Skipping ..." if $SKIP{$infile};
86 91
87 @ARGV = @args; 92 @ARGV = @args;
88 eval { $ng->getopts }; 93 eval { $ng->getopts };