aboutsummaryrefslogtreecommitdiff
path: root/lib/tests
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2008-03-31 07:04:07 +0000
committerGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2008-03-31 07:04:07 +0000
commitd043862c154070b2c58172289899dd14776e2d03 (patch)
tree2b660e8f4a73d0237b7dabf7faaad4a17bbe69b6 /lib/tests
parent20a8bf1a3ffcdf0e715e03ad654a4a08673e870f (diff)
downloadmonitoring-plugins-d043862c154070b2c58172289899dd14776e2d03.tar.gz
Fix bug with --extra-opts as last argument with no value
Fix problem with duplicate function name (function should eventually move to /lib) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1969 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/test_opts.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/tests/test_opts.c b/lib/tests/test_opts.c
index 54210fba..61370a9c 100644
--- a/lib/tests/test_opts.c
+++ b/lib/tests/test_opts.c
@@ -59,7 +59,7 @@ main (int argc, char **argv)
char **argv_test=NULL, **argv_known=NULL;
int i, argc_test;
- plan_tests(11);
+ plan_tests(12);
argv_test=(char **)malloc(2*sizeof(char **));
argv_test[0] = "prog_name";
@@ -221,6 +221,18 @@ main (int argc, char **argv)
argv_known[5] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 1");
+
+ argv_test=(char **)malloc(3*sizeof(char **));
+ argv_test[0] = "prog_name";
+ argv_test[1] = "--extra-opts";
+ argv_test[2] = NULL;
+ argc_test=2;
+ argv_known=(char **)realloc(argv_known, 3*sizeof(char **));
+ argv_known[0] = "prog_name";
+ argv_known[1] = "--foo=bar";
+ argv_known[2] = NULL;
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
+ ok(array_diff(argc_test, argv_test, 2, argv_known), "Default section 2");
my_free(&argc_test,argv_test);
argv_test=(char **)malloc(6*sizeof(char **));
@@ -239,7 +251,7 @@ main (int argc, char **argv)
argv_known[4] = "val2";
argv_known[5] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
- ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 2");
+ ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 3");
my_free(&argc_test,argv_test);
argv_test=(char **)malloc(6*sizeof(char **));