diff options
Diffstat (limited to 'gtest/test/gtest_xml_output_unittest_.cc')
-rw-r--r-- | gtest/test/gtest_xml_output_unittest_.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gtest/test/gtest_xml_output_unittest_.cc b/gtest/test/gtest_xml_output_unittest_.cc index d7ce2c6..fc07ef4 100644 --- a/gtest/test/gtest_xml_output_unittest_.cc +++ b/gtest/test/gtest_xml_output_unittest_.cc @@ -40,6 +40,10 @@ #include <gtest/gtest.h> +using ::testing::InitGoogleTest; +using ::testing::TestEventListeners; +using ::testing::UnitTest; + class SuccessfulTest : public testing::Test { }; @@ -76,6 +80,17 @@ TEST(MixedResultTest, DISABLED_test) { FAIL() << "Unexpected failure: Disabled test should not be run"; } +TEST(XmlQuotingTest, OutputsCData) { + FAIL() << "XML output: " + "<?xml encoding=\"utf-8\"><top><![CDATA[cdata text]]></top>"; +} + +// Helps to test that invalid characters produced by test code do not make +// it into the XML file. +TEST(InvalidCharactersTest, InvalidCharactersInMessage) { + FAIL() << "Invalid characters in brackets [\x1\x2]"; +} + class PropertyRecordingTest : public testing::Test { }; @@ -118,3 +133,13 @@ TEST(NoFixtureTest, ExternalUtilityThatCallsRecordIntValuedProperty) { TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) { ExternalUtilityThatCallsRecordProperty("key_for_utility_string", "1"); } + +int main(int argc, char** argv) { + InitGoogleTest(&argc, argv); + + if (argc > 1 && strcmp(argv[1], "--shut_down_xml") == 0) { + TestEventListeners& listeners = UnitTest::GetInstance()->listeners(); + delete listeners.Release(listeners.default_xml_generator()); + } + return RUN_ALL_TESTS(); +} |