Merge branch 'master' into fix-core-dump-shared

This commit is contained in:
Gennadiy Civil 2018-01-13 15:06:57 -05:00 committed by GitHub
commit f6887b5cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 180 additions and 154 deletions

View File

@ -12,27 +12,29 @@ matrix:
include: include:
- os: linux - os: linux
compiler: gcc compiler: gcc
sudo: true sudo : true
cache:
install: ./ci/install-linux.sh && ./ci/log-config.sh install: ./ci/install-linux.sh && ./ci/log-config.sh
script: ./ci/build-linux-bazel.sh script: ./ci/build-linux-bazel.sh
- os: linux - os: linux
compiler: clang compiler: clang
sudo: true sudo : true
cache:
install: ./ci/install-linux.sh && ./ci/log-config.sh install: ./ci/install-linux.sh && ./ci/log-config.sh
script: ./ci/build-linux-bazel.sh script: ./ci/build-linux-bazel.sh
- os: linux - os: linux
group: deprecated-2017Q4
compiler: gcc compiler: gcc
install: ./ci/install-linux.sh && ./ci/log-config.sh install: ./ci/install-linux.sh && ./ci/log-config.sh
script: ./ci/build-linux-autotools.sh script: ./ci/build-linux-autotools.sh
- os: linux - os: linux
group: deprecated-2017Q4
compiler: gcc compiler: gcc
env: BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11 env: BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11
- os: linux - os: linux
group: deprecated-2017Q4
compiler: clang compiler: clang
env: BUILD_TYPE=Debug VERBOSE=1 env: BUILD_TYPE=Debug VERBOSE=1
- os: linux - os: linux
group: deprecated-2017Q4
compiler: clang compiler: clang
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
- os: osx - os: osx

View File

@ -102,7 +102,7 @@ GTEST_API_ bool InDeathTestChild();
// On POSIX-compliant systems (*nix), we use the <regex.h> library, // On POSIX-compliant systems (*nix), we use the <regex.h> library,
// which uses the POSIX extended regex syntax. // which uses the POSIX extended regex syntax.
// //
// On other platforms (e.g. Windows), we only support a simple regex // On other platforms (e.g. Windows or Mac), we only support a simple regex
// syntax implemented as part of Google Test. This limited // syntax implemented as part of Google Test. This limited
// implementation should be enough most of the time when writing // implementation should be enough most of the time when writing
// death tests; though it lacks many features you can find in PCRE // death tests; though it lacks many features you can find in PCRE
@ -272,6 +272,54 @@ class GTEST_API_ KilledBySignal {
# endif // NDEBUG for EXPECT_DEBUG_DEATH # endif // NDEBUG for EXPECT_DEBUG_DEATH
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
// This macro is used for implementing macros such as
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
// death tests are not supported. Those macros must compile on such systems
// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
// systems that support death tests. This allows one to write such a macro
// on a system that does not support death tests and be sure that it will
// compile on a death-test supporting system. It is exposed publicly so that
// systems that have death-tests with stricter requirements than
// GTEST_HAS_DEATH_TEST can write their own equivalent of
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED.
//
// Parameters:
// statement - A statement that a macro such as EXPECT_DEATH would test
// for program termination. This macro has to make sure this
// statement is compiled but not executed, to ensure that
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
// parameter iff EXPECT_DEATH compiles with it.
// regex - A regex that a macro such as EXPECT_DEATH would use to test
// the output of statement. This parameter has to be
// compiled but not evaluated by this macro, to ensure that
// this macro only accepts expressions that a macro such as
// EXPECT_DEATH would accept.
// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
// compile inside functions where ASSERT_DEATH doesn't
// compile.
//
// The branch that has an always false condition is used to ensure that
// statement and regex are compiled (and thus syntactically correct) but
// never executed. The unreachable code macro protects the terminator
// statement from generating an 'unreachable code' warning in case
// statement unconditionally returns or throws. The Message constructor at
// the end allows the syntax of streaming additional messages into the
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
GTEST_LOG_(WARNING) \
<< "Death tests are not supported on this platform.\n" \
<< "Statement '" #statement "' cannot be verified."; \
} else if (::testing::internal::AlwaysFalse()) { \
::testing::internal::RE::PartialMatch(".*", (regex)); \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
terminator; \
} else \
::testing::Message()
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
// death tests are supported; otherwise they just issue a warning. This is // death tests are supported; otherwise they just issue a warning. This is
@ -284,9 +332,9 @@ class GTEST_API_ KilledBySignal {
ASSERT_DEATH(statement, regex) ASSERT_DEATH(statement, regex)
#else #else
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, ) GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return) GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
#endif #endif
} // namespace testing } // namespace testing

