proxygen
gtest_xml_output_unittest_.cc File Reference
#include "gtest/gtest.h"

Go to the source code of this file.

Classes

class  SuccessfulTest
 
class  FailedTest
 
class  DisabledTest
 
class  PropertyRecordingTest
 
class  ValueParamTest
 

Functions

 TEST_F (SuccessfulTest, Succeeds)
 
 TEST_F (FailedTest, Fails)
 
 TEST_F (DisabledTest, DISABLED_test_not_run)
 
 TEST (MixedResultTest, Succeeds)
 
 TEST (MixedResultTest, Fails)
 
 TEST (MixedResultTest, DISABLED_test)
 
 TEST (XmlQuotingTest, OutputsCData)
 
 TEST (InvalidCharactersTest, InvalidCharactersInMessage)
 
 TEST_F (PropertyRecordingTest, OneProperty)
 
 TEST_F (PropertyRecordingTest, IntValuedProperty)
 
 TEST_F (PropertyRecordingTest, ThreeProperties)
 
 TEST_F (PropertyRecordingTest, TwoValuesForOneKeyUsesLastValue)
 
 TEST (NoFixtureTest, RecordProperty)
 
void ExternalUtilityThatCallsRecordProperty (const std::string &key, int value)
 
void ExternalUtilityThatCallsRecordProperty (const std::string &key, const std::string &value)
 
 TEST (NoFixtureTest, ExternalUtilityThatCallsRecordIntValuedProperty)
 
 TEST (NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty)
 
 TEST_P (ValueParamTest, HasValueParamAttribute)
 
 TEST_P (ValueParamTest, AnotherTestThatHasValueParamAttribute)
 
 INSTANTIATE_TEST_CASE_P (Single, ValueParamTest, Values(33, 42))
 
int main (int argc, char **argv)
 

Function Documentation

void ExternalUtilityThatCallsRecordProperty ( const std::string key,
int  value 
)

Definition at line 126 of file gtest_xml_output_unittest_.cc.

References testing::Test::RecordProperty().

126  {
128 }
static const char *const value
Definition: Conv.cpp:50
static void RecordProperty(const std::string &key, const std::string &value)
Definition: gtest.cc:2237
void ExternalUtilityThatCallsRecordProperty ( const std::string key,
const std::string value 
)

Definition at line 130 of file gtest_xml_output_unittest_.cc.

References testing::Test::RecordProperty().

131  {
133 }
static const char *const value
Definition: Conv.cpp:50
static void RecordProperty(const std::string &key, const std::string &value)
Definition: gtest.cc:2237
INSTANTIATE_TEST_CASE_P ( Single  ,
ValueParamTest  ,
Values(33, 42)   
)
int main ( int  argc,
char **  argv 
)

Definition at line 172 of file gtest_xml_output_unittest_.cc.

References testing::InitGoogleTest(), testing::Test::RecordProperty(), and RUN_ALL_TESTS().

172  {
173  InitGoogleTest(&argc, argv);
174 
175  if (argc > 1 && strcmp(argv[1], "--shut_down_xml") == 0) {
176  TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
177  delete listeners.Release(listeners.default_xml_generator());
178  }
179  testing::Test::RecordProperty("ad_hoc_property", "42");
180  return RUN_ALL_TESTS();
181 }
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: gtest.h:2232
char ** argv
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: gtest.cc:5370
static void RecordProperty(const std::string &key, const std::string &value)
Definition: gtest.cc:2237
TEST ( MixedResultTest  ,
Succeeds   
)

Definition at line 72 of file gtest_xml_output_unittest_.cc.

References ASSERT_EQ, and EXPECT_EQ.

72  {
73  EXPECT_EQ(1, 1);
74  ASSERT_EQ(1, 1);
75 }
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
TEST ( MixedResultTest  ,
Fails   
)

Definition at line 77 of file gtest_xml_output_unittest_.cc.

References ASSERT_EQ, and EXPECT_EQ.

77  {
78  EXPECT_EQ(1, 2);
79  ASSERT_EQ(2, 3);
80 }
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
TEST ( MixedResultTest  ,
DISABLED_test   
)

