summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-09-16 16:43:37 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-09-16 16:43:37 +0000
commit74b3308eea50db2e7ea0a113a61ac6793b83991a (patch)
treeea95546dfda50bc857e4be2b045ca3921a617a5d
parent746d1a9e2f274565ded115a9f4a69a594a771491 (diff)
downloadgoogletest-74b3308eea50db2e7ea0a113a61ac6793b83991a.tar.gz
Simplifies the implementatoin of the test result printer; by Ulfar Erlingsson
git-svn-id: http://googletest.googlecode.com/svn/trunk@595 861a406c-534a-0410-8894-cb66d6ee9925
-rw-r--r--src/gtest.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/gtest.cc b/src/gtest.cc
index b6481f7..6f7216f 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -2707,8 +2707,6 @@ class PrettyUnitTestResultPrinter : public TestEventListener {
private:
static void PrintFailedTests(const UnitTest& unit_test);
-
- internal::String test_case_name_;
};
// Fired before each iteration of tests starts.
@@ -2755,11 +2753,10 @@ void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
}
void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
- test_case_name_ = test_case.name();
const internal::String counts =
FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
ColoredPrintf(COLOR_GREEN, "[----------] ");
- printf("%s from %s", counts.c_str(), test_case_name_.c_str());
+ printf("%s from %s", counts.c_str(), test_case.name());
if (test_case.type_param() == NULL) {
printf("\n");
} else {
@@ -2770,7 +2767,7 @@ void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
- PrintTestName(test_case_name_.c_str(), test_info.name());
+ PrintTestName(test_info.test_case_name(), test_info.name());
printf("\n");
fflush(stdout);
}
@@ -2793,7 +2790,7 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
} else {
ColoredPrintf(COLOR_RED, "[ FAILED ] ");
}
- PrintTestName(test_case_name_.c_str(), test_info.name());
+ PrintTestName(test_info.test_case_name(), test_info.name());
if (test_info.result()->Failed())
PrintFullTestCommentIfPresent(test_info);
@@ -2809,12 +2806,11 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
if (!GTEST_FLAG(print_time)) return;
- test_case_name_ = test_case.name();
const internal::String counts =
FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
ColoredPrintf(COLOR_GREEN, "[----------] ");
printf("%s from %s (%s ms total)\n\n",
- counts.c_str(), test_case_name_.c_str(),
+ counts.c_str(), test_case.name(),
internal::StreamableToString(test_case.elapsed_time()).c_str());
fflush(stdout);
}