View File

@ -196,7 +196,6 @@ class GTEST_API_ Message {
std::string GetString() const; std::string GetString() const;
private: private:
#if GTEST_OS_SYMBIAN #if GTEST_OS_SYMBIAN
// These are needed as the Nokia Symbian Compiler cannot decide between // These are needed as the Nokia Symbian Compiler cannot decide between
// const T& and const T* in a function template. The Nokia compiler _can_ // const T& and const T* in a function template. The Nokia compiler _can_

View File

@ -38,6 +38,7 @@
// //
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
// //
#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
@ -79,7 +80,7 @@ TEST_P(FooTest, HasBlahBlah) {
// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test // Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
// case with any set of parameters you want. Google Test defines a number // case with any set of parameters you want. Google Test defines a number
// of functions for generating test parameters. They return what we call // of functions for generating test parameters. They return what we call
// (surprise!) parameter generators. Here is a summary of them, which // (surprise!) parameter generators. Here is a summary of them, which
// are all in the testing namespace: // are all in the testing namespace:
// //
// //
@ -268,7 +269,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
// each with C-string values of "foo", "bar", and "baz": // each with C-string values of "foo", "bar", and "baz":
// //
// const char* strings[] = {"foo", "bar", "baz"}; // const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings)); // INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
// //
// This instantiates tests from test case StlStringTest // This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b": // each with STL strings with values "a" and "b":
@ -1413,24 +1414,26 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
// alphanumeric characters or underscore. Because PrintToString adds quotes // alphanumeric characters or underscore. Because PrintToString adds quotes
// to std::string and C strings, it won't work for these types. // to std::string and C strings, it won't work for these types.
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ #define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \ static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ gtest_##prefix##test_case_name##_EvalGenerator_() { \
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ return generator; \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \ } \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \ static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
(__VA_ARGS__)(info); \ const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
} \ return ::testing::internal::GetParamNameGen<test_case_name::ParamType>( \
__VA_ARGS__)(info); \
} \
static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ ::testing::UnitTest::GetInstance() \
GetTestCasePatternHolder<test_case_name>(\ ->parameterized_test_registry() \
#test_case_name, \ .GetTestCasePatternHolder<test_case_name>( \
::testing::internal::CodeLocation(\ #test_case_name, \
__FILE__, __LINE__))->AddTestCaseInstantiation(\ ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
#prefix, \ ->AddTestCaseInstantiation( \
&gtest_##prefix##test_case_name##_EvalGenerator_, \ #prefix, &gtest_##prefix##test_case_name##_EvalGenerator_, \
&gtest_##prefix##test_case_name##_EvalGenerateName_, \ &gtest_##prefix##test_case_name##_EvalGenerateName_, __FILE__, \
__FILE__, __LINE__) __LINE__)
} // namespace testing } // namespace testing

View File

