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
5461f63d
Commit
5461f63d
authored
Mar 13, 2018
by
Gennadiy Civil
Browse files
Merge branch 'master' of
https://github.com/google/googletest
parents
af463c43
f35fe6de
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
8 deletions
+35
-8
googletest/include/gtest/gtest-param-test.h
googletest/include/gtest/gtest-param-test.h
+2
-4
googletest/include/gtest/gtest-param-test.h.pump
googletest/include/gtest/gtest-param-test.h.pump
+2
-4
googletest/include/gtest/internal/gtest-internal.h
googletest/include/gtest/internal/gtest-internal.h
+3
-0
googletest/test/gtest-param-test_test.cc
googletest/test/gtest-param-test_test.cc
+28
-0
No files found.
googletest/include/gtest/gtest-param-test.h
View file @
5461f63d
...
...
@@ -1371,8 +1371,6 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
}
# endif // GTEST_HAS_COMBINE
# define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \
...
...
@@ -1386,8 +1384,8 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
#test_case_name, \
::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestPattern(\
#
test_case_name, \
#
test_name, \
GTEST_STRINGIFY_(
test_case_name
)
, \
GTEST_STRINGIFY_(
test_name
)
, \
new ::testing::internal::TestMetaFactory< \
GTEST_TEST_CLASS_NAME_(\
test_case_name, test_name)>()); \
...
...
googletest/include/gtest/gtest-param-test.h.pump
View file @
5461f63d
...
...
@@ -436,8 +436,6 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
]]
# endif // GTEST_HAS_COMBINE
# define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \
...
...
@@ -451,8 +449,8 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
#test_case_name, \
::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestPattern(\
#
test_case_name, \
#
test_name, \
GTEST_STRINGIFY_(
test_case_name
)
, \
GTEST_STRINGIFY_(
test_name
)
, \
new ::testing::internal::TestMetaFactory< \
GTEST_TEST_CLASS_NAME_(\
test_case_name, test_name)>()); \
...
...
googletest/include/gtest/internal/gtest-internal.h
View file @
5461f63d
...
...
@@ -75,6 +75,9 @@
#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
// Stringifies its argument.
#define GTEST_STRINGIFY_(name) #name
class
ProtocolMessage
;
namespace
proto2
{
class
Message
;
}
...
...
googletest/test/gtest-param-test_test.cc
View file @
5461f63d
...
...
@@ -848,6 +848,34 @@ TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) {
INSTANTIATE_TEST_CASE_P
(
ZeroToFiveSequence
,
NamingTest
,
Range
(
0
,
5
));
// Tests that macros in test names are expanded correctly.
class
MacroNamingTest
:
public
TestWithParam
<
int
>
{};
#define PREFIX_WITH_FOO(test_name) Foo##test_name
#define PREFIX_WITH_MACRO(test_name) Macro##test_name
TEST_P
(
PREFIX_WITH_MACRO
(
NamingTest
),
PREFIX_WITH_FOO
(
SomeTestName
))
{
const
::
testing
::
TestInfo
*
const
test_info
=
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
();
EXPECT_STREQ
(
"FortyTwo/MacroNamingTest"
,
test_info
->
test_case_name
());
EXPECT_STREQ
(
"FooSomeTestName"
,
test_info
->
name
());
}
INSTANTIATE_TEST_CASE_P
(
FortyTwo
,
MacroNamingTest
,
Values
(
42
));
// Tests the same thing for non-parametrized tests.
class
MacroNamingTestNonParametrized
:
public
::
testing
::
Test
{};
TEST_F
(
PREFIX_WITH_MACRO
(
NamingTestNonParametrized
),
PREFIX_WITH_FOO
(
SomeTestName
))
{
const
::
testing
::
TestInfo
*
const
test_info
=
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
();
EXPECT_STREQ
(
"MacroNamingTestNonParametrized"
,
test_info
->
test_case_name
());
EXPECT_STREQ
(
"FooSomeTestName"
,
test_info
->
name
());
}
// Tests that user supplied custom parameter names are working correctly.
// Runs the test with a builtin helper method which uses PrintToString,
// as well as a custom function and custom functor to ensure all possible
...
...
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