Add support for --gtest_flagfile.

This commit is contained in:
kosak
2015-07-17 22:11:58 +00:00
parent 195610d30c
commit 4f8dc917eb
9 changed files with 182 additions and 53 deletions

View File

@@ -94,7 +94,8 @@ class StreamingListenerTest : public Test {
StreamingListenerTest()
: fake_sock_writer_(new FakeSocketWriter),
streamer_(fake_sock_writer_),
test_info_obj_("FooTest", "Bar", NULL, NULL, 0, NULL) {}
test_info_obj_("FooTest", "Bar", NULL, NULL,
CodeLocation(__FILE__, __LINE__), 0, NULL) {}
protected:
string* output() { return &(fake_sock_writer_->output_); }
@@ -5328,6 +5329,59 @@ TEST_F(TestInfoTest, result) {
ASSERT_EQ(0, GetTestResult(test_info)->total_part_count());
}
#define VERIFY_CODE_LOCATION \
const int expected_line = __LINE__ - 1; \
const TestInfo* const test_info = GetUnitTestImpl()->current_test_info(); \
ASSERT_TRUE(test_info); \
EXPECT_STREQ(__FILE__, test_info->file()); \
EXPECT_EQ(expected_line, test_info->line())
TEST(CodeLocationForTEST, Verify) {
VERIFY_CODE_LOCATION;
}
class CodeLocationForTESTF : public Test {
};
TEST_F(CodeLocationForTESTF, Verify) {
VERIFY_CODE_LOCATION;
}
class CodeLocationForTESTP : public TestWithParam<int> {
};
TEST_P(CodeLocationForTESTP, Verify) {
VERIFY_CODE_LOCATION;
}
INSTANTIATE_TEST_CASE_P(, CodeLocationForTESTP, Values(0));
template <typename T>
class CodeLocationForTYPEDTEST : public Test {
};
TYPED_TEST_CASE(CodeLocationForTYPEDTEST, int);
TYPED_TEST(CodeLocationForTYPEDTEST, Verify) {
VERIFY_CODE_LOCATION;
}
template <typename T>
class CodeLocationForTYPEDTESTP : public Test {
};
TYPED_TEST_CASE_P(CodeLocationForTYPEDTESTP);
TYPED_TEST_P(CodeLocationForTYPEDTESTP, Verify) {
VERIFY_CODE_LOCATION;
}
REGISTER_TYPED_TEST_CASE_P(CodeLocationForTYPEDTESTP, Verify);
INSTANTIATE_TYPED_TEST_CASE_P(My, CodeLocationForTYPEDTESTP, int);
#undef VERIFY_CODE_LOCATION
// Tests setting up and tearing down a test case.
class SetUpTestCaseTest : public Test {