diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-02-02 00:49:33 (GMT) |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-02-02 00:49:33 (GMT) |
commit | 9bcf4d0a654b27732e2fa901fe98c09aba71773a (patch) | |
tree | d2072cc7bdd2f9df2f35f85258d8c0e10e80691a /test/gtest_xml_output_unittest_.cc | |
parent | c8efea670544c86a169f920c567a9dae86227e95 (diff) | |
download | googletest-9bcf4d0a654b27732e2fa901fe98c09aba71773a.zip googletest-9bcf4d0a654b27732e2fa901fe98c09aba71773a.tar.gz googletest-9bcf4d0a654b27732e2fa901fe98c09aba71773a.tar.bz2 |
Adds type_param and value_param as <testcase> attributes to the XML
report; also removes the comment() and test_case_comment() fields of
TestInfo. Proposed and initally implemented by Joey Oravec.
Re-implemented by Vlad Losev.
Diffstat (limited to 'test/gtest_xml_output_unittest_.cc')
-rw-r--r-- | test/gtest_xml_output_unittest_.cc | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/test/gtest_xml_output_unittest_.cc b/test/gtest_xml_output_unittest_.cc index 693ffb9..741a887 100644 --- a/test/gtest_xml_output_unittest_.cc +++ b/test/gtest_xml_output_unittest_.cc @@ -42,9 +42,13 @@ using ::testing::InitGoogleTest; using ::testing::TestEventListeners; +using ::testing::TestWithParam; using ::testing::UnitTest; +using ::testing::Test; +using ::testing::Types; +using ::testing::Values; -class SuccessfulTest : public testing::Test { +class SuccessfulTest : public Test { }; TEST_F(SuccessfulTest, Succeeds) { @@ -52,14 +56,14 @@ TEST_F(SuccessfulTest, Succeeds) { ASSERT_EQ(1, 1); } -class FailedTest : public testing::Test { +class FailedTest : public Test { }; TEST_F(FailedTest, Fails) { ASSERT_EQ(1, 2); } -class DisabledTest : public testing::Test { +class DisabledTest : public Test { }; TEST_F(DisabledTest, DISABLED_test_not_run) { @@ -91,7 +95,7 @@ TEST(InvalidCharactersTest, InvalidCharactersInMessage) { FAIL() << "Invalid characters in brackets [\x1\x2]"; } -class PropertyRecordingTest : public testing::Test { +class PropertyRecordingTest : public Test { }; TEST_F(PropertyRecordingTest, OneProperty) { @@ -134,6 +138,31 @@ TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) { ExternalUtilityThatCallsRecordProperty("key_for_utility_string", "1"); } +// Verifies that the test parameter value is output in the 'value_param' +// XML attribute for value-parameterized tests. +class ValueParamTest : public TestWithParam<int> {}; +TEST_P(ValueParamTest, HasValueParamAttribute) {} +TEST_P(ValueParamTest, AnotherTestThatHasValueParamAttribute) {} +INSTANTIATE_TEST_CASE_P(Single, ValueParamTest, Values(33, 42)); + +// 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 Types<int, long> TypedTestTypes; +TYPED_TEST_CASE(TypedTest, TypedTestTypes); +TYPED_TEST(TypedTest, HasTypeParamAttribute) {} + +// 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(TypeParameterizedTestCase); +TYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {} +REGISTER_TYPED_TEST_CASE_P(TypeParameterizedTestCase, HasTypeParamAttribute); +typedef Types<int, long> TypeParameterizedTestCaseTypes; +INSTANTIATE_TYPED_TEST_CASE_P(Single, + TypeParameterizedTestCase, + TypeParameterizedTestCaseTypes); + int main(int argc, char** argv) { InitGoogleTest(&argc, argv); |