diff --git a/googletest/test/googletest-options-test.cc b/googletest/test/googletest-options-test.cc index b712c06f..91d06a50 100644 --- a/googletest/test/googletest-options-test.cc +++ b/googletest/test/googletest-options-test.cc @@ -115,11 +115,14 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) { strcasecmp("gtest_dll_test", exe_str.c_str()) == 0; #elif defined(GTEST_OS_FUCHSIA) const bool success = exe_str == "app"; +#elif defined(__EMSCRIPTEN__) + const bool success = exe_str == "patched_googletest-options-test.js"; #else const bool success = exe_str == "googletest-options-test" || exe_str == "gtest_all_test" || exe_str == "lt-gtest_all_test" || exe_str == "gtest_dll_test"; -#endif // GTEST_OS_WINDOWS +#endif // platform ifdefs + if (!success) FAIL() << "GetCurrentExecutableName() returns " << exe_str; } diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 67d776ed..0b383ea7 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -422,11 +422,14 @@ TEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) { EXPECT_EQ("-1234567.89", FormatTimeInMillisAsSeconds(-1234567890)); } +// TODO: b/287046337 - In emscripten, local time zone modification is not +// supported. +#if !defined(__EMSCRIPTEN__) // Tests FormatEpochTimeInMillisAsIso8601(). The correctness of conversion // for particular dates below was verified in Python using // datetime.datetime.fromutctimestamp(/1000). -// FormatEpochTimeInMillisAsIso8601 depends on the current timezone, so we +// FormatEpochTimeInMillisAsIso8601 depends on the local timezone, so we // have to set up a particular timezone to obtain predictable results. class FormatEpochTimeInMillisAsIso8601Test : public Test { public: @@ -445,9 +448,8 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test { } GTEST_DISABLE_MSC_DEPRECATED_POP_() - // Set up the time zone for FormatEpochTimeInMillisAsIso8601 to use. We - // cannot use the local time zone because the function's output depends - // on the time zone. + // Set the local time zone for FormatEpochTimeInMillisAsIso8601 to be + // a fixed time zone for reproducibility purposes. SetTimeZone("UTC+00"); } @@ -514,6 +516,8 @@ TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsEpochStart) { EXPECT_EQ("1970-01-01T00:00:00.000", FormatEpochTimeInMillisAsIso8601(0)); } +#endif // __EMSCRIPTEN__ + #ifdef __BORLANDC__ // Silences warnings: "Condition is always true", "Unreachable code" #pragma option push -w-ccc -w-rch