Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
2ca4d215
Commit
2ca4d215
authored
Sep 16, 2011
by
zhanyong.wan
Browse files
Simplifies the implementatoin of the test result printer; by Ulfar Erlingsson
parent
27615dbc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
src/gtest.cc
src/gtest.cc
+4
-8
No files found.
src/gtest.cc
View file @
2ca4d215
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment