1. 07 Jul, 2021 1 commit
    • Abseil Team's avatar
      Googletest export · 4cfd1498
      Abseil Team authored
      gtest: Add a flag to only set up/tear down test environments once when repeating
      
      Currently when running a test multiple times using `--gtest_repeat` the global
      test environment(s) are set up and torn down for each iteration of the test.
      When checking for flakes in tests that have expensive dependencies that are set
      up in the test environment (subprocesses, external dependencies, etc) this can
      become expensive.
      
      To support finding flakes in tests that fit into this category, where the setup
      phase is expensive but each test case is fast, allow callers to specify via
      `--gtest_recreate_environments_when_repeating=false` that the test environments
      should only be set up once, for the first iteration, and only torn down once, on
      the last iteration. This makes running a test with `--gtest_repeat=1000` a much
      faster and more pleasant experience.
      
      PiperOrigin-RevId: 382748942
      4cfd1498
  2. 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
  3. 12 Nov, 2020 2 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 · 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
  4. 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
  5. 14 Oct, 2020 2 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
  6. 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
  7. 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
  8. 05 Aug, 2020 1 commit
  9. 02 Aug, 2020 1 commit
  10. 20 Jun, 2020 1 commit
  11. 05 May, 2020 1 commit
  12. 20 Apr, 2020 1 commit
  13. 04 Apr, 2020 1 commit
    • Abseil Team's avatar
      Googletest export · c344cb5a
      Abseil Team authored
      This change updates testing::internal::IsAProtocolMessage to return true not
      just for full proto messages but also for lite ones (i.e. those inheriting
      directly from MessageLite).
      
      PiperOrigin-RevId: 304286535
      c344cb5a
  14. 24 Mar, 2020 1 commit
    • Abseil Team's avatar
      Googletest export · 1ced315a
      Abseil Team authored
      Add --gtest_fail_fast support to googletest.
      
        - Analogous functionality to to golang -test.failfast and python --failfast
        - Stops test execution upon first test failure.
        - Also add support Bazel equivalent env var (TESTBRIDGE_TEST_RUNNER_FAIL_FAST)
      
      PiperOrigin-RevId: 302488880
      1ced315a
  15. 19 Mar, 2020 1 commit
  16. 16 Dec, 2019 1 commit
    • Shahbaz Youssefi's avatar
      Revert "Googletest export": disallow empty prefix · 1800a38f
      Shahbaz Youssefi authored
      This reverts commit 20b5b8ec.
      Reason for revert: Breaks existing applications, such as ANGLE
      (angleproject.org), requires adding an extra prefix that needs to be
      typed for no reason (when testing from command line) and increases the
      logs' sizes by a non-trivial amount due to the very large number of
      tests ANGLE runs.
      
      Original commit message:
      
          Add a compile time check to ensure that the parameters to TEST_P and
          INSTANTIATE_TEST_SUITE_P are not empty. Some compilers already fail
          in that case and, even where it works, it's likely to result in
          technically invalid code by virtue of creating reserved identifiers:
          https://en.cppreference.com/w/cpp/language/identifiers
      
      First, every project is perfectly capable of adding a prefix if they
      want to support such a compiler. This change penalizes every
      project.
      
      Second, using a prefix such as `_p` also results in reserved
      identifiers, so this change is not really solving the problem.  For that
      matter, instead of generating `gtest_##prefix##...`, you can generate
      `gtest_x##prefix##...` to correctly fix the issue, including when empty
      prefixes are used.
      1800a38f
  17. 06 Dec, 2019 1 commit
    • Abseil Team's avatar
      Googletest export · 9ed99c6c
      Abseil Team authored
      Change googletest to notice failures during SetUpTestSuite() and TearDownTestSuite().
      
      Previously, errors that occurred during those functions were logged but otherwise ignored. After this change, such failures will cause the test to fail and a brief summary will be printed at the bottom of the test log.
      
      See https://github.com/google/googletest/issues/2330.
      
      PiperOrigin-RevId: 284033342
      9ed99c6c
  18. 22 Nov, 2019 3 commits
  19. 30 Oct, 2019 1 commit
  20. 24 Oct, 2019 1 commit
  21. 11 Oct, 2019 2 commits
    • Robert Luberda's avatar
      Add more override keywords · 3cddd56e
      Robert Luberda authored
      Mark more functions with "override" keyword, just like
      it was done in commit 2460f971.
      
      This should prevent compiler from complaining while compiling both
      user code, and the googletest code itself with the -Wsuggest-override
      option turned on; with the exception of:
       * calls to new MOCK_METHOD() in test/gmock-function-mocker_test.cc
       * calls to old MOCK_METHODx()/MOCK_CONST_METHODx() in other
         unit test files.
      
      Closes #2493
      3cddd56e
    • Abseil Team's avatar
      Googletest export · ed78e54f
      Abseil Team authored
      Fix the O(n^2) number of instantiations in ElemFromList.
      It is now O(n). It still has O(1) instantiation depth.
      
      PiperOrigin-RevId: 273980821
      ed78e54f
  22. 10 Oct, 2019 1 commit
    • Abseil Team's avatar
      Googletest export · 20b5b8ec
      Abseil Team authored
      Add a compile time check to ensure that the parameters to TEST_P and INSTANTIATE_TEST_SUITE_P are not empty. Some compilers already fail in that case and, even where it works, it's likely to result in technically invalid code by virtue of creating reserved identifiers:
      https://en.cppreference.com/w/cpp/language/identifiers
      
      PiperOrigin-RevId: 273832263
      20b5b8ec
  23. 12 Sep, 2019 1 commit
  24. 06 Sep, 2019 1 commit
  25. 20 Aug, 2019 1 commit
  26. 13 Aug, 2019 2 commits
  27. 01 Aug, 2019 1 commit
  28. 30 Jul, 2019 1 commit
  29. 24 Apr, 2019 1 commit
    • Abseil Team's avatar
      Googletest export · 84d98653
      Abseil Team authored
      Add GTEST_FAIL_AT, an equivalent to ADD_FAILURE_AT but that
      spawns a fatal failure rather than a non-fatal, eg. the equivalent
      of an ASSERT* failure rather than an EXPECT* failure.
      
      PiperOrigin-RevId: 244746609
      84d98653
  30. 06 Apr, 2019 1 commit
    • Enji Cooper's avatar
      clang: fix `-Wsign-conversion` errors · 3829b84e
      Enji Cooper authored
      
      
      Cast some values as their unsigned equivalents or `size_t` to match the
      parameter type used for the template object under test. Also, provide
      UInt32 equivalent delegate methods for some callers (with
      int-equivalents for backwards compatibility).
      
      This closes #2146.
      Signed-off-by: default avatarEnji Cooper <yaneurabeya@gmail.com>
      3829b84e
  31. 01 Apr, 2019 1 commit
    • Abseil Team's avatar
      Googletest export · d9825431
      Abseil Team authored
      Remove support for "global" ::string and ::wstring types.
      This support existed for legacy codebases that existed from before namespaces
      where a thing. It is no longer necessary.
      
      PiperOrigin-RevId: 241335738
      d9825431
  32. 21 Mar, 2019 1 commit
    • Abseil Team's avatar
      Googletest export · f1883b18
      Abseil Team authored
      Remove mention of unused type ProtocolMessage.
      
      PiperOrigin-RevId: 239242706
      f1883b18
  33. 05 Mar, 2019 1 commit
    • Abseil Team's avatar
      Googletest export · 3dd2e841
      Abseil Team authored
      Fix emission of -Wzero-as-null-pointer-constant when comparing integers.
      
      The following code fails to compile:
      
      #pragma clang diagnostic error "-Wzero-as-null-pointer-constant"
      void foo() {
        EXPECT_EQ(0, 0);
      }
      
      This happens because gtest checks the first argument to EXPECT_EQ and
      ASSERT_EQ is a null pointer constant. The magic it does to do this causes the
      warning to be emitted.
      
      This patch removes that check. It replaces the explicit check with a Compare
      overload that can only be selected when 0 or nullptr is passed on the LHS
      with a pointer on the right.
      
      This patch does not suppress -Wzero-as-null-pointer-constant when users
      are actually using it as NULL.
      
      PiperOrigin-RevId: 236654634
      3dd2e841
  34. 11 Jan, 2019 1 commit
    • misterg's avatar
      Googletest export · 0599a7b8
      misterg authored
      Change tests to use new Test Suite API
      
      PiperOrigin-RevId: 228908894
      0599a7b8