@ -78,7 +78,7 @@ TEST_P(FooTest, HasBlahBlah) {
// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test // Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
// case with any set of parameters you want. Google Test defines a number // case with any set of parameters you want. Google Test defines a number
// of functions for generating test parameters. They return what we call // of functions for generating test parameters. They return what we call
// (surprise!) parameter generators. Here is a summary of them, which // (surprise!) parameter generators. Here is a summary of them, which
// are all in the testing namespace: // are all in the testing namespace:
// //
// //
@ -267,7 +267,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
// each with C-string values of "foo", "bar", and "baz": // each with C-string values of "foo", "bar", and "baz":
// //
// const char* strings[] = {"foo", "bar", "baz"}; // const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings)); // INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
// //
// This instantiates tests from test case StlStringTest // This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b": // each with STL strings with values "a" and "b":

View File

@ -243,7 +243,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
} \ } \
static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \ static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \
GTEST_ATTRIBUTE_UNUSED_ = \ GTEST_ATTRIBUTE_UNUSED_ = \
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames( \
__FILE__, __LINE__, #__VA_ARGS__) __FILE__, __LINE__, #__VA_ARGS__)
// The 'Types' template argument below must have spaces around it // The 'Types' template argument below must have spaces around it

View File

@ -2110,9 +2110,14 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
// to appear in the same block - as long as they are on different // to appear in the same block - as long as they are on different
// lines. // lines.
//
// Assuming that each thread maintains its own stack of traces.
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
// assertions in its own thread.
#define SCOPED_TRACE(message) \ #define SCOPED_TRACE(message) \
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\ ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
__FILE__, __LINE__, ::testing::Message() << (message)) __FILE__, __LINE__, (message))
// Compile-time assertion for type equality. // Compile-time assertion for type equality.
// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are // StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are

View File

@ -61,6 +61,9 @@
// GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) // GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
// GTEST_LOCK_EXCLUDED_(locks) // GTEST_LOCK_EXCLUDED_(locks)
// //
// Underlying library support features:
// GTEST_HAS_CXXABI_H_
//
// Exporting API symbols: // Exporting API symbols:
// GTEST_API_ - Specifier for exported symbols. // GTEST_API_ - Specifier for exported symbols.
// //

View File

@ -36,7 +36,7 @@
// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir(). // GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir().
// See testing::TempDir for semantics and // See testing::TempDir for semantics and
// signature. // signature.
// //
// ** Custom implementation starts here ** // ** Custom implementation starts here **
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_

View File

@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
// //
// The Google C++ Testing Framework (Google Test) // The Google C++ Testing Framework (Google Test)
// //
@ -264,53 +263,6 @@ class InternalRunDeathTestFlag {
// the flag is specified; otherwise returns NULL. // the flag is specified; otherwise returns NULL.
InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag(); InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
#else // GTEST_HAS_DEATH_TEST
// This macro is used for implementing macros such as
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
// death tests are not supported. Those macros must compile on such systems
// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
// systems that support death tests. This allows one to write such a macro
// on a system that does not support death tests and be sure that it will
// compile on a death-test supporting system.
//
// Parameters:
// statement - A statement that a macro such as EXPECT_DEATH would test
// for program termination. This macro has to make sure this
// statement is compiled but not executed, to ensure that
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
// parameter iff EXPECT_DEATH compiles with it.
// regex - A regex that a macro such as EXPECT_DEATH would use to test
// the output of statement. This parameter has to be
// compiled but not evaluated by this macro, to ensure that
// this macro only accepts expressions that a macro such as
// EXPECT_DEATH would accept.
// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
// compile inside functions where ASSERT_DEATH doesn't
// compile.
//
// The branch that has an always false condition is used to ensure that
// statement and regex are compiled (and thus syntactically correct) but
// never executed. The unreachable code macro protects the terminator
// statement from generating an 'unreachable code' warning in case
// statement unconditionally returns or throws. The Message constructor at
// the end allows the syntax of streaming additional messages into the
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
GTEST_LOG_(WARNING) \
<< "Death tests are not supported on this platform.\n" \
<< "Statement '" #statement "' cannot be verified."; \
} else if (::testing::internal::AlwaysFalse()) { \
::testing::internal::RE::PartialMatch(".*", (regex)); \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
terminator; \
} else \
::testing::Message()
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
} // namespace internal } // namespace internal

View File

