From 1097b54dcf1cd393e64ec0adf54301a575bbbc1c Mon Sep 17 00:00:00 2001 From: vladlosev Date: Tue, 18 May 2010 21:13:48 +0000 Subject: Implements printing parameters of failed parameterized tests (issue 71). --- test/gtest_output_test_.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/gtest_output_test_.cc') diff --git a/test/gtest_output_test_.cc b/test/gtest_output_test_.cc index 32fb49a9..1ac439c6 100644 --- a/test/gtest_output_test_.cc +++ b/test/gtest_output_test_.cc @@ -87,6 +87,20 @@ TEST(PassingTest, PassingTest1) { TEST(PassingTest, PassingTest2) { } +// Tests that parameters of failing parameterized tests are printed in the +// failing test summary. +class FailingParamTest : public testing::TestWithParam {}; + +TEST_P(FailingParamTest, Fails) { + EXPECT_EQ(1, GetParam()); +} + +// This generates a test which will fail. Google Test is expected to print +// its parameter when it outputs the list of all failed tests. +INSTANTIATE_TEST_CASE_P(PrintingFailingParams, + FailingParamTest, + testing::Values(2)); + // Tests catching a fatal failure in a subroutine. TEST(FatalFailureTest, FatalFailureInSubroutine) { printf("(expecting a failure that x should be 1)\n"); -- cgit v1.2.3