summaryrefslogtreecommitdiffstats
path: root/lib/tests/test_ini3.t
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tests/test_ini3.t')
-rwxr-xr-xlib/tests/test_ini3.t34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/tests/test_ini3.t b/lib/tests/test_ini3.t
new file mode 100755
index 0000000..57388dd
--- /dev/null
+++ b/lib/tests/test_ini3.t
@@ -0,0 +1,34 @@
1#!/usr/bin/perl
2use Test::More;
3use strict;
4use warnings;
5
6if (! -e "./test_ini") {
7 plan skip_all => "./test_ini not compiled - please install tap library and/or enable parse-ini to test";
8}
9
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
16my @TESTS = (
17 [3, undef, "section", "section_unknown@./config-tiny.ini"],
18);
19
20plan tests => scalar(@TESTS);
21
22my $count=1;
23
24foreach 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_ini2'} @$args;
32 cmp_ok($?>>8, '==', $rc, "Parse-ini die " . $count++);
33}
34