1. 22 Mar, 2021 1 commit
    • Abseil Team's avatar
      Googletest export · 1a8ecf18
      Abseil Team authored
      Print std::u8string, std::u16string, and std::u32string as string literals
      
      Previously, these types were printed as "{ U+123, U+456, U+789 }". However,
      printed output in that form is difficult to compare against any literals that
      might be defined in code. Instead, just treat these types like std::string
      and std::wstring, escaping non-ASCII characters with a hexadecimal escape
      sequence.
      
      The tests have also been updated to cover the new functionality: as a bonus,
      the tests now also pass with the MSVC toolchain.
      
      Internally, the code has been reorganized to primarily operate in terms of
      char32_t, under the assumption that char32_t will always be at least as big
      as wchar_t. While that assumption is currently true, perhaps it won't be in
      the future...
      
      PiperOrigin-RevId: 364033132
      1a8ecf18
  2. 16 Mar, 2021 1 commit
    • Abseil Team's avatar
      Googletest export · ac1d60c2
      Abseil Team authored
      gtest: Output a canned test suite for environment failures in XML/JSON
      
      This surfaces useful information about the environment failure in a structured form.
      
      As we can see from the updated test, previously unsurfaced information is now present.
      
      PiperOrigin-RevId: 362292322
      ac1d60c2
  3. 25 Feb, 2021 1 commit
    • Niels Dekker's avatar
      overload PrintTo for std::type_info and std::type_index · ac3c2a8d
      Niels Dekker authored
      Included the string returned by their `name()` member function with the output of `PrintTo`.
      
      Typical use case:
      
          std::unique_ptr<AbstractProduct> product = FactoryMethod();
          // Assert that the product is of type X:
          ASSERT_EQ(std::type_index{typeid(*product)},
                    std::type_index{typeid(ProductX)});
      
      Possible output in case of a test assert failure, now including the names of the compared type indices:
      
      > error: Expected equality of these values:
      >  std::type_index(typeid(*product))
      >    Which is: 8-byte object <D0-65 54-8C F6-7F 00-00> ("class ProductY")
      >  std::type_index(typeid(ProductX))
      >    Which is: 8-byte object <40-64 54-8C F6-7F 00-00> ("class ProductX")
      
      With help from Krystian Kuzniarek.
      ac3c2a8d
  4. 18 Feb, 2021 2 commits
    • Abseil Team's avatar
      Googletest export · daa0df7b
      Abseil Team authored
      Explicitly skip tests after fatal global environment setup errors
      
      Previously the tests were all skipped, but the resulting output claimed all
      tests passed.
      
      Before:
      ```
      [----------] Global test environment set-up.
      <failure message>
      [----------] Global test environment tear-down
      [==========] 1 test from 1 test suite ran. (83 ms total)
      [  PASSED  ] 1 test.
      [  FAILED  ] 0 tests, listed below:
      ```
      
      After:
      ```
      [==========] Running 1 test from 1 test suite.
      [----------] Global test environment set-up.
      <failure message>
      [----------] 1 test from SomeTest
      [ RUN      ] SomeTest.DoesFoo
      <...>: Skipped
      [  SKIPPED ] SomeTest.DoesFoo (0 ms)
      [----------] 1 test from SomeTest (0 ms total)
      
      [----------] Global test environment tear-down
      [==========] 1 test from 1 test suite ran. (68 ms total)
      [  PASSED  ] 0 tests.
      [  SKIPPED ] 1 test, listed below:
      [  SKIPPED ] SomeTest.DoesFoo
      [  FAILED  ] 0 tests, listed below:
      ```
      
      PiperOrigin-RevId: 358026389
      daa0df7b
    • Abseil Team's avatar
      Googletest export · 0a3a3a84
      Abseil Team authored
      Make include guards conform with https://google.github.io/styleguide/cppguide.html#The__define_Guard, attempt #2
      
      PiperOrigin-RevId: 357056902
      0a3a3a84
  5. 11 Feb, 2021 3 commits
  6. 05 Feb, 2021 1 commit
    • Abseil Team's avatar
      Googletest export · d1143988
      Abseil Team authored
      Remove uses of GTEST_HAS_TYPED_TEST_P and GTEST_HAS_TYPED_TEST.
      
      PiperOrigin-RevId: 353935996
      d1143988
  7. 14 Jan, 2021 2 commits
    • Abseil Team's avatar
      Googletest export · 6b2e7490
      Abseil Team authored
      Print unique_ptr/shared_ptr recursively.
      Given that they are smart pointers, it is unlikely that the inner object is
      invalid.
      
      PiperOrigin-RevId: 351586888
      6b2e7490
    • Abseil Team's avatar
      Googletest export · f8304d76
      Abseil Team authored
      Add support for printing incomplete types in the universal printer.
      
      PiperOrigin-RevId: 350154637
      f8304d76
  8. 25 Dec, 2020 1 commit
  9. 22 Dec, 2020 1 commit
  10. 10 Dec, 2020 1 commit
    • dmauro's avatar
      Googletest export · fb4b3b6b
      dmauro authored
      Fix a missing Bazel build dependency
      
      PiperOrigin-RevId: 346783462
      fb4b3b6b
  11. 02 Dec, 2020 2 commits
    • Abseil Team's avatar
      Googletest export · 141e9594
      Abseil Team authored
      Remove `status` from our internal Subprocess utility.
      
      This facility is unused, so better to just remove it than figure out what its cross-OS semantics should be.
      
      PiperOrigin-RevId: 345279290
      141e9594
    • Abseil Team's avatar
      Googletest export · 73979ee1
      Abseil Team authored
      Check for a high bit to see if a return value is a signal or an error code in googletest/test.
      
      This is needed because for subprocess under python3 windows, a return value representing a C signal (such as 0x80000003) is represented as a large positive integer rather than a negative one.
      
      PiperOrigin-RevId: 345270460
      73979ee1
  12. 12 Nov, 2020 3 commits
    • Abseil Team's avatar
      Googletest export · a1adec79
      Abseil Team authored
      Use a tagged constructor for FlatTuple instead.
      Some versions of MSVC are getting confused with that constructor and generating invalid code.
      
      PiperOrigin-RevId: 342050957
      a1adec79
    • dmauro's avatar
      Googletest export · e7ed50fd
      dmauro authored
      Disable the wide character printing tests that were discovered to fail
      under MSVC. Created a bug to debug this.
      
      PiperOrigin-RevId: 341886318
      e7ed50fd
    • dmauro's avatar
      Googletest export · d385a772
      dmauro authored
      Fix *_THROW tests under MSVC, which produce slightly different type
      names from std::type_info (e.g. "class std::runtime_error" instead of
      "std::runtime_error")
      
      PiperOrigin-RevId: 341874178
      d385a772
  13. 20 Oct, 2020 1 commit
  14. 15 Oct, 2020 1 commit
    • dmauro's avatar
      Googletest export · 3c95bf55
      dmauro authored
      Fixes build warnings from previous CL
      Add CMake to internal presubmit to prevent these
      
      PiperOrigin-RevId: 337325504
      3c95bf55
  15. 14 Oct, 2020 3 commits
    • dmauro's avatar
      Googletest export · f3dbe3ec
      dmauro authored
      Disable warnings on code that intentionally tests a suboptimal syntax
      
      PiperOrigin-RevId: 337138442
      f3dbe3ec
    • ofats's avatar
      Googletest export · 2cf1f99b
      ofats authored
      Add helper methos to internal FlatTuple. Refactor constructors.
      
      PiperOrigin-RevId: 336306681
      2cf1f99b
    • Abseil Team's avatar
      Googletest export · 0555b0ea
      Abseil Team authored
      Improve lookup of operator<< for user types
      
      Without this fix, trying to use this class with googletest
      
        struct Foo {};
      
        template <typename OutputStream>
        OutputStream& operator<<(OutputStream& os, const Foo&) {
          os << "TemplatedStreamableInFoo";
          return os;
        }
      
      results in an ambiguity error between the class' operator<< and the
      operator<< in gtest-printers.h removed in this CL.
      
      This fix also enables implicit conversions to happen, so that e.g.
      we will find the base class operator<< if a subclass has no
      operator<< of its own.
      
      PiperOrigin-RevId: 336261221
      0555b0ea
  16. 24 Sep, 2020 1 commit
    • Abseil Team's avatar
      Googletest export · b5687db5
      Abseil Team authored
      Improve DoubleNearPredFormat output on bad epsilons
      
      DoubleNearPredFormat will happily accept epsilon values (abs_error) that
      are so small that they are meaningless. This turns EXPECT_NEAR into a
      complicated and non-obvious version of EXPECT_EQ.
      
      This change modifies DoubleNearPredFormat) so that when there is a
      failure it calculates the smallest meaningful epsilon value, given the
      input values, and then prints a message which explains what happened.
      
      If a true equality test is wanted either pass a literal 0.0 as abs_error
      or use EXPECT_EQ. If a check for being almost equal is wanted consider
      using EXPECT_DOUBLE_EQ which, contrary to its name, verifies that the
      two numbers are *almost* equal (within four ULPs).
      
      With this change the flaky test mentioned in crbug.com/786046 gives this
      output:
      
      The difference between 4.2934311416234112e+18 and 4.2934311416234107e+18 is 512, where
      4.2934311416234112e+18 evaluates to 4.2934311416234112e+18,
      4.2934311416234107e+18 evaluates to 4.2934311416234107e+18.
      The abs_error parameter 1.0 evaluates to 1 which is smaller than the minimum distance between doubles for numbers of this magnitude which is 512, thus making this EXPECT_NEAR check equivalent to EXPECT_EQUAL. Consider using EXPECT_DOUBLE_EQ instead.
      
      Tested:
      I confirmed that this change detects the bad epsilon value that caused
      crbug.com/786046 in Chromium and added a test for the desired output.
      PiperOrigin-RevId: 332946880
      b5687db5
  17. 01 Sep, 2020 1 commit
    • Abseil Team's avatar
      Googletest export · af1e75ce
      Abseil Team authored
      Add millisecond precision to start timestamp in XML/JSON output
      
      - Previous timestamp had format YYYY-MM-DDThh:mm:ss, now YYYY-MM-DDThh:mm:ss.sss
      - This conforms to the ISO 8601 standard
      
      PiperOrigin-RevId: 329503623
      af1e75ce
  18. 05 Aug, 2020 1 commit
  19. 02 Aug, 2020 1 commit
  20. 02 Jul, 2020 1 commit
  21. 26 Jun, 2020 1 commit
    • Abseil Team's avatar
      Googletest export · aee0f9d9
      Abseil Team authored
      Add Bazel build rules for gtest_list_output_unittest.py and correct some off-by-one line number expectations.
      
      PiperOrigin-RevId: 318466071
      aee0f9d9
  22. 20 Jun, 2020 1 commit
  23. 18 Jun, 2020 1 commit
    • Abseil Team's avatar
      Googletest export · c6e309b2
      Abseil Team authored
      gtest.cc: fix a couple typos
      
      s/paramaterized/parameterized/
      
      PiperOrigin-RevId: 316878900
      c6e309b2
  24. 12 Jun, 2020 1 commit
    • dmauro's avatar
      Googletest export · 8567b092
      dmauro authored
      Adds support for printing pointers of types char8_t, char16_t, and char32_t.
      
      PiperOrigin-RevId: 316112767
      8567b092
  25. 10 Jun, 2020 1 commit
    • Abseil Team's avatar
      Googletest export · ec94d9f2
      Abseil Team authored
      Fail TEST_Ps or TYPED_TEST_Ps that are defined but are not instantiated, as well as the opposite case, where INSTANTIATE_TEST_SUITE_P or INSTANTIATE_TYPED_TEST_SUITE_P is used but without any matching TEST_P or TYPED_TEST_P.
      
      PiperOrigin-RevId: 315255779
      ec94d9f2
  26. 05 Jun, 2020 1 commit
    • dmauro's avatar
      Googletest export · 4fe01803
      dmauro authored
      Adds support for printing the types char8_t, char16_t, and char32_t
      
      This changes prints these types as Unicode code points. It is possible
      that there is a better way of printing these types, but that change is
      more complex, and the format in which Googletest prints these types is
      subject to change if someone implements a better way of printing them.
      
      This fixes the C++20 build, which removed support for printing these types.
      https://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt2
      
      Fixes #2854
      
      PiperOrigin-RevId: 314826912
      4fe01803
  27. 29 May, 2020 4 commits
  28. 05 May, 2020 1 commit