mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
deps: update googletest to 283c17563fe7a1111cd7f581aa5d541e8baeff2f
PR-URL: https://github.com/nodejs/node/pull/65833 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
e34af820da
commit
0539e90110
9 files changed
+21
-112
No files matched your search
+2
-8
@@ -143,13 +143,9 @@ class GTEST_API_ [[nodiscard]] AssertionResult {
|
||||
// Used in EXPECT_TRUE/FALSE(assertion_result).
|
||||
AssertionResult(const AssertionResult& other);
|
||||
|
||||
// C4800 is a level 3 warning in Visual Studio 2015 and earlier.
|
||||
// This warning is not emitted in Visual Studio 2017.
|
||||
// This warning is off by default starting in Visual Studio 2019 but can be
|
||||
// enabled with command-line options.
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
||||
// C4800 is off by default starting in Visual Studio 2019 but can be
|
||||
// enabled with command-line options.
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
|
||||
#endif
|
||||
|
||||
// Used in the EXPECT_TRUE/FALSE(bool_expression).
|
||||
//
|
||||
@@ -171,9 +167,7 @@ class GTEST_API_ [[nodiscard]] AssertionResult {
|
||||
int> = 0>
|
||||
explicit AssertionResult(const T& success) : success_(success) {}
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
||||
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
||||
#endif
|
||||
|
||||
// Assignment operator.
|
||||
AssertionResult& operator=(AssertionResult other) {
|
||||
|
||||
+2
-9
@@ -52,16 +52,9 @@
|
||||
#include "gtest/internal/gtest-internal.h"
|
||||
#include "gtest/internal/gtest-port.h"
|
||||
|
||||
// MSVC warning C5046 is new as of VS2017 version 15.8.
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1915
|
||||
#define GTEST_MAYBE_5046_ 5046
|
||||
#else
|
||||
#define GTEST_MAYBE_5046_
|
||||
#endif
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(
|
||||
4251 GTEST_MAYBE_5046_ /* class A needs to have dll-interface to be used by
|
||||
clients of class B */
|
||||
// class A needs to have dll-interface to be used by clients of class B
|
||||
4251 5046
|
||||
/* Symbol involving type with internal linkage not defined */)
|
||||
|
||||
namespace testing {
|
||||
|
||||
+5
-5
@@ -104,6 +104,8 @@
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <any>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -279,15 +281,13 @@ struct ProtobufPrinter {
|
||||
|
||||
struct ConvertibleToIntegerPrinter {
|
||||
// Since T has no << operator or PrintTo() but can be implicitly
|
||||
// converted to BiggestInt, we print it as a BiggestInt.
|
||||
// converted to intmax_t, we print it as an intmax_t.
|
||||
//
|
||||
// Most likely T is an enum type (either named or unnamed), in which
|
||||
// case printing it as an integer is the desired behavior. In case
|
||||
// T is not an enum, printing it as an integer is the best we can do
|
||||
// given that it has no user-defined printer.
|
||||
static void PrintValue(internal::BiggestInt value, ::std::ostream* os) {
|
||||
*os << value;
|
||||
}
|
||||
static void PrintValue(intmax_t value, ::std::ostream* os) { *os << value; }
|
||||
};
|
||||
|
||||
struct ConvertibleToStringViewPrinter {
|
||||
@@ -347,7 +347,7 @@ struct FindFirstPrinter<
|
||||
// - Print object pointers.
|
||||
// - Print protocol buffers.
|
||||
// - Use the stream operator, if available.
|
||||
// - Print types convertible to BiggestInt.
|
||||
// - Print types convertible to intmax_t.
|
||||
// - Print types convertible to StringView, if available.
|
||||
// - Fallback to printing the raw bytes of the object.
|
||||
template <typename T>
|
||||
|
||||
+4
-4
@@ -1419,14 +1419,14 @@ class [[nodiscard]] EqHelper {
|
||||
}
|
||||
|
||||
// With this overloaded version, we allow anonymous enums to be used
|
||||
// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
|
||||
// enums can be implicitly cast to BiggestInt.
|
||||
// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums can be
|
||||
// implicitly cast to intmax_t.
|
||||
//
|
||||
// Even though its body looks the same as the above version, we
|
||||
// cannot merge the two, as it will make anonymous enums unhappy.
|
||||
static AssertionResult Compare(const char* lhs_expression,
|
||||
const char* rhs_expression, BiggestInt lhs,
|
||||
BiggestInt rhs) {
|
||||
const char* rhs_expression, intmax_t lhs,
|
||||
intmax_t rhs) {
|
||||
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
|
||||
}
|
||||
|
||||
|
||||
+3
-63
@@ -236,7 +236,6 @@
|
||||
// Integer types:
|
||||
// TypeWithSize - maps an integer to a int type.
|
||||
// TimeInMillis - integers of known sizes.
|
||||
// BiggestInt - the biggest signed integer type.
|
||||
//
|
||||
// Command-line utilities:
|
||||
// GetInjectableArgvs() - returns the command line as a vector of strings.
|
||||
@@ -342,13 +341,6 @@
|
||||
#define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
|
||||
#endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
|
||||
|
||||
// Determines the version of gcc that is used to compile this.
|
||||
#ifdef __GNUC__
|
||||
// 40302 means version 4.3.2.
|
||||
#define GTEST_GCC_VER_ \
|
||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif // __GNUC__
|
||||
|
||||
// Macros for disabling Microsoft Visual C++ warnings.
|
||||
//
|
||||
// GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
|
||||
@@ -456,14 +448,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||
#if defined(_MSC_VER) && defined(_CPPUNWIND)
|
||||
// MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled.
|
||||
#define GTEST_HAS_EXCEPTIONS 1
|
||||
#elif defined(__BORLANDC__)
|
||||
// C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS
|
||||
// macro to enable exceptions, so we'll do the same.
|
||||
// Assumes that exceptions are enabled by default.
|
||||
#ifndef _HAS_EXCEPTIONS
|
||||
#define _HAS_EXCEPTIONS 1
|
||||
#endif // _HAS_EXCEPTIONS
|
||||
#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
|
||||
#elif defined(__clang__)
|
||||
// clang defines __EXCEPTIONS if and only if exceptions are enabled before clang
|
||||
// 220714, but if and only if cleanups are enabled after that. In Obj-C++ files,
|
||||
@@ -481,23 +465,11 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||
#elif defined(__GNUC__) && defined(__EXCEPTIONS) && __EXCEPTIONS
|
||||
// gcc defines __EXCEPTIONS to 1 if and only if exceptions are enabled.
|
||||
#define GTEST_HAS_EXCEPTIONS 1
|
||||
#elif defined(__SUNPRO_CC)
|
||||
// Sun Pro CC supports exceptions. However, there is no compile-time way of
|
||||
// detecting whether they are enabled or not. Therefore, we assume that
|
||||
// they are enabled unless the user tells us otherwise.
|
||||
#define GTEST_HAS_EXCEPTIONS 1
|
||||
#elif defined(__IBMCPP__) && defined(__EXCEPTIONS) && __EXCEPTIONS
|
||||
// xlC defines __EXCEPTIONS to 1 if and only if exceptions are enabled.
|
||||
#define GTEST_HAS_EXCEPTIONS 1
|
||||
#elif defined(__HP_aCC)
|
||||
// Exception handling is in effect by default in HP aCC compiler. It has to
|
||||
// be turned of by +noeh compiler option if desired.
|
||||
#define GTEST_HAS_EXCEPTIONS 1
|
||||
#else
|
||||
// For other compilers, we assume exceptions are disabled to be
|
||||
// conservative.
|
||||
#define GTEST_HAS_EXCEPTIONS 0
|
||||
#endif // defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#endif // defined(_MSC_VER) && defined(_CPPUNWIND)
|
||||
#endif // GTEST_HAS_EXCEPTIONS
|
||||
|
||||
// MSVC either defines wchar_t as a typedef of unsigned short, or as a native
|
||||
@@ -621,16 +593,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||
|
||||
#define GTEST_HAS_RTTI __has_feature(cxx_rtti)
|
||||
|
||||
// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
|
||||
// both the typeid and dynamic_cast features are present.
|
||||
#elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
|
||||
|
||||
#ifdef __RTTI_ALL__
|
||||
#define GTEST_HAS_RTTI 1
|
||||
#else
|
||||
#define GTEST_HAS_RTTI 0
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// For all other compilers, we assume RTTI is enabled.
|
||||
@@ -752,8 +714,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||
|
||||
// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
|
||||
// Sun Pro CC, IBM Visual Age, and HP aCC support.
|
||||
#if defined(__GNUC__) || defined(_MSC_VER) || defined(__SUNPRO_CC) || \
|
||||
defined(__IBMCPP__) || defined(__HP_aCC)
|
||||
#if defined(__GNUC__) || defined(_MSC_VER)
|
||||
#define GTEST_HAS_TYPED_TEST 1
|
||||
#define GTEST_HAS_TYPED_TEST_P 1
|
||||
#endif
|
||||
@@ -867,8 +828,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||
#ifndef GTEST_HAS_SEH
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
// These two compilers are known to support SEH.
|
||||
#ifdef _MSC_VER
|
||||
#define GTEST_HAS_SEH 1
|
||||
#else
|
||||
// Assume no SEH.
|
||||
@@ -2146,12 +2106,6 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
inline int DoIsATTY(int fd) { return isatty(fd); }
|
||||
inline int StrCaseCmp(const char* s1, const char* s2) {
|
||||
return stricmp(s1, s2);
|
||||
}
|
||||
#else // !__BORLANDC__
|
||||
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_ZOS) || \
|
||||
defined(GTEST_OS_IOS) || defined(GTEST_OS_WINDOWS_PHONE) || \
|
||||
defined(GTEST_OS_WINDOWS_RT) || defined(ESP_PLATFORM)
|
||||
@@ -2162,7 +2116,6 @@ inline int DoIsATTY(int fd) { return _isatty(fd); }
|
||||
inline int StrCaseCmp(const char* s1, const char* s2) {
|
||||
return _stricmp(s1, s2);
|
||||
}
|
||||
#endif // __BORLANDC__
|
||||
|
||||
#else
|
||||
|
||||
@@ -2264,11 +2217,6 @@ inline const char* GetEnv(const char* name) {
|
||||
// We are on an embedded platform, which has no environment variables.
|
||||
static_cast<void>(name); // To prevent 'unused argument' warning.
|
||||
return nullptr;
|
||||
#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
|
||||
// Environment variables which we programmatically clear will be set to the
|
||||
// empty string rather than unset (NULL). Handle that case.
|
||||
const char* const env = getenv(name);
|
||||
return (env != nullptr && env[0] != '\0') ? env : nullptr;
|
||||
#else
|
||||
return getenv(name);
|
||||
#endif
|
||||
@@ -2303,14 +2251,6 @@ GTEST_DISABLE_DEPRECATED_POP_()
|
||||
#define GTEST_SNPRINTF_ snprintf
|
||||
#endif
|
||||
|
||||
// The biggest signed integer type the compiler supports.
|
||||
//
|
||||
// long long is guaranteed to be at least 64-bits in C++11.
|
||||
using BiggestInt = long long; // NOLINT
|
||||
|
||||
// The maximum number a BiggestInt can represent.
|
||||
constexpr BiggestInt kMaxBiggestInt = (std::numeric_limits<BiggestInt>::max)();
|
||||
|
||||
// This template class serves as a compile-time function from size to
|
||||
// type. It maps a size in bytes to a primitive type with that
|
||||
// size. e.g.
|
||||
|
||||
@@ -43,11 +43,6 @@
|
||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
// string.h is not guaranteed to provide strcpy on C++ Builder.
|
||||
#include <mem.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
// libstdc++ (which is where cxxabi.h comes from).
|
||||
#if GTEST_HAS_CXXABI_H_
|
||||
#include <cxxabi.h>
|
||||
#elif defined(__HP_aCC)
|
||||
#include <acxx_demangle.h>
|
||||
#endif // GTEST_HASH_CXXABI_H_
|
||||
|
||||
namespace testing {
|
||||
@@ -90,13 +88,11 @@ inline std::string CanonicalizeForStdLibVersioning(std::string s) {
|
||||
// GetTypeName(const std::type_info&) returns a human-readable name of type T.
|
||||
inline std::string GetTypeName(const std::type_info& type) {
|
||||
const char* const name = type.name();
|
||||
#if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
|
||||
#if GTEST_HAS_CXXABI_H_
|
||||
int status = 0;
|
||||
// gcc's implementation of typeid(T).name() mangles the type name,
|
||||
// so we have to demangle it.
|
||||
#if GTEST_HAS_CXXABI_H_
|
||||
using abi::__cxa_demangle;
|
||||
#endif // GTEST_HAS_CXXABI_H_
|
||||
char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status);
|
||||
const std::string name_str(status == 0 ? readable_name : name);
|
||||
free(readable_name);
|
||||
@@ -117,7 +113,7 @@ inline std::string GetTypeName(const std::type_info& type) {
|
||||
return s;
|
||||
#else
|
||||
return name;
|
||||
#endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
|
||||
#endif // GTEST_HAS_CXXABI_H_
|
||||
}
|
||||
#endif // GTEST_HAS_RTTI
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -1242,14 +1242,14 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) {
|
||||
return content;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
|
||||
#if defined(_MSC_VER)
|
||||
// MSVC does not provide a definition of STDERR_FILENO.
|
||||
const int kStdOutFileno = 1;
|
||||
const int kStdErrFileno = 2;
|
||||
#else
|
||||
const int kStdOutFileno = STDOUT_FILENO;
|
||||
const int kStdErrFileno = STDERR_FILENO;
|
||||
#endif // defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
// Starts capturing stdout.
|
||||
void CaptureStdout() {
|
||||
|
||||
Vendored
-9
@@ -5289,17 +5289,8 @@ void TestEventListeners::SuppressEventForwarding(bool suppress) {
|
||||
// call this before main() starts, from which point on the return
|
||||
// value will never change.
|
||||
UnitTest* UnitTest::GetInstance() {
|
||||
// CodeGear C++Builder insists on a public destructor for the
|
||||
// default implementation. Use this implementation to keep good OO
|
||||
// design with private destructor.
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
static UnitTest* const instance = new UnitTest;
|
||||
return instance;
|
||||
#else
|
||||
static UnitTest instance;
|
||||
return &instance;
|
||||
#endif // defined(__BORLANDC__)
|
||||
}
|
||||
|
||||
// Gets the number of successful test suites.
|
||||
|
||||
Reference in new issue
Block a user