@ -27,14 +27,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: keith.ray@gmail.com (Keith Ray)
// //
// Google Test filepath utilities // Google Test filepath utilities
// //
// This header file declares classes and functions used internally by // This header file declares classes and functions used internally by
// Google Test. They are subject to change without notice. // Google Test. They are subject to change without notice.
// //
// This file is #included in <gtest/internal/gtest-internal.h>. // This file is #included in gtest/internal/gtest-internal.h.
// Do not include this header file separately! // Do not include this header file separately!
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_

View File

@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
// //
// The Google C++ Testing Framework (Google Test) // The Google C++ Testing Framework (Google Test)
// //
@ -61,8 +60,8 @@
#include <vector> #include <vector>
#include "gtest/gtest-message.h" #include "gtest/gtest-message.h"
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-filepath.h" #include "gtest/internal/gtest-filepath.h"
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-type-util.h" #include "gtest/internal/gtest-type-util.h"
// Due to C++ preprocessor weirdness, we need double indirection to // Due to C++ preprocessor weirdness, we need double indirection to
@ -157,7 +156,28 @@ class GTEST_API_ ScopedTrace {
public: public:
// The c'tor pushes the given source file location and message onto // The c'tor pushes the given source file location and message onto
// a trace stack maintained by Google Test. // a trace stack maintained by Google Test.
ScopedTrace(const char* file, int line, const Message& message);
// Template version. Uses Message() to convert the values into strings.
// Slow, but flexible.
template <typename T>
ScopedTrace(const char* file, int line, const T& message) {
PushTrace(file, line, (Message() << message).GetString());
}
// Optimize for some known types.
ScopedTrace(const char* file, int line, const char* message) {
PushTrace(file, line, message ? message : "(null)");
}
#if GTEST_HAS_GLOBAL_STRING
ScopedTrace(const char* file, int line, const ::string& message) {
PushTrace(file, line, message);
}
#endif
ScopedTrace(const char* file, int line, const std::string& message) {
PushTrace(file, line, message);
}
// The d'tor pops the info pushed by the c'tor. // The d'tor pops the info pushed by the c'tor.
// //
@ -166,6 +186,8 @@ class GTEST_API_ ScopedTrace {
~ScopedTrace(); ~ScopedTrace();
private: private:
void PushTrace(const char* file, int line, std::string message);
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace); GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
// c'tor and d'tor. Therefore it doesn't // c'tor and d'tor. Therefore it doesn't
@ -175,7 +197,7 @@ namespace edit_distance {
// Returns the optimal edits to go from 'left' to 'right'. // Returns the optimal edits to go from 'left' to 'right'.
// All edits cost the same, with replace having lower priority than // All edits cost the same, with replace having lower priority than
// add/remove. // add/remove.
// Simple implementation of the Wagner-Fischer algorithm. // Simple implementation of the WagnerFischer algorithm.
// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
enum EditType { kMatch, kAdd, kRemove, kReplace }; enum EditType { kMatch, kAdd, kRemove, kReplace };
GTEST_API_ std::vector<EditType> CalculateOptimalEdits( GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
@ -628,7 +650,7 @@ class TypeParameterizedTest {
// Types). Valid values for 'index' are [0, N - 1] where N is the // Types). Valid values for 'index' are [0, N - 1] where N is the
// length of Types. // length of Types.
static bool Register(const char* prefix, static bool Register(const char* prefix,
CodeLocation code_location, const CodeLocation& code_location,
const char* case_name, const char* test_names, const char* case_name, const char* test_names,
int index) { int index) {
typedef typename Types::Head Type; typedef typename Types::Head Type;
@ -659,7 +681,7 @@ class TypeParameterizedTest {
template <GTEST_TEMPLATE_ Fixture, class TestSel> template <GTEST_TEMPLATE_ Fixture, class TestSel>
class TypeParameterizedTest<Fixture, TestSel, Types0> { class TypeParameterizedTest<Fixture, TestSel, Types0> {
public: public:
static bool Register(const char* /*prefix*/, CodeLocation, static bool Register(const char* /*prefix*/, const CodeLocation&,
const char* /*case_name*/, const char* /*test_names*/, const char* /*case_name*/, const char* /*test_names*/,
int /*index*/) { int /*index*/) {
return true; return true;
@ -705,7 +727,7 @@ class TypeParameterizedTestCase {
template <GTEST_TEMPLATE_ Fixture, typename Types> template <GTEST_TEMPLATE_ Fixture, typename Types>
class TypeParameterizedTestCase<Fixture, Templates0, Types> { class TypeParameterizedTestCase<Fixture, Templates0, Types> {
public: public:
static bool Register(const char* /*prefix*/, CodeLocation, static bool Register(const char* /*prefix*/, const CodeLocation&,
const TypedTestCasePState* /*state*/, const TypedTestCasePState* /*state*/,
const char* /*case_name*/, const char* /*test_names*/) { const char* /*case_name*/, const char* /*test_names*/) {
return true; return true;

View File

@ -3203,7 +3203,7 @@ class CartesianProductGenerator2
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -3235,7 +3235,7 @@ class CartesianProductGenerator2
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_); current_value_.reset(new ParamType(*current1_, *current2_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -3257,7 +3257,7 @@ class CartesianProductGenerator2
const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator begin2_;
const typename ParamGenerator<T2>::iterator end2_; const typename ParamGenerator<T2>::iterator end2_;
typename ParamGenerator<T2>::iterator current2_; typename ParamGenerator<T2>::iterator current2_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator2::Iterator }; // class CartesianProductGenerator2::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@ -3326,7 +3326,7 @@ class CartesianProductGenerator3
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -3362,7 +3362,7 @@ class CartesianProductGenerator3
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_); current_value_.reset(new ParamType(*current1_, *current2_, *current3_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -3388,7 +3388,7 @@ class CartesianProductGenerator3
const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator begin3_;
const typename ParamGenerator<T3>::iterator end3_; const typename ParamGenerator<T3>::iterator end3_;
typename ParamGenerator<T3>::iterator current3_; typename ParamGenerator<T3>::iterator current3_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator3::Iterator }; // class CartesianProductGenerator3::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@ -3467,7 +3467,7 @@ class CartesianProductGenerator4
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -3507,8 +3507,8 @@ class CartesianProductGenerator4
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_); *current4_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -3538,7 +3538,7 @@ class CartesianProductGenerator4
const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator begin4_;
const typename ParamGenerator<T4>::iterator end4_; const typename ParamGenerator<T4>::iterator end4_;
typename ParamGenerator<T4>::iterator current4_; typename ParamGenerator<T4>::iterator current4_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator4::Iterator }; // class CartesianProductGenerator4::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@ -3625,7 +3625,7 @@ class CartesianProductGenerator5
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -3669,8 +3669,8 @@ class CartesianProductGenerator5
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_); *current4_, *current5_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -3704,7 +3704,7 @@ class CartesianProductGenerator5
const typename ParamGenerator<T5>::iterator begin5_; const typename ParamGenerator<T5>::iterator begin5_;
const typename ParamGenerator<T5>::iterator end5_; const typename ParamGenerator<T5>::iterator end5_;
typename ParamGenerator<T5>::iterator current5_; typename ParamGenerator<T5>::iterator current5_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator5::Iterator }; // class CartesianProductGenerator5::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@ -3802,7 +3802,7 @@ class CartesianProductGenerator6
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -3850,8 +3850,8 @@ class CartesianProductGenerator6
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_); *current4_, *current5_, *current6_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -3889,7 +3889,7 @@ class CartesianProductGenerator6
const typename ParamGenerator<T6>::iterator begin6_; const typename ParamGenerator<T6>::iterator begin6_;
const typename ParamGenerator<T6>::iterator end6_; const typename ParamGenerator<T6>::iterator end6_;
typename ParamGenerator<T6>::iterator current6_; typename ParamGenerator<T6>::iterator current6_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator6::Iterator }; // class CartesianProductGenerator6::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@ -3996,7 +3996,7 @@ class CartesianProductGenerator7
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -4048,8 +4048,8 @@ class CartesianProductGenerator7
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_); *current4_, *current5_, *current6_, *current7_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -4091,7 +4091,7 @@ class CartesianProductGenerator7
const typename ParamGenerator<T7>::iterator begin7_; const typename ParamGenerator<T7>::iterator begin7_;
const typename ParamGenerator<T7>::iterator end7_; const typename ParamGenerator<T7>::iterator end7_;
typename ParamGenerator<T7>::iterator current7_; typename ParamGenerator<T7>::iterator current7_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator7::Iterator }; // class CartesianProductGenerator7::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@ -4209,7 +4209,7 @@ class CartesianProductGenerator8
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -4265,8 +4265,8 @@ class CartesianProductGenerator8
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_); *current4_, *current5_, *current6_, *current7_, *current8_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -4312,7 +4312,7 @@ class CartesianProductGenerator8
const typename ParamGenerator<T8>::iterator begin8_; const typename ParamGenerator<T8>::iterator begin8_;
const typename ParamGenerator<T8>::iterator end8_; const typename ParamGenerator<T8>::iterator end8_;
typename ParamGenerator<T8>::iterator current8_; typename ParamGenerator<T8>::iterator current8_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator8::Iterator }; // class CartesianProductGenerator8::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@ -4438,7 +4438,7 @@ class CartesianProductGenerator9
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -4498,9 +4498,9 @@ class CartesianProductGenerator9
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_, *current4_, *current5_, *current6_, *current7_, *current8_,
*current9_); *current9_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -4550,7 +4550,7 @@ class CartesianProductGenerator9
const typename ParamGenerator<T9>::iterator begin9_; const typename ParamGenerator<T9>::iterator begin9_;
const typename ParamGenerator<T9>::iterator end9_; const typename ParamGenerator<T9>::iterator end9_;
typename ParamGenerator<T9>::iterator current9_; typename ParamGenerator<T9>::iterator current9_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator9::Iterator }; // class CartesianProductGenerator9::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
@ -4685,7 +4685,7 @@ class CartesianProductGenerator10
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -4749,9 +4749,9 @@ class CartesianProductGenerator10
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_, current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_, *current4_, *current5_, *current6_, *current7_, *current8_,
*current9_, *current10_); *current9_, *current10_));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -4805,7 +4805,7 @@ class CartesianProductGenerator10
const typename ParamGenerator<T10>::iterator begin10_; const typename ParamGenerator<T10>::iterator begin10_;
const typename ParamGenerator<T10>::iterator end10_; const typename ParamGenerator<T10>::iterator end10_;
typename ParamGenerator<T10>::iterator current10_; typename ParamGenerator<T10>::iterator current10_;
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator10::Iterator }; // class CartesianProductGenerator10::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.

