]> git.saurik.com Git - apt.git/blame_incremental - test/libapt/commandline_test.cc
merge patch from Daniel Hartwig to Show a error message if {,dist-}upgrade is used...
[apt.git] / test / libapt / commandline_test.cc
... / ...
CommitLineData
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 };
12 CommandLine CmdL(Args,_config);
13
14 char const * argv[] = { "test", "--zero", "-t" };
15 CmdL.Parse(3 , argv);
16 equals(true, _config->FindB("Test::Worked", false));
17 equals(true, _config->FindB("Test::Zero", false));
18
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
31 return 0;
32}