diff --git a/application/argumentparser.cpp b/application/argumentparser.cpp index 0970188..0116256 100644 --- a/application/argumentparser.cpp +++ b/application/argumentparser.cpp @@ -288,8 +288,8 @@ ArgumentParser::ArgumentParser() : * \remarks * - The parser does not take ownership. Do not destroy the arguments as long as they are used as * main arguments. - * - Sets the first specified argument as default argument if none is assigned yet and the - * first argument has no mandatory sub arguments. + * - Sets the first specified argument as default argument if none has been assigned yet and the + * first argument does not require any values or has no mandatory sub arguments. */ void ArgumentParser::setMainArguments(const ArgumentInitializerList &mainArguments) { @@ -301,7 +301,7 @@ void ArgumentParser::setMainArguments(const ArgumentInitializerList &mainArgumen if(!m_defaultArg) { if(!(*mainArguments.begin())->requiredValueCount()) { bool subArgsRequired = false; - for(Argument *subArg : (*mainArguments.begin())->subArguments()) { + for(const Argument *subArg : (*mainArguments.begin())->subArguments()) { if(subArg->isRequired()) { subArgsRequired = true; break; diff --git a/tests/testutils.cpp b/tests/testutils.cpp index 95cb8c6..ffc8bb4 100644 --- a/tests/testutils.cpp +++ b/tests/testutils.cpp @@ -221,8 +221,16 @@ string TestApplication::workingCopyPath(const string &name) const * - The specified \a args must be 0 terminated. The first argument is the application name. * - Currently only available under UNIX. */ -int TestApplication::execApp(const char *const *args, string &stdout, string &stderr) const +int TestApplication::execApp(const char *const *args, string &stdout, string &stderr, bool suppressLogging) const { + // print log message + if(!suppressLogging) { + cout << '-'; + for(const char *const *i = args; *i; ++i) { + cout << ' ' << *i; + } + cout << endl; + } // determine application path const char *appPath = m_applicationPathArg.firstValue(); if(!appPath || !*appPath) { diff --git a/tests/testutils.h b/tests/testutils.h index 31a757a..4c4455e 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -18,7 +18,7 @@ public: std::string testFilePath(const std::string &name) const; #ifdef PLATFORM_UNIX std::string workingCopyPath(const std::string &name) const; - int execApp(const char *const *args, std::string &output, std::string &errors) const; + int execApp(const char *const *args, std::string &output, std::string &errors, bool suppressLogging = false) const; #endif bool unitsSpecified() const; const std::vector &units() const;