Implements printing parameters of failed parameterized tests (issue 71).

This commit is contained in:
vladlosev
2010-05-18 21:13:48 +00:00
parent c828e17175
commit 1097b54dcf
7 changed files with 104 additions and 38 deletions

View File

@@ -44,6 +44,7 @@
#include <gtest/internal/gtest-internal.h>
#include <gtest/internal/gtest-linked_ptr.h>
#include <gtest/internal/gtest-port.h>
#include <gtest/gtest-printers.h>
#if GTEST_HAS_PARAM_TEST
@@ -171,7 +172,7 @@ class ParamGenerator {
iterator end() const { return iterator(impl_->End()); }
private:
::testing::internal::linked_ptr<const ParamGeneratorInterface<T> > impl_;
linked_ptr<const ParamGeneratorInterface<T> > impl_;
};
// Generates values from a range of two comparable values. Can be used to
@@ -285,7 +286,7 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
public:
Iterator(const ParamGeneratorInterface<T>* base,
typename ContainerType::const_iterator iterator)
: base_(base), iterator_(iterator) {}
: base_(base), iterator_(iterator) {}
virtual ~Iterator() {}
virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
@@ -504,12 +505,12 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
param_it != generator.end(); ++param_it, ++i) {
Message test_name_stream;
test_name_stream << test_info->test_base_name.c_str() << "/" << i;
::testing::internal::MakeAndRegisterTestInfo(
std::string comment = "GetParam() = " + PrintToString(*param_it);
MakeAndRegisterTestInfo(
test_case_name_stream.GetString().c_str(),
test_name_stream.GetString().c_str(),
"", // test_case_comment
"", // comment; TODO(vladl@google.com): provide parameter value
// representation.
comment.c_str(),
GetTestCaseTypeId(),
TestCase::SetUpTestCase,
TestCase::TearDownTestCase,