namespace DPL {
namespace Test {
+namespace {
+
+const std::string NO_VERBOSE_ARG = "--no-verbose";
+
+}
ConsoleCollector::ConsoleCollector()
+ : m_verbosity(true)
{
}
return new ConsoleCollector();
}
+bool ConsoleCollector::ParseCollectorSpecificArg(const std::string& arg)
+{
+ if (arg != NO_VERBOSE_ARG)
+ return false;
+ m_verbosity=false;
+ return true;
+}
+
+std::string ConsoleCollector::CollectorSpecificHelp() const
+{
+ return NO_VERBOSE_ARG + " - turns off verbosity\n" +
+ std::string(NO_VERBOSE_ARG.size(), ' ') + " verbosity turned on by default\n";
+}
+
void ConsoleCollector::CollectCurrentTestGroupName(const std::string& name)
{
printf("Starting group %s\n", name.c_str());
printf(GREEN_RESULT_OK);
break;
case FailStatus::FAILED:
- PrintfErrorMessage(" FAILED ", reason, true);
+ PrintfErrorMessage(" FAILED ", reason);
break;
case FailStatus::IGNORED:
- PrintfIgnoredMessage("Ignored ", reason, true);
+ PrintfIgnoredMessage("Ignored ", reason);
break;
default:
Assert(false && "Bad status");
m_groupsStats[m_currentGroup].AddTest(status);
}
-void ConsoleCollector::PrintfErrorMessage(const char* type,
- const std::string& message,
- bool verbosity)
+void ConsoleCollector::PrintfErrorMessage(const char* type, const std::string& message)
{
using namespace DPL::Colors::Text;
- if (verbosity) {
- printf("[%s%s%s] %s%s%s\n",
- BOLD_RED_BEGIN,
- type,
- BOLD_RED_END,
+ printf("[%s%s%s]",
+ BOLD_RED_BEGIN,
+ type,
+ BOLD_RED_END);
+ if (m_verbosity) {
+ printf(" %s%s%s",
BOLD_YELLOW_BEGIN,
message.c_str(),
BOLD_YELLOW_END);
- } else {
- printf("[%s%s%s]\n",
- BOLD_RED_BEGIN,
- type,
- BOLD_RED_END);
}
+ printf("\n");
}
-void ConsoleCollector::PrintfIgnoredMessage(const char* type,
- const std::string& message,
- bool verbosity)
+void ConsoleCollector::PrintfIgnoredMessage(const char* type, const std::string& message)
{
using namespace DPL::Colors::Text;
- if (verbosity) {
- printf("[%s%s%s] %s%s%s\n",
- CYAN_BEGIN,
- type,
- CYAN_END,
+ printf("[%s%s%s]",
+ CYAN_BEGIN,
+ type,
+ CYAN_END);
+ if (m_verbosity) {
+ printf(" %s%s%s",
BOLD_GOLD_BEGIN,
message.c_str(),
BOLD_GOLD_END);
- } else {
- printf("[%s%s%s]\n",
- CYAN_BEGIN,
- type,
- CYAN_END);
}
+ printf("\n");
}
void ConsoleCollector::PrintStats(const std::string& title, const Statistic& stats)