summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Hartwig <mandyke@gmail.com>2012-06-09 22:49:37 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-06-09 22:49:37 +0200
commitae2be086c6996e6ed02b7d828fdcac38248a964d (patch)
treefce29714ff989342e99ccebd9a49fc01efd91e67 /test
parentab59c1ca30640b90bb657d08b2c219bbaeb65783 (diff)
downloadapt-ae2be086c6996e6ed02b7d828fdcac38248a964d.tar.gz
* apt-pkg/contrib/cmdline.cc:
- apply patch from Daniel Hartwig to fix a segfault in case the LongOpt is empty (Closes: #676331)
Diffstat (limited to 'test')
-rw-r--r--test/libapt/commandline_test.cc21
-rw-r--r--test/libapt/makefile6
2 files changed, 27 insertions, 0 deletions
diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc
new file mode 100644
index 00000000..a37fb022
--- /dev/null
+++ b/test/libapt/commandline_test.cc
@@ -0,0 +1,21 @@
+#include <apt-pkg/cmndline.h>
+
+#include "assert.h"
+
+int main()
+{
+ CommandLine::Args Args[] = {
+ { 't', 0, "Test::Worked", 0 },
+ { 'z', "zero", "Test::Zero", 0 },
+ {0,0,0,0}
+ };
+
+ CommandLine CmdL(Args,_config);
+ char const * argv[] = { "test", "--zero", "-t" };
+ CmdL.Parse(3 , argv);
+
+ equals(true, _config->FindB("Test::Worked", false));
+ equals(true, _config->FindB("Test::Zero", false));
+
+ return 0;
+}
diff --git a/test/libapt/makefile b/test/libapt/makefile
index 1952051e..b2e6db2d 100644
--- a/test/libapt/makefile
+++ b/test/libapt/makefile
@@ -34,6 +34,12 @@ SOURCE = getlistoffilesindir_test.cc
include $(PROGRAM_H)
# Program for testing CommandLine reconstruction
+PROGRAM = Commandline${BASENAME}
+SLIBS = -lapt-pkg
+SOURCE = commandline_test.cc
+include $(PROGRAM_H)
+
+# Program for testing CommandLine reconstruction
PROGRAM = CommandlineAsString${BASENAME}
SLIBS = -lapt-pkg
SOURCE = commandlineasstring_test.cc