diff options
author | Michael Vogt <egon@debian-devbox> | 2012-06-11 14:56:11 +0200 |
---|---|---|
committer | Michael Vogt <egon@debian-devbox> | 2012-06-11 14:56:11 +0200 |
commit | cb6a5776bfb5f74d94f32db55f2de148c27a5d10 (patch) | |
tree | 3c8f8bcaeefb9e51bff8476b262de18b4b39b11b /test/libapt/commandline_test.cc | |
parent | 563fd891d80feedefd812aad83844e2189870e2c (diff) | |
parent | 249a02f55a2b311fc130efe3b3a99995b6a71360 (diff) |
merged from donkult
Diffstat (limited to 'test/libapt/commandline_test.cc')
-rw-r--r-- | test/libapt/commandline_test.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc new file mode 100644 index 000000000..de8a30bd6 --- /dev/null +++ b/test/libapt/commandline_test.cc @@ -0,0 +1,32 @@ +#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)); + + _config->Clear("Test"); + equals(false, _config->FindB("Test::Worked", false)); + equals(false, _config->FindB("Test::Zero", false)); + + _config->Set("Test::Zero", true); + equals(true, _config->FindB("Test::Zero", false)); + + char const * argv2[] = { "test", "--no-zero", "-t" }; + CmdL.Parse(3 , argv2); + equals(true, _config->FindB("Test::Worked", false)); + equals(false, _config->FindB("Test::Zero", false)); + + return 0; +} |