summaryrefslogtreecommitdiffstats
path: root/lib/tests/test_ini3.t
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-23 02:39:45 -0500
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-23 02:43:59 -0500
commit8b103c0c778aa22dbe7688e7d11df20b7c80be70 (patch)
treede74e84102e6f693560b301971bb2b6ee1d05a98 /lib/tests/test_ini3.t
parent485f306868fa9c89b4f09e3b2b813d93ec64f0b4 (diff)
downloadmonitoring-plugins-8b103c0c778aa22dbe7688e7d11df20b7c80be70.tar.gz
Add die tests for parse_ini
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 00000000..57388dda
--- /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