diff options
Diffstat (limited to 'tools/slang-test/test-reporter.cpp')
| -rw-r--r-- | tools/slang-test/test-reporter.cpp | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/tools/slang-test/test-reporter.cpp b/tools/slang-test/test-reporter.cpp index fd9748b28..4a7c76c4c 100644 --- a/tools/slang-test/test-reporter.cpp +++ b/tools/slang-test/test-reporter.cpp @@ -314,28 +314,38 @@ void TestReporter::_addResult(const TestInfo& info) m_testInfos.add(info); - // printf("OUTPUT_MODE: %d\n", options.outputMode); - switch (m_outputMode) + auto defaultOutputFunc = [](const TestInfo& info) { + char const* resultString = "UNEXPECTED"; + switch (info.testResult) + { + case TestResult::Fail: + resultString = "FAILED"; + break; + case TestResult::Pass: + resultString = "passed"; + break; + case TestResult::Ignored: + resultString = "ignored"; + break; default: + assert(!"unexpected"); + break; + } + + StringBuilder buffer; + if (info.executionTime > 0.0f) { - char const* resultString = "UNEXPECTED"; - switch (info.testResult) - { - case TestResult::Fail: resultString = "FAILED"; break; - case TestResult::Pass: resultString = "passed"; break; - case TestResult::Ignored: resultString = "ignored"; break; - default: - assert(!"unexpected"); - break; - } + _appendTime(info.executionTime, buffer); + } + printf("%s test: '%S' %s\n", resultString, info.name.toWString().begin(), buffer.getBuffer()); + }; - StringBuilder buffer; - if (info.executionTime > 0.0f) - { - _appendTime(info.executionTime, buffer); - } - printf("%s test: '%S' %s\n", resultString, info.name.toWString().begin(), buffer.getBuffer()); + switch (m_outputMode) + { + default: + { + defaultOutputFunc(info); break; } case TestOutputMode::TeamCity: @@ -464,7 +474,7 @@ void TestReporter::_addResult(const TestInfo& info) exeRes.standardError.begin()); #endif } - + defaultOutputFunc(info); break; } } |
