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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 37 of file gtest_no_test_unittest.cc.

References EXPECT_EQ, testing::InitGoogleTest(), and RUN_ALL_TESTS().

37  {
39 
40  // An ad-hoc assertion outside of all tests.
41  //
42  // This serves three purposes:
43  //
44  // 1. It verifies that an ad-hoc assertion can be executed even if
45  // no test is defined.
46  // 2. It verifies that a failed ad-hoc assertion causes the test
47  // program to fail.
48  // 3. We had a bug where the XML output won't be generated if an
49  // assertion is executed before RUN_ALL_TESTS() is called, even
50  // though --gtest_output=xml is specified. This makes sure the
51  // bug is fixed and doesn't regress.
52  EXPECT_EQ(1, 2);
53 
54  // The above EXPECT_EQ() should cause RUN_ALL_TESTS() to return non-zero.
55  return RUN_ALL_TESTS() ? 0 : 1;
56 }
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: gtest.h:2232
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char ** argv
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: gtest.cc:5370