Definition at line 82 of file gtest_xml_output_unittest_.cc.

References FAIL.

82  {
83  FAIL() << "Unexpected failure: Disabled test should not be run";
84 }
#define FAIL()
Definition: gtest.h:1822
TEST ( XmlQuotingTest  ,
OutputsCData   
)

Definition at line 86 of file gtest_xml_output_unittest_.cc.

References FAIL.

86  {
87  FAIL() << "XML output: "
88  "<?xml encoding=\"utf-8\"><top><![CDATA[cdata text]]></top>";
89 }
#define FAIL()
Definition: gtest.h:1822
TEST ( InvalidCharactersTest  ,
InvalidCharactersInMessage   
)

Definition at line 93 of file gtest_xml_output_unittest_.cc.

References FAIL.

93  {
94  FAIL() << "Invalid characters in brackets [\x1\x2]";
95 }
#define FAIL()
Definition: gtest.h:1822
TEST ( NoFixtureTest  ,
RecordProperty   
)

Definition at line 122 of file gtest_xml_output_unittest_.cc.

122  {
123  RecordProperty("key", "1");
124 }
TEST ( NoFixtureTest  ,
ExternalUtilityThatCallsRecordIntValuedProperty   
)

Definition at line 135 of file gtest_xml_output_unittest_.cc.

References ExternalUtilityThatCallsRecordProperty().

135  {
136  ExternalUtilityThatCallsRecordProperty("key_for_utility_int", 1);
137 }
void ExternalUtilityThatCallsRecordProperty(const std::string &key, int value)
TEST ( NoFixtureTest  ,
ExternalUtilityThatCallsRecordStringValuedProperty   
)

Definition at line 139 of file gtest_xml_output_unittest_.cc.

References ExternalUtilityThatCallsRecordProperty().

139  {
140  ExternalUtilityThatCallsRecordProperty("key_for_utility_string", "1");
141 }
void ExternalUtilityThatCallsRecordProperty(const std::string &key, int value)
TEST_F ( SuccessfulTest  ,
Succeeds   
)

Definition at line 53 of file gtest_xml_output_unittest_.cc.

References ASSERT_EQ, and SUCCEED.

53  {
54  SUCCEED() << "This is a success.";
55  ASSERT_EQ(1, 1);
56 }
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956
#define SUCCEED()
Definition: gtest.h:1831
TEST_F ( FailedTest  ,
Fails   
)

Definition at line 61 of file gtest_xml_output_unittest_.cc.

References ASSERT_EQ.

61  {
62  ASSERT_EQ(1, 2);
63 }
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956
TEST_F ( DisabledTest  ,
DISABLED_test_not_run   
)

Definition at line 68 of file gtest_xml_output_unittest_.cc.

References FAIL.

68  {
69  FAIL() << "Unexpected failure: Disabled test should not be run";
70 }
#define FAIL()
Definition: gtest.h:1822
TEST_F ( PropertyRecordingTest  ,
OneProperty   
)

Definition at line 103 of file gtest_xml_output_unittest_.cc.

103  {
104  RecordProperty("key_1", "1");
105 }
TEST_F ( PropertyRecordingTest  ,
IntValuedProperty   
)

Definition at line 107 of file gtest_xml_output_unittest_.cc.

107  {
108  RecordProperty("key_int", 1);
109 }
TEST_F ( PropertyRecordingTest  ,
ThreeProperties   
)

Definition at line 111 of file gtest_xml_output_unittest_.cc.

111  {
112  RecordProperty("key_1", "1");
113  RecordProperty("key_2", "2");
114  RecordProperty("key_3", "3");
115 }
TEST_F ( PropertyRecordingTest  ,
TwoValuesForOneKeyUsesLastValue   
)

Definition at line 117 of file gtest_xml_output_unittest_.cc.

117  {
118  RecordProperty("key_1", "1");
119  RecordProperty("key_1", "2");
120 }
TEST_P ( ValueParamTest  ,
HasValueParamAttribute   
)

Definition at line 146 of file gtest_xml_output_unittest_.cc.

146 {}