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
80167de7
Commit
80167de7
authored
Jul 14, 2015
by
kosak
Browse files
Minor refactoring.
parent
38dd7485
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
test/gtest_output_test.py
test/gtest_output_test.py
+10
-5
test/gtest_output_test_.cc
test/gtest_output_test_.cc
+4
-7
No files found.
test/gtest_output_test.py
View file @
80167de7
...
...
@@ -40,6 +40,7 @@ SYNOPSIS
__author__
=
'wan@google.com (Zhanyong Wan)'
import
difflib
import
os
import
re
import
sys
...
...
@@ -58,22 +59,22 @@ GOLDEN_NAME = 'gtest_output_test_golden_lin.txt'
PROGRAM_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest_output_test_'
)
# At least one command we exercise must not have the
#
--gtest_
internal_skip_environment_and_ad_hoc_tests
flag
.
#
'
internal_skip_environment_and_ad_hoc_tests
' argument
.
COMMAND_LIST_TESTS
=
({},
[
PROGRAM_PATH
,
'--gtest_list_tests'
])
COMMAND_WITH_COLOR
=
({},
[
PROGRAM_PATH
,
'--gtest_color=yes'
])
COMMAND_WITH_TIME
=
({},
[
PROGRAM_PATH
,
'--gtest_print_time'
,
'
--gtest_
internal_skip_environment_and_ad_hoc_tests'
,
'internal_skip_environment_and_ad_hoc_tests'
,
'--gtest_filter=FatalFailureTest.*:LoggingTest.*'
])
COMMAND_WITH_DISABLED
=
(
{},
[
PROGRAM_PATH
,
'--gtest_also_run_disabled_tests'
,
'
--gtest_
internal_skip_environment_and_ad_hoc_tests'
,
'internal_skip_environment_and_ad_hoc_tests'
,
'--gtest_filter=*DISABLED_*'
])
COMMAND_WITH_SHARDING
=
(
{
'GTEST_SHARD_INDEX'
:
'1'
,
'GTEST_TOTAL_SHARDS'
:
'2'
},
[
PROGRAM_PATH
,
'
--gtest_
internal_skip_environment_and_ad_hoc_tests'
,
'internal_skip_environment_and_ad_hoc_tests'
,
'--gtest_filter=PassingTest.*'
])
GOLDEN_PATH
=
os
.
path
.
join
(
gtest_test_utils
.
GetSourceDir
(),
GOLDEN_NAME
)
...
...
@@ -294,7 +295,11 @@ class GTestOutputTest(gtest_test_utils.TestCase):
normalized_golden
=
RemoveTypeInfoDetails
(
golden
)
if
CAN_GENERATE_GOLDEN_FILE
:
self
.
assertEqual
(
normalized_golden
,
normalized_actual
)
self
.
assertEqual
(
normalized_golden
,
normalized_actual
,
'
\n
'
.
join
(
difflib
.
unified_diff
(
normalized_golden
.
split
(
'
\n
'
),
normalized_actual
.
split
(
'
\n
'
),
'golden'
,
'actual'
)))
else
:
normalized_actual
=
NormalizeToCurrentPlatform
(
RemoveTestCounts
(
normalized_actual
))
...
...
test/gtest_output_test_.cc
View file @
80167de7
...
...
@@ -990,8 +990,6 @@ class BarEnvironment : public testing::Environment {
}
};
bool
GTEST_FLAG
(
internal_skip_environment_and_ad_hoc_tests
)
=
false
;
// The main function.
//
// The idea is to use Google Test to run all the tests we have defined (some
...
...
@@ -1008,10 +1006,9 @@ int main(int argc, char **argv) {
// global side effects. The following line serves as a sanity test
// for it.
testing
::
InitGoogleTest
(
&
argc
,
argv
);
if
(
argc
>=
2
&&
(
std
::
string
(
argv
[
1
])
==
"--gtest_internal_skip_environment_and_ad_hoc_tests"
))
GTEST_FLAG
(
internal_skip_environment_and_ad_hoc_tests
)
=
true
;
bool
internal_skip_environment_and_ad_hoc_tests
=
std
::
count
(
argv
,
argv
+
argc
,
std
::
string
(
"internal_skip_environment_and_ad_hoc_tests"
))
>
0
;
#if GTEST_HAS_DEATH_TEST
if
(
testing
::
internal
::
GTEST_FLAG
(
internal_run_death_test
)
!=
""
)
{
...
...
@@ -1026,7 +1023,7 @@ int main(int argc, char **argv) {
}
#endif // GTEST_HAS_DEATH_TEST
if
(
GTEST_FLAG
(
internal_skip_environment_and_ad_hoc_tests
)
)
if
(
internal_skip_environment_and_ad_hoc_tests
)
return
RUN_ALL_TESTS
();
// Registers two global test environments.
...
...
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