1 #!/usr/bin/perl
2 use Test::More;
3 use strict;
4 use warnings;
6 if (! -e "./test_ini3") {
7 plan skip_all => "./test_ini not compiled - please install tap library and/or enable parse-ini to test";
8 }
10 # array of argument arrays
11 # - First value is the expected return code
12 # - 2nd value is the NAGIOS_CONFIG_PATH
13 # TODO: looks like we look in default path after looking trough this variable - shall we?
14 # - 3rd value is the plugin name
15 # - 4th is the ini locator
16 my @TESTS = (
17 [3, undef, "section", "section_unknown@./config-tiny.ini"],
18 );
20 plan tests => scalar(@TESTS);
22 my $count=1;
24 foreach my $args (@TESTS) {
25 my $rc = shift(@$args);
26 if (my $env = shift(@$args)) {
27 $ENV{"NAGIOS_CONFIG_PATH"} = $env;
28 } else {
29 delete($ENV{"NAGIOS_CONFIG_PATH"});
30 }
31 system {'./test_ini3'} @$args;
32 cmp_ok($?>>8, '==', $rc, "Parse-ini die " . $count++);
33 }