aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest_output_test_.cc
diff options
context:
space:
mode:
authorkosak <kosak@google.com>2015-07-24 19:46:18 +0000
committerkosak <kosak@google.com>2015-07-24 19:46:18 +0000
commit794ef030ebad671b699abdfd8e0474f93045be91 (patch)
tree4034db2b543b36945b46702b0158168ef367d622 /test/gtest_output_test_.cc
parent41b5b28d4858530a94078a5204c9d393f520159d (diff)
downloadgoogletest-794ef030ebad671b699abdfd8e0474f93045be91.tar.gz
googletest-794ef030ebad671b699abdfd8e0474f93045be91.tar.bz2
googletest-794ef030ebad671b699abdfd8e0474f93045be91.zip
Add support for named value-parameterized tests.
Diffstat (limited to 'test/gtest_output_test_.cc')
-rw-r--r--test/gtest_output_test_.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/gtest_output_test_.cc b/test/gtest_output_test_.cc
index a619459c..1070a9f2 100644
--- a/test/gtest_output_test_.cc
+++ b/test/gtest_output_test_.cc
@@ -755,6 +755,32 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
#endif // GTEST_HAS_EXCEPTIONS
+// This #ifdef block tests the output of value-parameterized tests.
+
+#if GTEST_HAS_PARAM_TEST
+
+std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) {
+ return info.param;
+}
+
+class ParamTest : public testing::TestWithParam<std::string> {
+};
+
+TEST_P(ParamTest, Success) {
+ EXPECT_EQ("a", GetParam());
+}
+
+TEST_P(ParamTest, Failure) {
+ EXPECT_EQ("b", GetParam()) << "Expected failure";
+}
+
+INSTANTIATE_TEST_CASE_P(PrintingStrings,
+ ParamTest,
+ testing::Values(std::string("a")),
+ ParamNameFunc);
+
+#endif // GTEST_HAS_PARAM_TEST
+
// This #ifdef block tests the output of typed tests.
#if GTEST_HAS_TYPED_TEST