summaryrefslogtreecommitdiffstats
path: root/test/gtest-param-test_test.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2013-03-12 21:17:22 (GMT)
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2013-03-12 21:17:22 (GMT)
commit1edbcbad73e0c711d5aa0f165bad5e9518894375 (patch)
treee4390e8a41ccad9936210f3a2cf8105214318340 /test/gtest-param-test_test.cc
parent6b7a167dca7a9007d14fc95a07f4f6e07fec3162 (diff)
downloadgoogletest-1edbcbad73e0c711d5aa0f165bad5e9518894375.zip
googletest-1edbcbad73e0c711d5aa0f165bad5e9518894375.tar.gz
googletest-1edbcbad73e0c711d5aa0f165bad5e9518894375.tar.bz2
Prints a useful message when GetParam() is called in a non-parameterized test.
Diffstat (limited to 'test/gtest-param-test_test.cc')
-rw-r--r--test/gtest-param-test_test.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/gtest-param-test_test.cc b/test/gtest-param-test_test.cc
index 7b6f7e2..f60cb8a 100644
--- a/test/gtest-param-test_test.cc
+++ b/test/gtest-param-test_test.cc
@@ -865,6 +865,13 @@ TEST_P(ParameterizedDerivedTest, SeesSequence) {
EXPECT_EQ(GetParam(), global_count_++);
}
+class ParameterizedDeathTest : public ::testing::TestWithParam<int> { };
+
+TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
+ EXPECT_DEATH_IF_SUPPORTED(GetParam(),
+ ".* value-parameterized test .*");
+}
+
INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
#endif // GTEST_HAS_PARAM_TEST