]> git.saurik.com Git - apt.git/blob - test/libapt/commandline_test.cc
Fix option name DPkg::Progress-Fancy in apt.8 manpage (LP: #1310506)
[apt.git] / test / libapt / commandline_test.cc
1 #include <config.h>
2
3 #include <apt-pkg/cmndline.h>
4 #include <apt-pkg/configuration.h>
5
6 #include "assert.h"
7
8 int main()
9 {
10 CommandLine::Args Args[] = {
11 { 't', 0, "Test::Worked", 0 },
12 { 'z', "zero", "Test::Zero", 0 },
13 {0,0,0,0}
14 };
15 CommandLine CmdL(Args,_config);
16
17 char const * argv[] = { "test", "--zero", "-t" };
18 CmdL.Parse(3 , argv);
19 equals(true, _config->FindB("Test::Worked", false));
20 equals(true, _config->FindB("Test::Zero", false));
21
22 _config->Clear("Test");
23 equals(false, _config->FindB("Test::Worked", false));
24 equals(false, _config->FindB("Test::Zero", false));
25
26 _config->Set("Test::Zero", true);
27 equals(true, _config->FindB("Test::Zero", false));
28
29 char const * argv2[] = { "test", "--no-zero", "-t" };
30 CmdL.Parse(3 , argv2);
31 equals(true, _config->FindB("Test::Worked", false));
32 equals(false, _config->FindB("Test::Zero", false));
33
34 return 0;
35 }