summaryrefslogtreecommitdiff
path: root/test/gtest_output_test_.cc
diff options
context:
space:
mode:
authorkosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2015-07-24 19:46:18 +0000
committerkosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925>2015-07-24 19:46:18 +0000
commit702663c6254347231c9a425e5fb1fe67ad0ffe58 (patch)
tree4034db2b543b36945b46702b0158168ef367d622 /test/gtest_output_test_.cc
parentb7be629c0b272ff2b12d560ac3c92bcd9845106d (diff)
downloadgoogletest-702663c6254347231c9a425e5fb1fe67ad0ffe58.tar.gz
Add support for named value-parameterized tests.
git-svn-id: http://googletest.googlecode.com/svn/trunk@735 861a406c-534a-0410-8894-cb66d6ee9925
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 a619459..1070a9f 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