]>
Commit | Line | Data |
---|---|---|
453b82a3 DK |
1 | #include <config.h> |
2 | ||
ae2be086 | 3 | #include <apt-pkg/cmndline.h> |
453b82a3 | 4 | #include <apt-pkg/configuration.h> |
ae2be086 DH |
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 | }; | |
ae2be086 | 15 | CommandLine CmdL(Args,_config); |
7a6d9076 | 16 | |
ae2be086 DH |
17 | char const * argv[] = { "test", "--zero", "-t" }; |
18 | CmdL.Parse(3 , argv); | |
ae2be086 DH |
19 | equals(true, _config->FindB("Test::Worked", false)); |
20 | equals(true, _config->FindB("Test::Zero", false)); | |
21 | ||
7a6d9076 DK |
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 | ||
ae2be086 DH |
34 | return 0; |
35 | } |