Unverified Commit 76bce79a authored by Andy Soffer's avatar Andy Soffer Committed by GitHub
Browse files

Merge branch 'main' into fixes_std_pair_diff

parents 6f1c4b3d f345b2ca
...@@ -32,13 +32,14 @@ ...@@ -32,13 +32,14 @@
#include "gtest/gtest-test-part.h" #include "gtest/gtest-test-part.h"
#include <ostream>
#include <string>
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
namespace testing { namespace testing {
using internal::GetUnitTestImpl;
// Gets the summary of the failure message by omitting the stack trace // Gets the summary of the failure message by omitting the stack trace
// in it. // in it.
std::string TestPartResult::ExtractSummary(const char* message) { std::string TestPartResult::ExtractSummary(const char* message) {
......
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include "gtest/gtest-typed-test.h" #include "gtest/gtest-typed-test.h"
#include <set>
#include <string>
#include <vector>
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace testing { namespace testing {
...@@ -90,7 +94,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames( ...@@ -90,7 +94,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
} }
const std::string& errors_str = errors.GetString(); const std::string& errors_str = errors.GetString();
if (errors_str != "") { if (!errors_str.empty()) {
fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(), fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
errors_str.c_str()); errors_str.c_str());
fflush(stderr); fflush(stderr);
......
This diff is collapsed.
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_OS_ESP8266 || GTEST_OS_ESP32 #if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32)
// Arduino-like platforms: program entry points are setup/loop instead of main. // Arduino-like platforms: program entry points are setup/loop instead of main.
#if GTEST_OS_ESP8266 #ifdef GTEST_OS_ESP8266
extern "C" { extern "C" {
#endif #endif
...@@ -42,11 +42,11 @@ void setup() { testing::InitGoogleTest(); } ...@@ -42,11 +42,11 @@ void setup() { testing::InitGoogleTest(); }
void loop() { RUN_ALL_TESTS(); } void loop() { RUN_ALL_TESTS(); }
#if GTEST_OS_ESP8266 #ifdef GTEST_OS_ESP8266
} }
#endif #endif
#elif GTEST_OS_QURT #elif defined(GTEST_OS_QURT)
// QuRT: program entry point is main, but argc/argv are unusable. // QuRT: program entry point is main, but argc/argv are unusable.
GTEST_API_ int main() { GTEST_API_ int main() {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
#include <stdlib.h> #include <stdlib.h>
#include <windows.h> #include <windows.h>
#endif #endif
...@@ -49,7 +49,7 @@ namespace { ...@@ -49,7 +49,7 @@ namespace {
// A test that's expected to fail. // A test that's expected to fail.
TEST(Foo, Bar) { EXPECT_EQ(2, 3); } TEST(Foo, Bar) { EXPECT_EQ(2, 3); }
#if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE #if GTEST_HAS_SEH && !defined(GTEST_OS_WINDOWS_MOBILE)
// On Windows Mobile global exception handlers are not supported. // On Windows Mobile global exception handlers are not supported.
LONG WINAPI LONG WINAPI
ExitWithExceptionCode(struct _EXCEPTION_POINTERS* exception_pointers) { ExitWithExceptionCode(struct _EXCEPTION_POINTERS* exception_pointers) {
...@@ -60,12 +60,12 @@ ExitWithExceptionCode(struct _EXCEPTION_POINTERS* exception_pointers) { ...@@ -60,12 +60,12 @@ ExitWithExceptionCode(struct _EXCEPTION_POINTERS* exception_pointers) {
} // namespace } // namespace
int main(int argc, char** argv) { int main(int argc, char** argv) {
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
// Suppresses display of the Windows error dialog upon encountering // Suppresses display of the Windows error dialog upon encountering
// a general protection fault (segment violation). // a general protection fault (segment violation).
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS); SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
#if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE #if GTEST_HAS_SEH && !defined(GTEST_OS_WINDOWS_MOBILE)
// The default unhandled exception filter does not always exit // The default unhandled exception filter does not always exit
// with the exception code as exit code - for example it exits with // with the exception code as exit code - for example it exits with
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
using testing::internal::AlwaysFalse; using testing::internal::AlwaysFalse;
using testing::internal::AlwaysTrue; using testing::internal::AlwaysTrue;
#if GTEST_HAS_DEATH_TEST #ifdef GTEST_HAS_DEATH_TEST
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
#include <direct.h> // For chdir(). #include <direct.h> // For chdir().
#include <fcntl.h> // For O_BINARY #include <fcntl.h> // For O_BINARY
#include <io.h> #include <io.h>
...@@ -52,7 +52,10 @@ using testing::internal::AlwaysTrue; ...@@ -52,7 +52,10 @@ using testing::internal::AlwaysTrue;
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#if GTEST_OS_LINUX #include <string>
#include <vector>
#ifdef GTEST_OS_LINUX
#include <sys/time.h> #include <sys/time.h>
#endif // GTEST_OS_LINUX #endif // GTEST_OS_LINUX
...@@ -200,7 +203,7 @@ int DieInDebugElse12(int* sideeffect) { ...@@ -200,7 +203,7 @@ int DieInDebugElse12(int* sideeffect) {
return 12; return 12;
} }
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
// Death in dbg due to Windows CRT assertion failure, not opt. // Death in dbg due to Windows CRT assertion failure, not opt.
int DieInCRTDebugElse12(int* sideeffect) { int DieInCRTDebugElse12(int* sideeffect) {
...@@ -220,7 +223,7 @@ int DieInCRTDebugElse12(int* sideeffect) { ...@@ -220,7 +223,7 @@ int DieInCRTDebugElse12(int* sideeffect) {
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
#if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA #if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_FUCHSIA)
// Tests the ExitedWithCode predicate. // Tests the ExitedWithCode predicate.
TEST(ExitStatusPredicateTest, ExitedWithCode) { TEST(ExitStatusPredicateTest, ExitedWithCode) {
...@@ -374,7 +377,7 @@ TEST_F(TestForDeathTest, FastDeathTestInChangedDir) { ...@@ -374,7 +377,7 @@ TEST_F(TestForDeathTest, FastDeathTestInChangedDir) {
ASSERT_DEATH(_exit(1), ""); ASSERT_DEATH(_exit(1), "");
} }
#if GTEST_OS_LINUX #ifdef GTEST_OS_LINUX
void SigprofAction(int, siginfo_t*, void*) { /* no op */ void SigprofAction(int, siginfo_t*, void*) { /* no op */
} }
...@@ -641,7 +644,7 @@ TEST_F(TestForDeathTest, TestExpectDebugDeath) { ...@@ -641,7 +644,7 @@ TEST_F(TestForDeathTest, TestExpectDebugDeath) {
#endif #endif
} }
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
// https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/crtsetreportmode // https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/crtsetreportmode
// In debug mode, the calls to _CrtSetReportMode and _CrtSetReportFile enable // In debug mode, the calls to _CrtSetReportMode and _CrtSetReportFile enable
...@@ -693,7 +696,7 @@ void ExpectDebugDeathHelper(bool* aborted) { ...@@ -693,7 +696,7 @@ void ExpectDebugDeathHelper(bool* aborted) {
*aborted = false; *aborted = false;
} }
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) { TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
printf( printf(
"This test should be considered failing if it shows " "This test should be considered failing if it shows "
...@@ -805,14 +808,14 @@ static void TestExitMacros() { ...@@ -805,14 +808,14 @@ static void TestExitMacros() {
EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), ""); EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), ""); ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), "");
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
// Of all signals effects on the process exit code, only those of SIGABRT // Of all signals effects on the process exit code, only those of SIGABRT
// are documented on Windows. // are documented on Windows.
// See https://msdn.microsoft.com/en-us/query-bi/m/dwwzkt4c. // See https://msdn.microsoft.com/en-us/query-bi/m/dwwzkt4c.
EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar"; EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar";
#elif !GTEST_OS_FUCHSIA #elif !defined(GTEST_OS_FUCHSIA)
// Fuchsia has no unix signals. // Fuchsia has no unix signals.
EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo"; EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
...@@ -1177,7 +1180,7 @@ TEST(GetLastErrnoDescription, GetLastErrnoDescriptionWorks) { ...@@ -1177,7 +1180,7 @@ TEST(GetLastErrnoDescription, GetLastErrnoDescriptionWorks) {
EXPECT_STREQ("", GetLastErrnoDescription().c_str()); EXPECT_STREQ("", GetLastErrnoDescription().c_str());
} }
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
TEST(AutoHandleTest, AutoHandleWorks) { TEST(AutoHandleTest, AutoHandleWorks) {
HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL); HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
ASSERT_NE(INVALID_HANDLE_VALUE, handle); ASSERT_NE(INVALID_HANDLE_VALUE, handle);
...@@ -1204,7 +1207,7 @@ TEST(AutoHandleTest, AutoHandleWorks) { ...@@ -1204,7 +1207,7 @@ TEST(AutoHandleTest, AutoHandleWorks) {
} }
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
typedef unsigned __int64 BiggestParsable; typedef unsigned __int64 BiggestParsable;
typedef signed __int64 BiggestSignedParsable; typedef signed __int64 BiggestSignedParsable;
#else #else
...@@ -1301,7 +1304,7 @@ TEST(ParseNaturalNumberTest, WorksForShorterIntegers) { ...@@ -1301,7 +1304,7 @@ TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
EXPECT_EQ(123, char_result); EXPECT_EQ(123, char_result);
} }
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
TEST(EnvironmentTest, HandleFitsIntoSizeT) { TEST(EnvironmentTest, HandleFitsIntoSizeT) {
ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t)); ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));
} }
...@@ -1353,7 +1356,7 @@ void DieWithMessage(const char* message) { ...@@ -1353,7 +1356,7 @@ void DieWithMessage(const char* message) {
TEST(MatcherDeathTest, DoesNotBreakBareRegexMatching) { TEST(MatcherDeathTest, DoesNotBreakBareRegexMatching) {
// googletest tests this, of course; here we ensure that including googlemock // googletest tests this, of course; here we ensure that including googlemock
// has not broken it. // has not broken it.
#if GTEST_USES_POSIX_RE #ifdef GTEST_USES_POSIX_RE
EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I d[aeiou]e"); EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I d[aeiou]e");
#else #else
EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I di?e"); EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I di?e");
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "gtest/gtest-death-test.h" #include "gtest/gtest-death-test.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_HAS_DEATH_TEST #ifdef GTEST_HAS_DEATH_TEST
#if GTEST_HAS_SEH #if GTEST_HAS_SEH
#include <windows.h> // For RaiseException(). #include <windows.h> // For RaiseException().
......
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
#include "gtest/internal/gtest-filepath.h" #include "gtest/internal/gtest-filepath.h"
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#if GTEST_OS_WINDOWS_MOBILE #ifdef GTEST_OS_WINDOWS_MOBILE
#include <windows.h> // NOLINT #include <windows.h> // NOLINT
#elif GTEST_OS_WINDOWS #elif defined(GTEST_OS_WINDOWS)
#include <direct.h> // NOLINT #include <direct.h> // NOLINT
#endif // GTEST_OS_WINDOWS_MOBILE #endif // GTEST_OS_WINDOWS_MOBILE
...@@ -51,7 +51,7 @@ namespace testing { ...@@ -51,7 +51,7 @@ namespace testing {
namespace internal { namespace internal {
namespace { namespace {
#if GTEST_OS_WINDOWS_MOBILE #ifdef GTEST_OS_WINDOWS_MOBILE
// Windows CE doesn't have the remove C function. // Windows CE doesn't have the remove C function.
int remove(const char* path) { int remove(const char* path) {
...@@ -80,7 +80,7 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) { ...@@ -80,7 +80,7 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) {
const FilePath cwd = FilePath::GetCurrentDir(); const FilePath cwd = FilePath::GetCurrentDir();
posix::ChDir(original_dir.c_str()); posix::ChDir(original_dir.c_str());
#if GTEST_OS_WINDOWS || GTEST_OS_OS2 #if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_OS2)
// Skips the ":". // Skips the ":".
const char* const cwd_without_drive = strchr(cwd.c_str(), ':'); const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
...@@ -174,7 +174,7 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) { ...@@ -174,7 +174,7 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) {
// RemoveFileName "" -> "./" // RemoveFileName "" -> "./"
TEST(RemoveFileNameTest, EmptyName) { TEST(RemoveFileNameTest, EmptyName) {
#if GTEST_OS_WINDOWS_MOBILE #ifdef GTEST_OS_WINDOWS_MOBILE
// On Windows CE, we use the root as the current directory. // On Windows CE, we use the root as the current directory.
EXPECT_EQ(GTEST_PATH_SEP_, FilePath("").RemoveFileName().string()); EXPECT_EQ(GTEST_PATH_SEP_, FilePath("").RemoveFileName().string());
#else #else
...@@ -357,7 +357,7 @@ TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) { ...@@ -357,7 +357,7 @@ TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) {
} }
TEST(DirectoryTest, RootDirectoryExists) { TEST(DirectoryTest, RootDirectoryExists) {
#if GTEST_OS_WINDOWS // We are on Windows. #ifdef GTEST_OS_WINDOWS // We are on Windows.
char current_drive[_MAX_PATH]; // NOLINT char current_drive[_MAX_PATH]; // NOLINT
current_drive[0] = static_cast<char>(_getdrive() + 'A' - 1); current_drive[0] = static_cast<char>(_getdrive() + 'A' - 1);
current_drive[1] = ':'; current_drive[1] = ':';
...@@ -369,7 +369,7 @@ TEST(DirectoryTest, RootDirectoryExists) { ...@@ -369,7 +369,7 @@ TEST(DirectoryTest, RootDirectoryExists) {
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
} }
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) { TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
const int saved_drive_ = _getdrive(); const int saved_drive_ = _getdrive();
// Find a drive that doesn't exist. Start with 'Z' to avoid common ones. // Find a drive that doesn't exist. Start with 'Z' to avoid common ones.
...@@ -387,7 +387,7 @@ TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) { ...@@ -387,7 +387,7 @@ TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
} }
#endif // GTEST_OS_WINDOWS #endif // GTEST_OS_WINDOWS
#if !GTEST_OS_WINDOWS_MOBILE #ifndef GTEST_OS_WINDOWS_MOBILE
// Windows CE _does_ consider an empty directory to exist. // Windows CE _does_ consider an empty directory to exist.
TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) { TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
EXPECT_FALSE(FilePath("").DirectoryExists()); EXPECT_FALSE(FilePath("").DirectoryExists());
...@@ -395,7 +395,7 @@ TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) { ...@@ -395,7 +395,7 @@ TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
#endif // !GTEST_OS_WINDOWS_MOBILE #endif // !GTEST_OS_WINDOWS_MOBILE
TEST(DirectoryTest, CurrentDirectoryExists) { TEST(DirectoryTest, CurrentDirectoryExists) {
#if GTEST_OS_WINDOWS // We are on Windows. #ifdef GTEST_OS_WINDOWS // We are on Windows.
#ifndef _WIN32_CE // Windows CE doesn't have a current directory. #ifndef _WIN32_CE // Windows CE doesn't have a current directory.
EXPECT_TRUE(FilePath(".").DirectoryExists()); EXPECT_TRUE(FilePath(".").DirectoryExists());
...@@ -423,7 +423,7 @@ TEST(NormalizeTest, MultipleConsecutiveSeparatorsInMidstring) { ...@@ -423,7 +423,7 @@ TEST(NormalizeTest, MultipleConsecutiveSeparatorsInMidstring) {
// "/bar" == //bar" == "///bar" // "/bar" == //bar" == "///bar"
TEST(NormalizeTest, MultipleConsecutiveSeparatorsAtStringStart) { TEST(NormalizeTest, MultipleConsecutiveSeparatorsAtStringStart) {
EXPECT_EQ(GTEST_PATH_SEP_ "bar", FilePath(GTEST_PATH_SEP_ "bar").string()); EXPECT_EQ(GTEST_PATH_SEP_ "bar", FilePath(GTEST_PATH_SEP_ "bar").string());
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
EXPECT_EQ(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar", EXPECT_EQ(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar",
FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string()); FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string());
#else #else
...@@ -515,7 +515,7 @@ class DirectoryCreationTest : public Test { ...@@ -515,7 +515,7 @@ class DirectoryCreationTest : public Test {
} }
// Strings representing a directory and a file, with identical paths // Strings representing a directory and a file, with identical paths
// except for the trailing separator character that distinquishes // except for the trailing separator character that distinguishes
// a directory named 'test' from a file named 'test'. Example names: // a directory named 'test' from a file named 'test'. Example names:
FilePath testdata_path_; // "/tmp/directory_creation/test/" FilePath testdata_path_; // "/tmp/directory_creation/test/"
FilePath testdata_file_; // "/tmp/directory_creation/test" FilePath testdata_file_; // "/tmp/directory_creation/test"
...@@ -620,7 +620,7 @@ TEST(FilePathTest, IsDirectory) { ...@@ -620,7 +620,7 @@ TEST(FilePathTest, IsDirectory) {
TEST(FilePathTest, IsAbsolutePath) { TEST(FilePathTest, IsAbsolutePath) {
EXPECT_FALSE(FilePath("is" GTEST_PATH_SEP_ "relative").IsAbsolutePath()); EXPECT_FALSE(FilePath("is" GTEST_PATH_SEP_ "relative").IsAbsolutePath());
EXPECT_FALSE(FilePath("").IsAbsolutePath()); EXPECT_FALSE(FilePath("").IsAbsolutePath());
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
EXPECT_TRUE( EXPECT_TRUE(
FilePath("c:\\" GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative") FilePath("c:\\" GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative")
.IsAbsolutePath()); .IsAbsolutePath());
...@@ -638,7 +638,7 @@ TEST(FilePathTest, IsAbsolutePath) { ...@@ -638,7 +638,7 @@ TEST(FilePathTest, IsAbsolutePath) {
} }
TEST(FilePathTest, IsRootDirectory) { TEST(FilePathTest, IsRootDirectory) {
#if GTEST_OS_WINDOWS #ifdef GTEST_OS_WINDOWS
EXPECT_TRUE(FilePath("a:\\").IsRootDirectory()); EXPECT_TRUE(FilePath("a:\\").IsRootDirectory());
EXPECT_TRUE(FilePath("Z:/").IsRootDirectory()); EXPECT_TRUE(FilePath("Z:/").IsRootDirectory());
EXPECT_TRUE(FilePath("e://").IsRootDirectory()); EXPECT_TRUE(FilePath("e://").IsRootDirectory());
......
...@@ -88,20 +88,20 @@ EXPECTED_2 = { ...@@ -88,20 +88,20 @@ EXPECTED_2 = {
'time': '*', 'time': '*',
'timestamp': '*', 'timestamp': '*',
'testsuite': [{ 'testsuite': [{
'name': 'TestInt64Properties', 'name': 'TestInt64ConvertibleProperties',
'file': 'gtest_xml_outfile2_test_.cc', 'file': 'gtest_xml_outfile2_test_.cc',
'line': 41, 'line': 43,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'timestamp': '*', 'timestamp': '*',
'time': '*', 'time': '*',
'classname': 'PropertyTwo', 'classname': 'PropertyTwo',
'SetUpProp': '2', 'SetUpProp': '2',
'TestFloatProperty': '3', 'TestFloatProperty': '3.25',
'TestDoubleProperty': '4', 'TestDoubleProperty': '4.75',
'TestSizetProperty': '5', 'TestSizetProperty': '5',
'TestBoolProperty': '1', 'TestBoolProperty': 'true',
'TestCharProperty': '65', 'TestCharProperty': 'A',
'TestInt16Property': '6', 'TestInt16Property': '6',
'TestInt32Property': '7', 'TestInt32Property': '7',
'TestInt64Property': '8', 'TestInt64Property': '8',
......
...@@ -54,7 +54,7 @@ SUPPORTS_STACK_TRACES = NO_STACKTRACE_SUPPORT_FLAG not in sys.argv ...@@ -54,7 +54,7 @@ SUPPORTS_STACK_TRACES = NO_STACKTRACE_SUPPORT_FLAG not in sys.argv
if SUPPORTS_STACK_TRACES: if SUPPORTS_STACK_TRACES:
STACK_TRACE_TEMPLATE = '\nStack trace:\n*' STACK_TRACE_TEMPLATE = '\nStack trace:\n*'
else: else:
STACK_TRACE_TEMPLATE = '' STACK_TRACE_TEMPLATE = '\n'
EXPECTED_NON_EMPTY = { EXPECTED_NON_EMPTY = {
'tests': 26, 'tests': 26,
...@@ -77,7 +77,7 @@ EXPECTED_NON_EMPTY = { ...@@ -77,7 +77,7 @@ EXPECTED_NON_EMPTY = {
'testsuite': [{ 'testsuite': [{
'name': 'Succeeds', 'name': 'Succeeds',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 51, 'line': 53,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -96,7 +96,7 @@ EXPECTED_NON_EMPTY = { ...@@ -96,7 +96,7 @@ EXPECTED_NON_EMPTY = {
'testsuite': [{ 'testsuite': [{
'name': 'Fails', 'name': 'Fails',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 59, 'line': 61,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -124,7 +124,7 @@ EXPECTED_NON_EMPTY = { ...@@ -124,7 +124,7 @@ EXPECTED_NON_EMPTY = {
'testsuite': [{ 'testsuite': [{
'name': 'DISABLED_test_not_run', 'name': 'DISABLED_test_not_run',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 66, 'line': 68,
'status': 'NOTRUN', 'status': 'NOTRUN',
'result': 'SUPPRESSED', 'result': 'SUPPRESSED',
'time': '*', 'time': '*',
...@@ -144,7 +144,7 @@ EXPECTED_NON_EMPTY = { ...@@ -144,7 +144,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'Skipped', 'name': 'Skipped',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 73, 'line': 75,
'status': 'RUN', 'status': 'RUN',
'result': 'SKIPPED', 'result': 'SKIPPED',
'time': '*', 'time': '*',
...@@ -154,7 +154,7 @@ EXPECTED_NON_EMPTY = { ...@@ -154,7 +154,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'SkippedWithMessage', 'name': 'SkippedWithMessage',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 77, 'line': 79,
'status': 'RUN', 'status': 'RUN',
'result': 'SKIPPED', 'result': 'SKIPPED',
'time': '*', 'time': '*',
...@@ -164,7 +164,7 @@ EXPECTED_NON_EMPTY = { ...@@ -164,7 +164,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'SkippedAfterFailure', 'name': 'SkippedAfterFailure',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 81, 'line': 83,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -194,7 +194,7 @@ EXPECTED_NON_EMPTY = { ...@@ -194,7 +194,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'Succeeds', 'name': 'Succeeds',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 86, 'line': 88,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -204,7 +204,7 @@ EXPECTED_NON_EMPTY = { ...@@ -204,7 +204,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'Fails', 'name': 'Fails',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 91, 'line': 93,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -234,7 +234,7 @@ EXPECTED_NON_EMPTY = { ...@@ -234,7 +234,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'DISABLED_test', 'name': 'DISABLED_test',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 96, 'line': 98,
'status': 'NOTRUN', 'status': 'NOTRUN',
'result': 'SUPPRESSED', 'result': 'SUPPRESSED',
'time': '*', 'time': '*',
...@@ -254,7 +254,7 @@ EXPECTED_NON_EMPTY = { ...@@ -254,7 +254,7 @@ EXPECTED_NON_EMPTY = {
'testsuite': [{ 'testsuite': [{
'name': 'OutputsCData', 'name': 'OutputsCData',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 100, 'line': 102,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -282,7 +282,7 @@ EXPECTED_NON_EMPTY = { ...@@ -282,7 +282,7 @@ EXPECTED_NON_EMPTY = {
'testsuite': [{ 'testsuite': [{
'name': 'InvalidCharactersInMessage', 'name': 'InvalidCharactersInMessage',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 107, 'line': 109,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -313,7 +313,7 @@ EXPECTED_NON_EMPTY = { ...@@ -313,7 +313,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'OneProperty', 'name': 'OneProperty',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 119, 'line': 121,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -324,7 +324,7 @@ EXPECTED_NON_EMPTY = { ...@@ -324,7 +324,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'IntValuedProperty', 'name': 'IntValuedProperty',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 123, 'line': 125,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -335,7 +335,7 @@ EXPECTED_NON_EMPTY = { ...@@ -335,7 +335,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'ThreeProperties', 'name': 'ThreeProperties',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 127, 'line': 129,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -348,7 +348,7 @@ EXPECTED_NON_EMPTY = { ...@@ -348,7 +348,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'TwoValuesForOneKeyUsesLastValue', 'name': 'TwoValuesForOneKeyUsesLastValue',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 133, 'line': 135,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -370,7 +370,7 @@ EXPECTED_NON_EMPTY = { ...@@ -370,7 +370,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'RecordProperty', 'name': 'RecordProperty',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 138, 'line': 140,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -381,7 +381,7 @@ EXPECTED_NON_EMPTY = { ...@@ -381,7 +381,7 @@ EXPECTED_NON_EMPTY = {
{ {
'name': 'ExternalUtilityThatCallsRecordIntValuedProperty', 'name': 'ExternalUtilityThatCallsRecordIntValuedProperty',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 151, 'line': 153,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -394,7 +394,7 @@ EXPECTED_NON_EMPTY = { ...@@ -394,7 +394,7 @@ EXPECTED_NON_EMPTY = {
'ExternalUtilityThatCallsRecordStringValuedProperty' 'ExternalUtilityThatCallsRecordStringValuedProperty'
), ),
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 155, 'line': 157,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -416,7 +416,7 @@ EXPECTED_NON_EMPTY = { ...@@ -416,7 +416,7 @@ EXPECTED_NON_EMPTY = {
'name': 'HasTypeParamAttribute', 'name': 'HasTypeParamAttribute',
'type_param': 'int', 'type_param': 'int',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 171, 'line': 173,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -436,7 +436,7 @@ EXPECTED_NON_EMPTY = { ...@@ -436,7 +436,7 @@ EXPECTED_NON_EMPTY = {
'name': 'HasTypeParamAttribute', 'name': 'HasTypeParamAttribute',
'type_param': 'long', 'type_param': 'long',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 171, 'line': 173,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -456,7 +456,7 @@ EXPECTED_NON_EMPTY = { ...@@ -456,7 +456,7 @@ EXPECTED_NON_EMPTY = {
'name': 'HasTypeParamAttribute', 'name': 'HasTypeParamAttribute',
'type_param': 'int', 'type_param': 'int',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 178, 'line': 180,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -476,7 +476,7 @@ EXPECTED_NON_EMPTY = { ...@@ -476,7 +476,7 @@ EXPECTED_NON_EMPTY = {
'name': 'HasTypeParamAttribute', 'name': 'HasTypeParamAttribute',
'type_param': 'long', 'type_param': 'long',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 178, 'line': 180,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -497,7 +497,7 @@ EXPECTED_NON_EMPTY = { ...@@ -497,7 +497,7 @@ EXPECTED_NON_EMPTY = {
'name': 'HasValueParamAttribute/0', 'name': 'HasValueParamAttribute/0',
'value_param': '33', 'value_param': '33',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 162, 'line': 164,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -508,7 +508,7 @@ EXPECTED_NON_EMPTY = { ...@@ -508,7 +508,7 @@ EXPECTED_NON_EMPTY = {
'name': 'HasValueParamAttribute/1', 'name': 'HasValueParamAttribute/1',
'value_param': '42', 'value_param': '42',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 162, 'line': 164,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -519,7 +519,7 @@ EXPECTED_NON_EMPTY = { ...@@ -519,7 +519,7 @@ EXPECTED_NON_EMPTY = {
'name': 'AnotherTestThatHasValueParamAttribute/0', 'name': 'AnotherTestThatHasValueParamAttribute/0',
'value_param': '33', 'value_param': '33',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 163, 'line': 165,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -530,7 +530,7 @@ EXPECTED_NON_EMPTY = { ...@@ -530,7 +530,7 @@ EXPECTED_NON_EMPTY = {
'name': 'AnotherTestThatHasValueParamAttribute/1', 'name': 'AnotherTestThatHasValueParamAttribute/1',
'value_param': '42', 'value_param': '42',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 163, 'line': 165,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
...@@ -562,7 +562,7 @@ EXPECTED_FILTERED = { ...@@ -562,7 +562,7 @@ EXPECTED_FILTERED = {
'testsuite': [{ 'testsuite': [{
'name': 'Succeeds', 'name': 'Succeeds',
'file': 'gtest_xml_output_unittest_.cc', 'file': 'gtest_xml_output_unittest_.cc',
'line': 51, 'line': 53,
'status': 'RUN', 'status': 'RUN',
'result': 'COMPLETED', 'result': 'COMPLETED',
'time': '*', 'time': '*',
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
// This program will be invoked from a Python unit test. // This program will be invoked from a Python unit test.
// Don't run it directly. // Don't run it directly.
#include <ostream>
#include <string>
#include "gtest/gtest.h" #include "gtest/gtest.h"
// Several different test cases and tests that will be listed. // Several different test cases and tests that will be listed.
......
...@@ -32,19 +32,14 @@ ...@@ -32,19 +32,14 @@
// This file verifies Google Test event listeners receive events at the // This file verifies Google Test event listeners receive events at the
// right times. // right times.
#include <string>
#include <vector> #include <vector>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "gtest/internal/custom/gtest.h" #include "gtest/internal/custom/gtest.h"
using ::testing::AddGlobalTestEnvironment; using ::testing::AddGlobalTestEnvironment;
using ::testing::Environment;
using ::testing::InitGoogleTest; using ::testing::InitGoogleTest;
using ::testing::Test;
using ::testing::TestEventListener;
using ::testing::TestInfo;
using ::testing::TestPartResult;
using ::testing::TestSuite;
using ::testing::UnitTest; using ::testing::UnitTest;
// Used by tests to register their events. // Used by tests to register their events.
...@@ -278,7 +273,7 @@ int main(int argc, char** argv) { ...@@ -278,7 +273,7 @@ int main(int argc, char** argv) {
AddGlobalTestEnvironment(new EnvironmentInvocationCatcher); AddGlobalTestEnvironment(new EnvironmentInvocationCatcher);
GTEST_CHECK_(events.size() == 0) GTEST_CHECK_(events.empty())
<< "AddGlobalTestEnvironment should not generate any events itself."; << "AddGlobalTestEnvironment should not generate any events itself.";
GTEST_FLAG_SET(repeat, 2); GTEST_FLAG_SET(repeat, 2);
......
This diff is collapsed.
...@@ -132,7 +132,7 @@ def RemoveStackTraces(output): ...@@ -132,7 +132,7 @@ def RemoveStackTraces(output):
"""Removes all traces of stack traces from a Google Test program's output.""" """Removes all traces of stack traces from a Google Test program's output."""
# *? means "find the shortest string that matches". # *? means "find the shortest string that matches".
return re.sub(r'Stack trace:(.|\n)*?\n\n', '', output) return re.sub(r'Stack trace:(.|\n)*?\n', '', output)
def RemoveTime(output): def RemoveTime(output):
......
This diff is collapsed.
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
// (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.
#include <string>
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace { namespace {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment