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
7d470772
Commit
7d470772
authored
Aug 02, 2020
by
srz_zumix
Browse files
fix tests
parent
317ec2f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
12 deletions
+24
-12
googletest/include/gtest/internal/gtest-internal.h
googletest/include/gtest/internal/gtest-internal.h
+12
-0
googletest/test/googletest-shuffle-test_.cc
googletest/test/googletest-shuffle-test_.cc
+1
-1
googletest/test/gtest-typed-test_test.cc
googletest/test/gtest-typed-test_test.cc
+4
-4
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+7
-7
No files found.
googletest/include/gtest/internal/gtest-internal.h
View file @
7d470772
...
...
@@ -520,6 +520,7 @@ struct SuiteApiResolver : T {
static
SetUpTearDownSuiteFuncType
GetSetUpCaseOrSuite
(
const
char
*
filename
,
int
line_num
)
{
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
SetUpTearDownSuiteFuncType
test_case_fp
=
GetNotDefaultOrNull
(
&
T
::
SetUpTestCase
,
&
Test
::
SetUpTestCase
);
SetUpTearDownSuiteFuncType
test_suite_fp
=
...
...
@@ -531,10 +532,16 @@ struct SuiteApiResolver : T {
<<
filename
<<
":"
<<
line_num
;
return
test_case_fp
!=
nullptr
?
test_case_fp
:
test_suite_fp
;
#else
(
void
)(
filename
);
(
void
)(
line_num
);
return
&
T
::
SetUpTestSuite
;
#endif
}
static
SetUpTearDownSuiteFuncType
GetTearDownCaseOrSuite
(
const
char
*
filename
,
int
line_num
)
{
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
SetUpTearDownSuiteFuncType
test_case_fp
=
GetNotDefaultOrNull
(
&
T
::
TearDownTestCase
,
&
Test
::
TearDownTestCase
);
SetUpTearDownSuiteFuncType
test_suite_fp
=
...
...
@@ -546,6 +553,11 @@ struct SuiteApiResolver : T {
<<
filename
<<
":"
<<
line_num
;
return
test_case_fp
!=
nullptr
?
test_case_fp
:
test_suite_fp
;
#else
(
void
)(
filename
);
(
void
)(
line_num
);
return
&
T
::
TearDownTestSuite
;
#endif
}
};
...
...
googletest/test/googletest-shuffle-test_.cc
View file @
7d470772
...
...
@@ -82,7 +82,7 @@ class TestNamePrinter : public EmptyTestEventListener {
}
void
OnTestStart
(
const
TestInfo
&
test_info
)
override
{
printf
(
"%s.%s
\n
"
,
test_info
.
test_
cas
e_name
(),
test_info
.
name
());
printf
(
"%s.%s
\n
"
,
test_info
.
test_
suit
e_name
(),
test_info
.
name
());
}
};
...
...
googletest/test/gtest-typed-test_test.cc
View file @
7d470772
...
...
@@ -193,13 +193,13 @@ TYPED_TEST(TypedTestWithNames, TestSuiteName) {
if
(
std
::
is_same
<
TypeParam
,
char
>::
value
)
{
EXPECT_STREQ
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
()
->
test_
cas
e_name
(),
->
test_
suit
e_name
(),
"TypedTestWithNames/char0"
);
}
if
(
std
::
is_same
<
TypeParam
,
int
>::
value
)
{
EXPECT_STREQ
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
()
->
test_
cas
e_name
(),
->
test_
suit
e_name
(),
"TypedTestWithNames/int1"
);
}
}
...
...
@@ -315,13 +315,13 @@ TYPED_TEST_P(TypeParametrizedTestWithNames, TestSuiteName) {
if
(
std
::
is_same
<
TypeParam
,
char
>::
value
)
{
EXPECT_STREQ
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
()
->
test_
cas
e_name
(),
->
test_
suit
e_name
(),
"CustomName/TypeParametrizedTestWithNames/parChar0"
);
}
if
(
std
::
is_same
<
TypeParam
,
int
>::
value
)
{
EXPECT_STREQ
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
()
->
test_
cas
e_name
(),
->
test_
suit
e_name
(),
"CustomName/TypeParametrizedTestWithNames/parInt1"
);
}
}
...
...
googletest/test/gtest_unittest.cc
View file @
7d470772
...
...
@@ -222,7 +222,7 @@ using testing::Message;
using
testing
::
ScopedFakeTestPartResultReporter
;
using
testing
::
StaticAssertTypeEq
;
using
testing
::
Test
;
using testing::Test
Cas
e;
using
testing
::
Test
Suit
e
;
using
testing
::
TestEventListeners
;
using
testing
::
TestInfo
;
using
testing
::
TestPartResult
;
...
...
@@ -5339,7 +5339,7 @@ class TestInfoTest : public Test {
TEST_F
(
TestInfoTest
,
Names
)
{
const
TestInfo
*
const
test_info
=
GetTestInfo
(
"Names"
);
ASSERT_STREQ("TestInfoTest", test_info->test_
cas
e_name());
ASSERT_STREQ
(
"TestInfoTest"
,
test_info
->
test_
suit
e_name
());
ASSERT_STREQ
(
"Names"
,
test_info
->
name
());
}
...
...
@@ -5409,7 +5409,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, CodeLocationForTYPEDTESTP, int);
// Tests setting up and tearing down a test case.
// Legacy API is deprecated but still available
#ifndef REMOVE_LEGACY_TEST_CASEAPI
#ifndef
GTEST_
REMOVE_LEGACY_TEST_CASEAPI
_
class
SetUpTestCaseTest
:
public
Test
{
protected:
// This will be called once before the first test in this test case
...
...
@@ -6374,8 +6374,8 @@ TEST_F(CurrentTestInfoTest, WorksForFirstTestInATestSuite) {
UnitTest
::
GetInstance
()
->
current_test_info
();
ASSERT_TRUE
(
nullptr
!=
test_info
)
<<
"There is a test running so we should have a valid TestInfo."
;
EXPECT_STREQ("CurrentTestInfoTest", test_info->test_
cas
e_name())
<< "Expected the name of the currently running test
cas
e.";
EXPECT_STREQ
(
"CurrentTestInfoTest"
,
test_info
->
test_
suit
e_name
())
<<
"Expected the name of the currently running test
suit
e."
;
EXPECT_STREQ
(
"WorksForFirstTestInATestSuite"
,
test_info
->
name
())
<<
"Expected the name of the currently running test."
;
}
...
...
@@ -6389,8 +6389,8 @@ TEST_F(CurrentTestInfoTest, WorksForSecondTestInATestSuite) {
UnitTest
::
GetInstance
()
->
current_test_info
();
ASSERT_TRUE
(
nullptr
!=
test_info
)
<<
"There is a test running so we should have a valid TestInfo."
;
EXPECT_STREQ("CurrentTestInfoTest", test_info->test_
cas
e_name())
<< "Expected the name of the currently running test
cas
e.";
EXPECT_STREQ
(
"CurrentTestInfoTest"
,
test_info
->
test_
suit
e_name
())
<<
"Expected the name of the currently running test
suit
e."
;
EXPECT_STREQ
(
"WorksForSecondTestInATestSuite"
,
test_info
->
name
())
<<
"Expected the name of the currently running test."
;
}
...
...
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