From 6079b276a959086ff18302cab752b6d7cfe5ad9f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 26 Oct 2015 11:42:32 +0100 Subject: move apts cmdline helper type into -private Its not as simple as I initially thought to abstract this enough to make it globally usable, so lets not pollute global namespace with this for now. Git-Dch: Ignore --- test/libapt/commandline_test.cc | 14 +++++++++----- test/libapt/gtest_runner.cc | 4 ---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test/libapt') diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc index 0da2ba45f..7f6c511df 100644 --- a/test/libapt/commandline_test.cc +++ b/test/libapt/commandline_test.cc @@ -17,18 +17,22 @@ class CLT: public CommandLine { } }; -#define EXPECT_CMD(x, ...) { const char * const argv[] = { __VA_ARGS__ }; EXPECT_EQ(x, CLT::AsString(argv, sizeof(argv)/sizeof(argv[0]))); } +bool ShowHelp(CommandLine &, aptDispatchWithHelp const *) {return false;} +std::vector GetCommands() {return {};} + TEST(CommandLineTest,SaveInConfig) { - EXPECT_CMD("apt-get install -sf", +#define APT_EXPECT_CMD(x, ...) { const char * const argv[] = { __VA_ARGS__ }; EXPECT_EQ(x, CLT::AsString(argv, sizeof(argv)/sizeof(argv[0]))); } + APT_EXPECT_CMD("apt-get install -sf", "apt-get", "install", "-sf"); - EXPECT_CMD("apt-cache -s apt -so Debug::test=Test", + APT_EXPECT_CMD("apt-cache -s apt -so Debug::test=Test", "apt-cache", "-s", "apt", "-so", "Debug::test=Test"); - EXPECT_CMD("apt-cache -s apt -so Debug::test=\"Das ist ein Test\"", + APT_EXPECT_CMD("apt-cache -s apt -so Debug::test=\"Das ist ein Test\"", "apt-cache", "-s", "apt", "-so", "Debug::test=Das ist ein Test"); - EXPECT_CMD("apt-cache -s apt --hallo test=1.0", + APT_EXPECT_CMD("apt-cache -s apt --hallo test=1.0", "apt-cache", "-s", "apt", "--hallo", "test=1.0"); +#undef APT_EXPECT_CMD } TEST(CommandLineTest,Parsing) { diff --git a/test/libapt/gtest_runner.cc b/test/libapt/gtest_runner.cc index 29f631326..46054afa3 100644 --- a/test/libapt/gtest_runner.cc +++ b/test/libapt/gtest_runner.cc @@ -1,10 +1,6 @@ #include #include -#include - -bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const *) {return false;} -std::vector GetCommands() {return {};} int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); -- cgit v1.2.3