View File

@ -160,7 +160,7 @@ $for k [[
virtual ParamIteratorInterface<ParamType>* Clone() const { virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this); return new Iterator(*this);
} }
virtual const ParamType* Current() const { return &current_value_; } virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other // Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast. // iterator is of the same type and we can downcast.
@ -192,7 +192,7 @@ $for k [[
void ComputeCurrentValue() { void ComputeCurrentValue() {
if (!AtEnd()) if (!AtEnd())
current_value_ = ParamType($for j, [[*current$(j)_]]); current_value_.reset(new ParamType($for j, [[*current$(j)_]]));
} }
bool AtEnd() const { bool AtEnd() const {
// We must report iterator past the end of the range when either of the // We must report iterator past the end of the range when either of the
@ -217,7 +217,7 @@ $for j [[
typename ParamGenerator<T$j>::iterator current$(j)_; typename ParamGenerator<T$j>::iterator current$(j)_;
]] ]]
ParamType current_value_; linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator$i::Iterator }; // class CartesianProductGenerator$i::Iterator
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.

View File

@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
// //
// The Google C++ Testing Framework (Google Test) // The Google C++ Testing Framework (Google Test)
// //
@ -35,7 +34,8 @@
// Google Test. They are subject to change without notice. They should not used // Google Test. They are subject to change without notice. They should not used
// by code external to Google Test. // by code external to Google Test.
// //
// This header file is #included by <gtest/internal/gtest-internal.h>. // This header file is #included by
// gtest/internal/gtest-internal.h.
// It should not be #included by other files. // It should not be #included by other files.
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_

View File

@ -26,14 +26,12 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Authors: keith.ray@gmail.com (Keith Ray)
#include "gtest/gtest-message.h"
#include "gtest/internal/gtest-filepath.h" #include "gtest/internal/gtest-filepath.h"
#include "gtest/internal/gtest-port.h"
#include <stdlib.h> #include <stdlib.h>
#include "gtest/internal/gtest-port.h"
#include "gtest/gtest-message.h"
#if GTEST_OS_WINDOWS_MOBILE #if GTEST_OS_WINDOWS_MOBILE
# include <windows.h> # include <windows.h>
@ -48,6 +46,8 @@
# include <climits> // Some Linux distributions define PATH_MAX here. # include <climits> // Some Linux distributions define PATH_MAX here.
#endif // GTEST_OS_WINDOWS_MOBILE #endif // GTEST_OS_WINDOWS_MOBILE
#include "gtest/internal/gtest-string.h"
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
# define GTEST_PATH_MAX_ _MAX_PATH # define GTEST_PATH_MAX_ _MAX_PATH
#elif defined(PATH_MAX) #elif defined(PATH_MAX)
@ -58,8 +58,6 @@
# define GTEST_PATH_MAX_ _POSIX_PATH_MAX # define GTEST_PATH_MAX_ _POSIX_PATH_MAX
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
#include "gtest/internal/gtest-string.h"
namespace testing { namespace testing {
namespace internal { namespace internal {

View File

@ -3839,12 +3839,11 @@ void StreamingListener::SocketWriter::MakeConnection() {
// Pushes the given source file location and message onto a per-thread // Pushes the given source file location and message onto a per-thread
// trace stack maintained by Google Test. // trace stack maintained by Google Test.
ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) void ScopedTrace::PushTrace(const char* file, int line, std::string message) {
GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
TraceInfo trace; TraceInfo trace;
trace.file = file; trace.file = file;
trace.line = line; trace.line = line;
trace.message = message.GetString(); trace.message.swap(message);
UnitTest::GetInstance()->PushGTestTrace(trace); UnitTest::GetInstance()->PushGTestTrace(trace);
} }

View File

@ -33,7 +33,6 @@
// Google Test work. // Google Test work.
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "test/gtest-param-test_test.h" #include "test/gtest-param-test_test.h"
using ::testing::Values; using ::testing::Values;

View File

@ -52,13 +52,13 @@
// hash_map and hash_set are available under Visual C++, or on Linux. // hash_map and hash_set are available under Visual C++, or on Linux.
#if GTEST_HAS_UNORDERED_MAP_ #if GTEST_HAS_UNORDERED_MAP_
# include <unordered_map> // NOLINT # include <unordered_map> // NOLINT
#elif GTEST_HAS_HASH_MAP_ #elif GTEST_HAS_HASH_MAP_
# include <hash_map> // NOLINT # include <hash_map> // NOLINT
#endif // GTEST_HAS_HASH_MAP_ #endif // GTEST_HAS_HASH_MAP_
#if GTEST_HAS_UNORDERED_SET_ #if GTEST_HAS_UNORDERED_SET_
# include <unordered_set> // NOLINT # include <unordered_set> // NOLINT
#elif GTEST_HAS_HASH_SET_ #elif GTEST_HAS_HASH_SET_
# include <hash_set> // NOLINT # include <hash_set> // NOLINT
#endif // GTEST_HAS_HASH_SET_ #endif // GTEST_HAS_HASH_SET_
@ -192,13 +192,12 @@ inline ::std::ostream& operator<<(::std::ostream& os,
return os << "StreamableTemplateInFoo: " << x.value(); return os << "StreamableTemplateInFoo: " << x.value();
} }
// A user-defined streamable but recursivly-defined container type in // A user-defined streamable but recursivly-defined container type in
// a user namespace, it mimics therefore std::filesystem::path or // a user namespace, it mimics therefore std::filesystem::path or
// boost::filesystem::path. // boost::filesystem::path.
class PathLike { class PathLike {
public: public:
struct iterator struct iterator {
{
typedef PathLike value_type; typedef PathLike value_type;
}; };
typedef iterator const_iterator; typedef iterator const_iterator;
@ -208,9 +207,7 @@ class PathLike {
iterator begin() const { return iterator(); } iterator begin() const { return iterator(); }
iterator end() const { return iterator(); } iterator end() const { return iterator(); }
friend friend ::std::ostream& operator<<(::std::ostream& os, const PathLike&) {
::std::ostream& operator<<(::std::ostream& os, const PathLike&)
{
return os << "Streamable-PathLike"; return os << "Streamable-PathLike";
} }
}; };
@ -250,9 +247,9 @@ using ::testing::internal::string;
#if GTEST_HAS_UNORDERED_MAP_ #if GTEST_HAS_UNORDERED_MAP_
#define GTEST_HAS_HASH_MAP_ 1 #define GTEST_HAS_HASH_MAP_ 1
template<class Key, class T> template <class Key, class T>
using hash_map = ::std::unordered_map<Key, T>; using hash_map = ::std::unordered_map<Key, T>;
template<class Key, class T> template <class Key, class T>
using hash_multimap = ::std::unordered_multimap<Key, T>; using hash_multimap = ::std::unordered_multimap<Key, T>;
#elif GTEST_HAS_HASH_MAP_ #elif GTEST_HAS_HASH_MAP_
@ -270,9 +267,9 @@ using ::stdext::hash_multimap;
#if GTEST_HAS_UNORDERED_SET_ #if GTEST_HAS_UNORDERED_SET_
#define GTEST_HAS_HASH_SET_ 1 #define GTEST_HAS_HASH_SET_ 1
template<class Key> template <class Key>
using hash_set = ::std::unordered_set<Key>; using hash_set = ::std::unordered_set<Key>;
template<class Key> template <class Key>
using hash_multiset = ::std::unordered_multiset<Key>; using hash_multiset = ::std::unordered_multiset<Key>;
#elif GTEST_HAS_HASH_SET_ #elif GTEST_HAS_HASH_SET_
@ -1092,7 +1089,7 @@ TEST(PrintTr1TupleTest, VariousSizes) {
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT ::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*, testing::internal::Int64, float, double, const char*, void*,
std::string> std::string>
t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, // NOLINT
ImplicitCast_<void*>(NULL), "10"); ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")", " pointing to \"8\", NULL, \"10\")",
@ -1152,7 +1149,7 @@ TEST(PrintStdTupleTest, VariousSizes) {
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT ::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*, testing::internal::Int64, float, double, const char*, void*,
std::string> std::string>
t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, // NOLINT
ImplicitCast_<void*>(NULL), "10"); ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")", " pointing to \"8\", NULL, \"10\")",

View File

@ -29,7 +29,7 @@
// //
// Author: wan@google.com (Zhanyong Wan) // Author: wan@google.com (Zhanyong Wan)
// //
// This is part of the unit test for include/gtest/gtest_prod.h. // This is part of the unit test for gtest_prod.h.
#include "production.h" #include "production.h"

View File

@ -29,7 +29,7 @@
// //
// Author: wan@google.com (Zhanyong Wan) // Author: wan@google.com (Zhanyong Wan)
// //
// This is part of the unit test for include/gtest/gtest_prod.h. // This is part of the unit test for gtest_prod.h.
#ifndef GTEST_TEST_PRODUCTION_H_ #ifndef GTEST_TEST_PRODUCTION_H_
#define GTEST_TEST_PRODUCTION_H_ #define GTEST_TEST_PRODUCTION_H_