]> git.saurik.com Git - apt.git/blame - test/libapt/commandline_test.cc
Merge branch 'feature/tests-on-installed' into debian/sid
[apt.git] / test / libapt / commandline_test.cc
CommitLineData
ae2be086
DH
1#include <apt-pkg/cmndline.h>
2
3#include "assert.h"
4
5int main()
6{
7 CommandLine::Args Args[] = {
8 { 't', 0, "Test::Worked", 0 },
9 { 'z', "zero", "Test::Zero", 0 },
10 {0,0,0,0}
11 };
ae2be086 12 CommandLine CmdL(Args,_config);
7a6d9076 13
ae2be086
DH
14 char const * argv[] = { "test", "--zero", "-t" };
15 CmdL.Parse(3 , argv);
ae2be086
DH
16 equals(true, _config->FindB("Test::Worked", false));
17 equals(true, _config->FindB("Test::Zero", false));
18
7a6d9076
DK
19 _config->Clear("Test");
20 equals(false, _config->FindB("Test::Worked", false));
21 equals(false, _config->FindB("Test::Zero", false));
22
23 _config->Set("Test::Zero", true);
24 equals(true, _config->FindB("Test::Zero", false));
25
26 char const * argv2[] = { "test", "--no-zero", "-t" };
27 CmdL.Parse(3 , argv2);
28 equals(true, _config->FindB("Test::Worked", false));
29 equals(false, _config->FindB("Test::Zero", false));
30
ae2be086
DH
31 return 0;
32}