summaryrefslogtreecommitdiffstats
path: root/lib/tests/test_ini.c
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-03-15 20:47:43 (GMT)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-03-15 20:47:43 (GMT)
commit1a0ed0d6bb5ffa0991a91cd149d3ecaacb11e59f (patch)
treeeacf3b2384d2421e58280be627408d6d42711f02 /lib/tests/test_ini.c
parent40c123148a9d84218667124a97283f7cb93bfa50 (diff)
downloadmonitoring-plugins-1a0ed0d6bb5ffa0991a91cd149d3ecaacb11e59f.tar.gz
- Make equal-less parameters illegal
- parameters without argument after '=' are now assumed to be argument-less - Add a testcase for space in stanza and various argument-less parameters git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1948 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/tests/test_ini.c')
-rw-r--r--lib/tests/test_ini.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/tests/test_ini.c b/lib/tests/test_ini.c
index de9f8ad..9031f7f 100644
--- a/lib/tests/test_ini.c
+++ b/lib/tests/test_ini.c
@@ -52,18 +52,18 @@ main (int argc, char **argv)
52{ 52{
53 char *optstr=NULL; 53 char *optstr=NULL;
54 54
55 plan_tests(9); 55 plan_tests(10);
56 56
57 optstr=list2str(np_get_defaults("section@./config-tiny.ini", "check_disk")); 57 optstr=list2str(np_get_defaults("section@./config-tiny.ini", "check_disk"));
58 ok( !strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank="), "config-tiny.ini's section as expected"); 58 ok( !strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), "config-tiny.ini's section as expected");
59 my_free(optstr); 59 my_free(optstr);
60 60
61 optstr=list2str(np_get_defaults("@./config-tiny.ini", "section")); 61 optstr=list2str(np_get_defaults("@./config-tiny.ini", "section"));
62 ok( !strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank="), "Used default section name, without specific"); 62 ok( !strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), "Used default section name, without specific");
63 my_free(optstr); 63 my_free(optstr);
64 64
65 optstr=list2str(np_get_defaults("section_unknown@./config-tiny.ini", "section")); 65 optstr=list2str(np_get_defaults("section_unknown@./config-tiny.ini", "section"));
66 ok( !strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank="), "Used default section name over specified one"); 66 ok( !strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), "Used default section name over specified one");
67 my_free(optstr); 67 my_free(optstr);
68 68
69 optstr=list2str(np_get_defaults("Section Two@./config-tiny.ini", "check_disk")); 69 optstr=list2str(np_get_defaults("Section Two@./config-tiny.ini", "check_disk"));
@@ -90,6 +90,10 @@ main (int argc, char **argv)
90 ok( !strcmp(optstr, "-u=admin -p=secret"), "plugin.ini's check_mysql2 as expected"); 90 ok( !strcmp(optstr, "-u=admin -p=secret"), "plugin.ini's check_mysql2 as expected");
91 my_free(optstr); 91 my_free(optstr);
92 92
93 optstr=list2str(np_get_defaults("check space_and_flags@./plugin.ini", "check_disk"));
94 ok( !strcmp(optstr, "--foo=bar -a -b --bar"), "plugin.ini space in stanza and flag arguments");
95 my_free(optstr);
96
93 return exit_status(); 97 return exit_status();
94} 98}
95 99