]>
Commit | Line | Data |
---|---|---|
453b82a3 DK |
1 | #include <config.h> |
2 | ||
2bb25574 DK |
3 | #include <apt-pkg/cmndline.h> |
4 | #include <apt-pkg/configuration.h> | |
5 | ||
6 | #include <string> | |
7 | ||
8 | #include "assert.h" | |
9 | ||
10 | class CLT: public CommandLine { | |
11 | ||
12 | public: | |
13 | std::string static AsString(const char * const * const argv, | |
14 | unsigned int const argc) { | |
15 | std::string const static conf = "Commandline::AsString"; | |
16 | _config->Clear(conf); | |
17 | SaveInConfig(argc, argv); | |
18 | return _config->Find(conf); | |
19 | } | |
20 | }; | |
21 | ||
22 | #define CMD(y,z) equals(CLT::AsString(argv, y), z); | |
23 | ||
24 | int main() { | |
25 | { | |
26 | const char* const argv[] = {"apt-get", "install", "-sf"}; | |
27 | CMD(3, "apt-get install -sf"); | |
28 | } | |
29 | { | |
30 | const char* const argv[] = {"apt-cache", "-s", "apt", "-so", "Debug::test=Test"}; | |
31 | CMD(5, "apt-cache -s apt -so Debug::test=Test"); | |
32 | } | |
33 | { | |
34 | const char* const argv[] = {"apt-cache", "-s", "apt", "-so", "Debug::test=Das ist ein Test"}; | |
35 | CMD(5, "apt-cache -s apt -so Debug::test=\"Das ist ein Test\""); | |
36 | } | |
37 | { | |
38 | const char* const argv[] = {"apt-cache", "-s", "apt", "--hallo", "test=1.0"}; | |
39 | CMD(5, "apt-cache -s apt --hallo test=1.0"); | |
40 | } | |
41 | } |