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