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
0599a7b8
Commit
0599a7b8
authored
Jan 11, 2019
by
misterg
Committed by
Gennadiy Civil
Jan 11, 2019
Browse files
Googletest export
Change tests to use new Test Suite API PiperOrigin-RevId: 228908894
parent
2edadced
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
87 deletions
+92
-87
googletest/test/gtest_repeat_test.cc
googletest/test/gtest_repeat_test.cc
+3
-3
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+69
-66
googletest/test/gtest_xml_output_unittest.py
googletest/test/gtest_xml_output_unittest.py
+6
-6
googletest/test/gtest_xml_output_unittest_.cc
googletest/test/gtest_xml_output_unittest_.cc
+14
-12
No files found.
googletest/test/gtest_repeat_test.cc
View file @
0599a7b8
...
...
@@ -120,9 +120,9 @@ TEST_P(MyParamTest, ShouldPass) {
GTEST_CHECK_INT_EQ_
(
g_param_test_count
%
kNumberOfParamTests
,
GetParam
());
g_param_test_count
++
;
}
INSTANTIATE_TEST_
CAS
E_P
(
MyParamSequence
,
MyParamTest
,
testing
::
Range
(
0
,
kNumberOfParamTests
));
INSTANTIATE_TEST_
SUIT
E_P
(
MyParamSequence
,
MyParamTest
,
testing
::
Range
(
0
,
kNumberOfParamTests
));
// Resets the count for each test.
void
ResetCounts
()
{
...
...
googletest/test/gtest_unittest.cc
View file @
0599a7b8
...
...
@@ -1570,7 +1570,7 @@ class GTestFlagSaverTest : public Test {
// Saves the Google Test flags such that we can restore them later, and
// then sets them to their default values. This will be called
// before the first test in this test case is run.
static
void
SetUpTest
Cas
e
()
{
static
void
SetUpTest
Suit
e
()
{
saver_
=
new
GTestFlagSaver
;
GTEST_FLAG
(
also_run_disabled_tests
)
=
false
;
...
...
@@ -1592,7 +1592,7 @@ class GTestFlagSaverTest : public Test {
// Restores the Google Test flags that the tests have modified. This will
// be called after the last test in this test case is run.
static
void
TearDownTest
Cas
e
()
{
static
void
TearDownTest
Suit
e
()
{
delete
saver_
;
saver_
=
nullptr
;
}
...
...
@@ -1956,7 +1956,7 @@ TEST(ShouldRunTestOnShardTest, IsPartitionWhenThereAreFiveShards) {
// Test class, there are no separate tests for the following classes
// (except for some trivial cases):
//
// Test
Cas
e, UnitTest, UnitTestResultPrinter.
// Test
Suit
e, UnitTest, UnitTestResultPrinter.
//
// Similarly, there are no separate tests for the following macros:
//
...
...
@@ -1990,7 +1990,7 @@ void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest(
key
);
}
void
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Cas
e
(
void
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Suit
e
(
const
char
*
key
)
{
const
TestCase
*
test_case
=
UnitTest
::
GetInstance
()
->
current_test_case
();
ASSERT_TRUE
(
test_case
!=
nullptr
);
...
...
@@ -1998,7 +1998,7 @@ void ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTestCase(
test_case
->
ad_hoc_test_result
(),
key
);
}
void
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
void
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
const
char
*
key
)
{
ExpectNonFatalFailureRecordingPropertyWithReservedKey
(
UnitTest
::
GetInstance
()
->
ad_hoc_test_result
(),
key
);
...
...
@@ -2010,29 +2010,30 @@ void ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
class
UnitTestRecordPropertyTest
:
public
testing
::
internal
::
UnitTestRecordPropertyTestHelper
{
public:
static
void
SetUpTest
Cas
e
()
{
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Cas
e
(
static
void
SetUpTest
Suit
e
()
{
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Suit
e
(
"disabled"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Suit
e
(
"errors"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Suit
e
(
"failures"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Suit
e
(
"name"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Suit
e
(
"tests"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
Suit
e
(
"time"
);
Test
::
RecordProperty
(
"test_case_key_1"
,
"1"
);
const
TestCase
*
test_case
=
UnitTest
::
GetInstance
()
->
current_test_case
();
ASSERT_TRUE
(
test_case
!=
nullptr
);
const
testing
::
TestSuite
*
test_suite
=
UnitTest
::
GetInstance
()
->
current_test_case
();
ASSERT_TRUE
(
test_suite
!=
nullptr
);
ASSERT_EQ
(
1
,
test_
cas
e
->
ad_hoc_test_result
().
test_property_count
());
ASSERT_EQ
(
1
,
test_
suit
e
->
ad_hoc_test_result
().
test_property_count
());
EXPECT_STREQ
(
"test_case_key_1"
,
test_
cas
e
->
ad_hoc_test_result
().
GetTestProperty
(
0
).
key
());
test_
suit
e
->
ad_hoc_test_result
().
GetTestProperty
(
0
).
key
());
EXPECT_STREQ
(
"1"
,
test_
cas
e
->
ad_hoc_test_result
().
GetTestProperty
(
0
).
value
());
test_
suit
e
->
ad_hoc_test_result
().
GetTestProperty
(
0
).
value
());
}
};
...
...
@@ -2085,7 +2086,7 @@ TEST_F(UnitTestRecordPropertyTest, OverridesValuesForDuplicateKeys) {
}
TEST_F
(
UnitTestRecordPropertyTest
,
AddFailureInsideTestsWhenUsingTest
Cas
eReservedKeys
)
{
AddFailureInsideTestsWhenUsingTest
Suit
eReservedKeys
)
{
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
(
"name"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyForCurrentTest
(
...
...
@@ -2111,21 +2112,21 @@ TEST_F(UnitTestRecordPropertyTest,
class
UnitTestRecordPropertyTestEnvironment
:
public
Environment
{
public:
void
TearDown
()
override
{
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
"tests"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
"failures"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
"disabled"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
"errors"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
"name"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
"timestamp"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
"time"
);
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Cas
e
(
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTest
Suit
e
(
"random_seed"
);
}
};
...
...
@@ -3119,28 +3120,28 @@ TEST(DisabledTest, NotDISABLED_TestShouldRun) {
// A test case whose name starts with DISABLED_.
// Should not run.
TEST
(
DISABLED_Test
Cas
e
,
TestShouldNotRun
)
{
TEST
(
DISABLED_Test
Suit
e
,
TestShouldNotRun
)
{
FAIL
()
<<
"Unexpected failure: Test in disabled test case should not be run."
;
}
// A test case and test whose names start with DISABLED_.
// Should not run.
TEST
(
DISABLED_Test
Cas
e
,
DISABLED_TestShouldNotRun
)
{
TEST
(
DISABLED_Test
Suit
e
,
DISABLED_TestShouldNotRun
)
{
FAIL
()
<<
"Unexpected failure: Test in disabled test case should not be run."
;
}
// Check that when all tests in a test case are disabled, SetUpTest
Cas
e() and
// TearDownTest
Cas
e() are not called.
// Check that when all tests in a test case are disabled, SetUpTest
Suit
e() and
// TearDownTest
Suit
e() are not called.
class
DisabledTestsTest
:
public
Test
{
protected:
static
void
SetUpTest
Cas
e
()
{
static
void
SetUpTest
Suit
e
()
{
FAIL
()
<<
"Unexpected failure: All tests disabled in test case. "
"SetUpTest
Cas
e() should not be called."
;
"SetUpTest
Suit
e() should not be called."
;
}
static
void
TearDownTest
Cas
e
()
{
static
void
TearDownTest
Suit
e
()
{
FAIL
()
<<
"Unexpected failure: All tests disabled in test case. "
"TearDownTest
Cas
e() should not be called."
;
"TearDownTest
Suit
e() should not be called."
;
}
};
...
...
@@ -3161,7 +3162,7 @@ class TypedTest : public Test {
};
typedef
testing
::
Types
<
int
,
double
>
NumericTypes
;
TYPED_TEST_
CAS
E
(
TypedTest
,
NumericTypes
);
TYPED_TEST_
SUIT
E
(
TypedTest
,
NumericTypes
);
TYPED_TEST
(
TypedTest
,
DISABLED_ShouldNotRun
)
{
FAIL
()
<<
"Unexpected failure: Disabled typed test should not run."
;
...
...
@@ -3171,7 +3172,7 @@ template <typename T>
class
DISABLED_TypedTest
:
public
Test
{
};
TYPED_TEST_
CAS
E
(
DISABLED_TypedTest
,
NumericTypes
);
TYPED_TEST_
SUIT
E
(
DISABLED_TypedTest
,
NumericTypes
);
TYPED_TEST
(
DISABLED_TypedTest
,
ShouldNotRun
)
{
FAIL
()
<<
"Unexpected failure: Disabled typed test should not run."
;
...
...
@@ -3187,31 +3188,31 @@ template <typename T>
class
TypedTestP
:
public
Test
{
};
TYPED_TEST_
CAS
E_P
(
TypedTestP
);
TYPED_TEST_
SUIT
E_P
(
TypedTestP
);
TYPED_TEST_P
(
TypedTestP
,
DISABLED_ShouldNotRun
)
{
FAIL
()
<<
"Unexpected failure: "
<<
"Disabled type-parameterized test should not run."
;
}
REGISTER_TYPED_TEST_
CAS
E_P
(
TypedTestP
,
DISABLED_ShouldNotRun
);
REGISTER_TYPED_TEST_
SUIT
E_P
(
TypedTestP
,
DISABLED_ShouldNotRun
);
INSTANTIATE_TYPED_TEST_
CAS
E_P
(
My
,
TypedTestP
,
NumericTypes
);
INSTANTIATE_TYPED_TEST_
SUIT
E_P
(
My
,
TypedTestP
,
NumericTypes
);
template
<
typename
T
>
class
DISABLED_TypedTestP
:
public
Test
{
};
TYPED_TEST_
CAS
E_P
(
DISABLED_TypedTestP
);
TYPED_TEST_
SUIT
E_P
(
DISABLED_TypedTestP
);
TYPED_TEST_P
(
DISABLED_TypedTestP
,
ShouldNotRun
)
{
FAIL
()
<<
"Unexpected failure: "
<<
"Disabled type-parameterized test should not run."
;
}
REGISTER_TYPED_TEST_
CAS
E_P
(
DISABLED_TypedTestP
,
ShouldNotRun
);
REGISTER_TYPED_TEST_
SUIT
E_P
(
DISABLED_TypedTestP
,
ShouldNotRun
);
INSTANTIATE_TYPED_TEST_
CAS
E_P
(
My
,
DISABLED_TypedTestP
,
NumericTypes
);
INSTANTIATE_TYPED_TEST_
SUIT
E_P
(
My
,
DISABLED_TypedTestP
,
NumericTypes
);
#endif // GTEST_HAS_TYPED_TEST_P
...
...
@@ -3487,7 +3488,7 @@ std::vector<std::string> CharsToLines(const std::string& str) {
return
out
;
}
TEST
(
EditDistance
,
Test
Cas
es
)
{
TEST
(
EditDistance
,
Test
Suit
es
)
{
struct
Case
{
int
line
;
const
char
*
left
;
...
...
@@ -5310,11 +5311,11 @@ namespace testing {
class
TestInfoTest
:
public
Test
{
protected:
static
const
TestInfo
*
GetTestInfo
(
const
char
*
test_name
)
{
const
Test
Cas
e
*
const
test_
cas
e
=
GetUnitTestImpl
()
->
GetTest
Cas
e
(
"TestInfoTest"
,
""
,
nullptr
,
nullptr
);
const
Test
Suit
e
*
const
test_
suit
e
=
GetUnitTestImpl
()
->
GetTest
Suit
e
(
"TestInfoTest"
,
""
,
nullptr
,
nullptr
);
for
(
int
i
=
0
;
i
<
test_
cas
e
->
total_test_count
();
++
i
)
{
const
TestInfo
*
const
test_info
=
test_
cas
e
->
GetTestInfo
(
i
);
for
(
int
i
=
0
;
i
<
test_
suit
e
->
total_test_count
();
++
i
)
{
const
TestInfo
*
const
test_info
=
test_
suit
e
->
GetTestInfo
(
i
);
if
(
strcmp
(
test_name
,
test_info
->
name
())
==
0
)
return
test_info
;
}
...
...
@@ -5371,13 +5372,13 @@ TEST_P(CodeLocationForTESTP, Verify) {
VERIFY_CODE_LOCATION
;
}
INSTANTIATE_TEST_
CAS
E_P
(,
CodeLocationForTESTP
,
Values
(
0
));
INSTANTIATE_TEST_
SUIT
E_P
(,
CodeLocationForTESTP
,
Values
(
0
));
template
<
typename
T
>
class
CodeLocationForTYPEDTEST
:
public
Test
{
};
TYPED_TEST_
CAS
E
(
CodeLocationForTYPEDTEST
,
int
);
TYPED_TEST_
SUIT
E
(
CodeLocationForTYPEDTEST
,
int
);
TYPED_TEST
(
CodeLocationForTYPEDTEST
,
Verify
)
{
VERIFY_CODE_LOCATION
;
...
...
@@ -5387,20 +5388,21 @@ template <typename T>
class
CodeLocationForTYPEDTESTP
:
public
Test
{
};
TYPED_TEST_
CAS
E_P
(
CodeLocationForTYPEDTESTP
);
TYPED_TEST_
SUIT
E_P
(
CodeLocationForTYPEDTESTP
);
TYPED_TEST_P
(
CodeLocationForTYPEDTESTP
,
Verify
)
{
VERIFY_CODE_LOCATION
;
}
REGISTER_TYPED_TEST_
CAS
E_P
(
CodeLocationForTYPEDTESTP
,
Verify
);
REGISTER_TYPED_TEST_
SUIT
E_P
(
CodeLocationForTYPEDTESTP
,
Verify
);
INSTANTIATE_TYPED_TEST_
CAS
E_P
(
My
,
CodeLocationForTYPEDTESTP
,
int
);
INSTANTIATE_TYPED_TEST_
SUIT
E_P
(
My
,
CodeLocationForTYPEDTESTP
,
int
);
#undef VERIFY_CODE_LOCATION
// Tests setting up and tearing down a test case.
// Legacy API is deprecated but still available
#ifndef REMOVE_LEGACY_TEST_CASEAPI
class
SetUpTestCaseTest
:
public
Test
{
protected:
// This will be called once before the first test in this test case
...
...
@@ -5459,8 +5461,9 @@ TEST_F(SetUpTestCaseTest, Test1) { EXPECT_STRNE(nullptr, shared_resource_); }
TEST_F
(
SetUpTestCaseTest
,
Test2
)
{
EXPECT_STREQ
(
"123"
,
shared_resource_
);
}
#endif // REMOVE_LEGACY_TEST_CASEAPI
// Tests SetupTestSuite/TearDown TestSuite
API
// Tests SetupTestSuite/TearDown TestSuite
class
SetUpTestSuiteTest
:
public
Test
{
protected:
// This will be called once before the first test in this test case
...
...
@@ -6278,7 +6281,7 @@ class CurrentTestInfoTest : public Test {
protected:
// Tests that current_test_info() returns NULL before the first test in
// the test case is run.
static
void
SetUpTest
Cas
e
()
{
static
void
SetUpTest
Suit
e
()
{
// There should be no tests running at this point.
const
TestInfo
*
test_info
=
UnitTest
::
GetInstance
()
->
current_test_info
();
...
...
@@ -6288,7 +6291,7 @@ class CurrentTestInfoTest : public Test {
// Tests that current_test_info() returns NULL after the last test in
// the test case has run.
static
void
TearDownTest
Cas
e
()
{
static
void
TearDownTest
Suit
e
()
{
const
TestInfo
*
test_info
=
UnitTest
::
GetInstance
()
->
current_test_info
();
EXPECT_TRUE
(
test_info
==
nullptr
)
...
...
@@ -6298,14 +6301,14 @@ class CurrentTestInfoTest : public Test {
// Tests that current_test_info() returns TestInfo for currently running
// test by checking the expected test name against the actual one.
TEST_F
(
CurrentTestInfoTest
,
WorksForFirstTestInATest
Cas
e
)
{
TEST_F
(
CurrentTestInfoTest
,
WorksForFirstTestInATest
Suit
e
)
{
const
TestInfo
*
test_info
=
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_case_name
())
<<
"Expected the name of the currently running test case."
;
EXPECT_STREQ
(
"WorksForFirstTestInATest
Cas
e"
,
test_info
->
name
())
EXPECT_STREQ
(
"WorksForFirstTestInATest
Suit
e"
,
test_info
->
name
())
<<
"Expected the name of the currently running test."
;
}
...
...
@@ -6313,14 +6316,14 @@ TEST_F(CurrentTestInfoTest, WorksForFirstTestInATestCase) {
// test by checking the expected test name against the actual one. We
// use this test to see that the TestInfo object actually changed from
// the previous invocation.
TEST_F
(
CurrentTestInfoTest
,
WorksForSecondTestInATest
Cas
e
)
{
TEST_F
(
CurrentTestInfoTest
,
WorksForSecondTestInATest
Suit
e
)
{
const
TestInfo
*
test_info
=
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_case_name
())
<<
"Expected the name of the currently running test case."
;
EXPECT_STREQ
(
"WorksForSecondTestInATest
Cas
e"
,
test_info
->
name
())
EXPECT_STREQ
(
"WorksForSecondTestInATest
Suit
e"
,
test_info
->
name
())
<<
"Expected the name of the currently running test."
;
}
...
...
@@ -7549,14 +7552,14 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
class
AdHocTestResultTest
:
public
testing
::
Test
{
protected:
static
void
SetUpTest
Cas
e
()
{
FAIL
()
<<
"A failure happened inside SetUpTest
Cas
e()."
;
static
void
SetUpTest
Suit
e
()
{
FAIL
()
<<
"A failure happened inside SetUpTest
Suit
e()."
;
}
};
TEST_F
(
AdHocTestResultTest
,
AdHocTestResultForTest
Cas
eShowsFailure
)
{
TEST_F
(
AdHocTestResultTest
,
AdHocTestResultForTest
Suit
eShowsFailure
)
{
const
testing
::
TestResult
&
test_result
=
testing
::
UnitTest
::
GetInstance
()
->
current_test_
cas
e
()
->
current_test_
suit
e
()
->
ad_hoc_test_result
();
EXPECT_TRUE
(
test_result
.
Failed
());
}
...
...
@@ -7579,8 +7582,8 @@ auto* dynamic_test = testing::RegisterTest(
TEST
(
RegisterTest
,
WasRegistered
)
{
auto
*
unittest
=
testing
::
UnitTest
::
GetInstance
();
for
(
int
i
=
0
;
i
<
unittest
->
total_test_
cas
e_count
();
++
i
)
{
auto
*
tests
=
unittest
->
GetTest
Cas
e
(
i
);
for
(
int
i
=
0
;
i
<
unittest
->
total_test_
suit
e_count
();
++
i
)
{
auto
*
tests
=
unittest
->
GetTest
Suit
e
(
i
);
if
(
tests
->
name
()
!=
std
::
string
(
"DynamicUnitTestFixture"
))
continue
;
for
(
int
j
=
0
;
j
<
tests
->
total_test_count
();
++
j
)
{
if
(
tests
->
GetTestInfo
(
j
)
->
name
()
!=
std
::
string
(
"DynamicTest"
))
continue
;
...
...
googletest/test/gtest_xml_output_unittest.py
View file @
0599a7b8
...
...
@@ -111,7 +111,7 @@ Invalid characters in brackets []%(stack)s]]></failure>
<testsuite name="SkippedTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Skipped" status="skipped" time="*" classname="SkippedTest"/>
</testsuite>
<testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTest
Cas
e="yes" TearDownTest
Cas
e="aye">
<testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTest
Suit
e="yes" TearDownTest
Suit
e="aye">
<testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest">
<properties>
<property name="key_1" value="1"/>
...
...
@@ -164,11 +164,11 @@ Invalid characters in brackets []%(stack)s]]></failure>
<testsuite name="TypedTest/1" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="TypedTest/1" />
</testsuite>
<testsuite name="Single/TypeParameterizedTest
Cas
e/0" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTest
Cas
e/0" />
<testsuite name="Single/TypeParameterizedTest
Suit
e/0" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTest
Suit
e/0" />
</testsuite>
<testsuite name="Single/TypeParameterizedTest
Cas
e/1" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTest
Cas
e/1" />
<testsuite name="Single/TypeParameterizedTest
Suit
e/1" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTest
Suit
e/1" />
</testsuite>
</testsuites>"""
%
{
'stack'
:
STACK_TRACE_TEMPLATE
}
...
...
@@ -186,7 +186,7 @@ EXPECTED_SHARDED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/>
</testsuite>
<testsuite name="PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTest
Cas
e="yes" TearDownTest
Cas
e="aye">
<testsuite name="PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTest
Suit
e="yes" TearDownTest
Suit
e="aye">
<testcase name="TwoValuesForOneKeyUsesLastValue" status="run" time="*" classname="PropertyRecordingTest">
<properties>
<property name="key_1" value="2"/>
...
...
googletest/test/gtest_xml_output_unittest_.cc
View file @
0599a7b8
...
...
@@ -101,8 +101,10 @@ TEST(InvalidCharactersTest, InvalidCharactersInMessage) {
class
PropertyRecordingTest
:
public
Test
{
public:
static
void
SetUpTestCase
()
{
RecordProperty
(
"SetUpTestCase"
,
"yes"
);
}
static
void
TearDownTestCase
()
{
RecordProperty
(
"TearDownTestCase"
,
"aye"
);
}
static
void
SetUpTestSuite
()
{
RecordProperty
(
"SetUpTestSuite"
,
"yes"
);
}
static
void
TearDownTestSuite
()
{
RecordProperty
(
"TearDownTestSuite"
,
"aye"
);
}
};
TEST_F
(
PropertyRecordingTest
,
OneProperty
)
{
...
...
@@ -150,28 +152,28 @@ TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) {
class
ValueParamTest
:
public
TestWithParam
<
int
>
{};
TEST_P
(
ValueParamTest
,
HasValueParamAttribute
)
{}
TEST_P
(
ValueParamTest
,
AnotherTestThatHasValueParamAttribute
)
{}
INSTANTIATE_TEST_
CAS
E_P
(
Single
,
ValueParamTest
,
Values
(
33
,
42
));
INSTANTIATE_TEST_
SUIT
E_P
(
Single
,
ValueParamTest
,
Values
(
33
,
42
));
#if GTEST_HAS_TYPED_TEST
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for typed tests.
template
<
typename
T
>
class
TypedTest
:
public
Test
{};
typedef
testing
::
Types
<
int
,
long
>
TypedTestTypes
;
TYPED_TEST_
CAS
E
(
TypedTest
,
TypedTestTypes
);
TYPED_TEST_
SUIT
E
(
TypedTest
,
TypedTestTypes
);
TYPED_TEST
(
TypedTest
,
HasTypeParamAttribute
)
{}
#endif
#if GTEST_HAS_TYPED_TEST_P
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for type-parameterized tests.
template
<
typename
T
>
class
TypeParameterizedTestCase
:
public
Test
{};
TYPED_TEST_CASE_P
(
TypeParameterizedTest
Case
)
;
TYPED_TEST_P
(
TypeParameterizedTest
Case
,
HasTypeParamAttribute
)
{}
REGISTER_
TYPED_TEST_
CASE_
P
(
TypeParameterizedTest
Cas
e
,
HasTypeParamAttribute
)
;
typedef
testing
::
Types
<
int
,
long
>
TypeParameterizedTest
C
as
e
Type
s
;
INSTANTIATE_TYPED_TEST_CASE_P
(
Single
,
TypeParameterizedTest
Cas
e
,
TypeParameterizedTest
Cas
eTypes
);
template
<
typename
T
>
class
TypeParameterizedTest
Suite
:
public
Test
{}
;
TYPED_TEST_
SUITE_
P
(
TypeParameterizedTest
Suite
);
TYPED_TEST_P
(
TypeParameterizedTest
Suit
e
,
HasTypeParamAttribute
)
{}
REGISTER_TYPED_TEST_SUITE_P
(
TypeParameterizedTest
Suite
,
H
asType
ParamAttribute
)
;
typedef
testing
::
Types
<
int
,
long
>
TypeParameterizedTestSuiteTypes
;
// NOLINT
INSTANTIATE_TYPED_TEST_SUITE_P
(
Single
,
TypeParameterizedTest
Suit
e
,
TypeParameterizedTest
Suit
eTypes
);
#endif
int
main
(
int
argc
,
char
**
argv
)
{
...
...
Prev
1
2
Next
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