summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix internal filesAbseil Team2022-05-311-2/+2
| | | | | PiperOrigin-RevId: 452053766 Change-Id: I9498e8809f5e66e42cfa365199a5bbc41462a533
* gmock-spec-builders: remove the name for an unused parameter.Aaron Jacobs2022-05-301-7/+1
| | | | | | | | | | | This fixes unused parameter errors under both MSVC and clang (when `-Werror=unused-parameter` is used, as reported [here](https://github.com/google/googletest/commit/9d21db9e0a60a1ea61ec19331c9bc0dd33e907b1#r74769946)). Fixes #3858 PiperOrigin-RevId: 451907906 Change-Id: Ic07da19ea6a547eb1797fbbab19cd57cc2a83fe8
* gmock-spec-builders: add support for non-moveable types.Aaron Jacobs2022-05-272-242/+158
| | | | | | | | | Do this by ripping out the "untyped perform action" machinery, which isn't necessary: we can simply template the entry point on the result type, and use RAII to avoid the need to special case void. This makes it easier to understand the code and harder to introduce type-related undefined behavior, to boot. PiperOrigin-RevId: 451493451 Change-Id: I225305f83164752ca92f2916721972eafba33168
* Clarify that `this->` is needed to access members of type-parameterized tests.elixir2022-05-271-0/+4
| | | | | PiperOrigin-RevId: 451439108 Change-Id: I8929df21d53cbe6c42e38653e1bb0cac72fc36f9
* gmock-actions: properly support non-moveable results in `is_callable_r`.Aaron Jacobs2022-05-272-4/+79
| | | | | | | | | | | | | | | Previously this excluded callables that return non-moveable types. This is the same as the [libc++ std::is_invocable_r bug](https://github.com/llvm/llvm-project/issues/55346) fixed by [this commit](https://github.com/llvm/llvm-project/commit/c3a24882903d): it's wrong to use std::is_convertible for checking the return type, since (despite its name) that doesn't check the standard-defined notion of "implicitly convertible". Instead we must base the check on whether the source type can be used as an argument to a function that accepts the destination type. PiperOrigin-RevId: 451341205 Change-Id: I2530051312a0361ea7a2ce26993ae973c9242089
* gmock-spec-builders: move a method to the header.Aaron Jacobs2022-05-262-133/+134
| | | | | | | | In order to make the diff more readable in an upcoming commit that requires the method to be templated on the action's result type. PiperOrigin-RevId: 451157029 Change-Id: I57beb7544efccd0459efb3a1f039ea45cd7c7602
* Update GoogleTest documentation's spelling of "GoogleTest".Abseil Team2022-05-261-29/+29
| | | | | PiperOrigin-RevId: 451067898 Change-Id: I658ab92c4ea616736f0170ac4d1548bb15a944e2
* Clarify the pitfalls of EXPECT_THAT and highlight it's best practicesAbseil Team2022-05-241-3/+7
| | | | | PiperOrigin-RevId: 450721917 Change-Id: I34d63a65b7158975abd46a9a14cded75439e7e7f
* gmock-internal-utils.cc: Avoid implicit conversion from int to charDino Radakovic2022-05-171-1/+1
| | | | | | | Fixes #3832 PiperOrigin-RevId: 449158813 Change-Id: Ibe85239ab1f123097b2c1b61616c9d611e5b90d0
* gmock-actions: add support for move-only values to Return.Aaron Jacobs2022-05-132-29/+83
| | | | | | | | `Return(x)` can now be used directly with `WillOnce` (the only place it makes sense in the type system), without using `ByMove`. PiperOrigin-RevId: 448380066 Change-Id: Ia71cc60ccbc3b99720662731a2d309735a5ce7c8
* Add clarifying comments about when to use EXPECT_NONFATAL_FAILURE vs. ↵Abseil Team2022-05-121-4/+6
| | | | | | | EXPECT_FATAL_FAILURE. PiperOrigin-RevId: 448237839 Change-Id: Id6242f278912f8c47cf19e3ea8c061f8b18ba832
* gmock-actions: provide a const reference when converting in ReturnAction.Aaron Jacobs2022-05-122-47/+67
| | | | | | | | It doesn't make semantic sense for the conversion to modify the input, and the fact that it's allowed to do so appears to have just been a historical accident. PiperOrigin-RevId: 448135555 Change-Id: Id10f17af38cf3947ee25fe10654d97527173ebfc
* Do a consistent way of searching for a temporary directory.Abseil Team2022-05-111-25/+26
| | | | | | | | | | | | | | | | | | | | | | | | | The way temporary directories were discovered from environment variables in different operating systems was inconsistent. On Windows, only the system-specific environment variable TEMP was considered, but not the bazel-common TEST_TMPDIR. On Unix, only TEST_TMPDIR was considered, but not the otherwise typical system specific TMPDIR. Now, always consider TEST_TMPDIR first, followed by the system-typical environment variable (TEMP on Windows, TMPDIR on Unix) before falling back to a default on that particular system. Also: the value for the temporary directory coming from the environment variable was only checked for a trailing directory separator on Windows (and appended if needed), not on the other platforms. Make this also consistent accross the systems: Now always apply the same logic to all of these (to accomodate tests that just concatenate TempDir() without directory separator). PiperOrigin-RevId: 447909830 Change-Id: I9ea17acdf5944eb2a965615fd9cf142878c33a58
* gmock-actions: simplify Return and add better documentation.Aaron Jacobs2022-05-113-93/+192
| | | | | | | | | | Better document requirements, API decisions, and historical accidents. Make an implicit conversion easier and in a more appropriate place, and ease the burden of some assertions in the conversion operator. Stop using the legacy ActionInterface style for defining the action. PiperOrigin-RevId: 447894892 Change-Id: I179e23ec2abdd9bf05c204ab18dbb492f1372e8e
* gmock-actions: make OnceAction public.Aaron Jacobs2022-05-113-20/+59
| | | | | | | | So that it can be referenced in conversion operators for actions that need to know the concrete return type. PiperOrigin-RevId: 447889344 Change-Id: I643d3298bc8effd08741282a956c221f9d67d378
* Fixup some missing overrides in googletest.Abseil Team2022-05-101-2/+2
| | | | | | | | | This CL adds a couple missing overrides in the googletest sources. These were found downstream when -Wsuggest-override and -Wsuggest-destructor-override were enabled. PiperOrigin-RevId: 447754883 Change-Id: I7bf35a8757cbc5ae157827037aa3d13f47392406
* Merge pull request #3818 from joshiayush:typoCopybara-Service2022-05-061-3/+3
|\ | | | | | | | | PiperOrigin-RevId: 447003874 Change-Id: Ide8d879f6c939dbf4c10cc6d515c175d9b691e0c
| * Fix typo in the test name of `NormalizeTest`refs/pull/3818/headAyush Joshi2022-04-301-3/+3
| | | | | | | | Signed-off-by: Ayush Joshi <ayush854032@gmail.com>
* | Fix example of DescribeMatcher to properly support negation.Abseil Team2022-05-031-1/+2
| | | | | | | | | | PiperOrigin-RevId: 446259163 Change-Id: I3ad5f405f44fc233f5cf5a18a274a9104b5c4ab8
* | Use TEST_TMPDIR on MacOS as well if available.Abseil Team2022-05-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently MacOS falls back to generic /tmp, but for all intents and purposes it should behave like other Unixes using the TEST_TMPDIR environment variable if available (this environment variable is set in bazel, which sets up a unique temp directory for the test process). While at it, remove an incorrect #endif comment, that looks like a leftover from some older implementation. PiperOrigin-RevId: 446108391 Change-Id: I118eacf6e86a41d26cb81a130f7c54cccc0c5665
* | gmock-actions: remove a no-longer-necessary friend declaration.Aaron Jacobs2022-05-021-6/+0
| | | | | | | | | | PiperOrigin-RevId: 445940487 Change-Id: I26952a72327db0d308bbe57ca4d1d91a0d7defc8
* | gmock-actions: support ByMove in a specialization of ReturnAction.Aaron Jacobs2022-05-021-25/+34
|/ | | | | | | | | | | | | Rather than branching on whether the return type is ByMoveWrapper within ReturnAction itself, hoist the distinction to outside. This allows the main class template to be modified without worrying about this special case, which means we can stop using a shared pointer to the value (introduced as a linked_ptr in commit 3d1c78b2bf to support ByMove) in this commit and simplify the class template further in a future commit with the eventual aim of directly supporting move-only result types. PiperOrigin-RevId: 445938943 Change-Id: I7bc71ea301d5e493ac6ecbe57d62738a48a2721a
* Rewrite "Testing a Certain Property of an Object" as "Defining a Custom ↵Abseil Team2022-04-281-17/+22
| | | | | | | Matcher Class", and fix the code examples. PiperOrigin-RevId: 445252626 Change-Id: I9f038cb669d3da6743606343c2341fc59725d722
* gmock-actions: improve comments and tests for the implicit cast in Return.Aaron Jacobs2022-04-272-7/+39
| | | | | | | | | | Commit a070cbd91c added an implicit cast to this path but didn't leave a very clear explanation for why it was desirable, a clear example, or even test coverage. Add a better comment and a test that fails when the implicit cast is removed. PiperOrigin-RevId: 444871311 Change-Id: I127982fa8d5bce9b6d1b68177c12dc0709449164
* Support move-only and &&-qualified actions in WithArgs.Aaron Jacobs2022-04-262-9/+73
| | | | | PiperOrigin-RevId: 444671005 Change-Id: I7df5f038caf17afb60d4fb35434ff0b656d4c954
* Use RE2 for the regex implementation when building with Bazel and using AbseilDerek Mauro2022-04-264-38/+71
| | | | | | | | | | | | | | | | | | | bazel build --define=absl=1 ... A dependency on RE2 is now required when building GoogleTest with Abseil. Using RE2 will provide a consistent cross-platform regex experience. Users will need to add the com_googlesource_code_re2, bazel_skylib, and platforms repository to their WORKSPACE files. See our WORKSPACE file in the root directory of this project for an example of how to add the dependencies. Please note that the com_googlesource_code_re2 dependency must use a commit from the `abseil` branch of the project: https://github.com/google/re2/tree/abseil PiperOrigin-RevId: 444650118 Change-Id: I45c55b26684c0c50d721a05b81c5f8a0c092400f
* Generalize gmock-matchers_test to handle is_gtest_matcher-style matchers, too.Abseil Team2022-04-265-50/+144
| | | | | PiperOrigin-RevId: 444586594 Change-Id: I0de9b40b3773e3047a492f050266967ea935ae3e
* Support move-only and &&-qualified actions in DoAll.Aaron Jacobs2022-04-263-258/+480
| | | | | | | | This is necessary for generic support of these actions, since `DoAll` is a frequently-used action wrapper. PiperOrigin-RevId: 444561964 Change-Id: I02edb55e35ab4207fbd71e371255a319c8253136
* Merge pull request #3797 from glandium:issue3514Copybara-Service2022-04-262-3/+7
|\ | | | | | | | | PiperOrigin-RevId: 444444700 Change-Id: I8ac5cc96cc6eb9d583fa7e3fb304ef3dcaa95b5b
| * Always initialize fields in MatcherBase constructorsrefs/pull/3797/headMike Hommey2022-04-201-3/+4
| | | | | | | | | | | | This fixes -Wuninitialized warnings with GCC. Fixes #3514.
* | Remove the legacy internal GTEST_DISALLOW_* macrosDerek Mauro2022-04-2232-159/+290
| | | | | | | | | | PiperOrigin-RevId: 443715444 Change-Id: I3ffd54b63d2728ae4a668ee7875c8c3c8188087c
* | Eliminate the legacy GTEST_COMPILE_ASSERT_ macroDerek Mauro2022-04-214-55/+39
|/ | | | | PiperOrigin-RevId: 443462203 Change-Id: I0c43f981663a7531ff5da4d4be01fb3d6762273d
* Merge pull request #3791 from MR-A0101:patch-1Copybara-Service2022-04-181-2/+2
|\ | | | | | | | | PiperOrigin-RevId: 442609985 Change-Id: I4239171ef8a671ef6d548ba94e02104c5f0ecd36
| * Removing commas.refs/pull/3791/headMR-A2022-04-061-2/+2
| | | | | | Readme Update!
* | Document two surprises in `DoAllAction::NonFinalType`.Aaron Jacobs2022-04-132-0/+128
| | | | | | | | | | PiperOrigin-RevId: 441589196 Change-Id: Ic3e483ca70d72261046bad464d817f9dfd4bec65
* | Replace infinite recursion call (intentionally invoking undefined behavior ↵Abseil Team2022-04-131-3/+6
| | | | | | | | | | | | | | to indicate unreachability) with explicit unreachability marker. PiperOrigin-RevId: 441474979 Change-Id: I1fcbb437026631212fec954c663482bb7e1cf819
* | Add support for move-only and &&-qualified actions in WillOnce.Abseil Team2022-04-094-35/+584
|/ | | | | | | | | | | | This provides a type-safe way for an action to express that it wants to be called only once, or to capture move-only objects. It is a generalization of the type system-evading hack in ByMove, with the improvement that it works for _any_ action (including user-defined ones), and correctly expresses that the action can only be used with WillOnce. I'll make existing actions benefit in a future commit. PiperOrigin-RevId: 440496139 Change-Id: I4145d191cca5655995ef41360bb126c123cb41d3
* Clarify what live-at-head actually meansDerek Mauro2022-04-061-1/+2
| | | | | PiperOrigin-RevId: 439835271 Change-Id: I40765e607a96dfc3f0679450938daf25163c48a4
* Trying to make it more clear: this is probably not about mock classes, but ↵Abseil Team2022-04-041-6/+6
| | | | | | | about mocked classes PiperOrigin-RevId: 439427291 Change-Id: I3cac035e732fb3fe4f9c314657932a55269e0416
* gmock: improve SFINAE for actions involving arguments.Abseil Team2022-04-042-2/+4
| | | | | | | | Avoid instantiating functions like std::get<index> for an out of range index when doing SFINAE on the invocability of the action itself. PiperOrigin-RevId: 439415110 Change-Id: Ifc20285a6d526c34830870cd1910c2b2b92e1e81
* Use ResultOf()'s result_description when explaining match result.Abseil Team2022-04-042-1/+16
| | | | | PiperOrigin-RevId: 439389646 Change-Id: Ie34adcdd2b24378e85962efac53b7bb89ed93803
* Use the Abseil flags library when Abseil is presentDerek Mauro2022-04-049-113/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | When built with `--define=absl=1` under Bazel, GoogleTest flags use ABSL_FLAG instead of GoogleTest's own implementation. There are some minor behavior differences in this mode. The most notable difference is that unrecognized flags result in a flag parsing error, and are not returned to the user though a modified argc/argv, unless they appear after the positional argument delimiter ("--"). For example, to pass a non-Abseil flag, you would have to do ./mytest --gtest_color=false -- --myflag=myvalue The documentation at https://abseil.io/docs/cpp/guides/flags may be helpful in understanding the behavior. There are some other minor differences. For example, passing --help results in the program returning 1 instead of 0. https://github.com/google/googletest/issues/3646 PiperOrigin-RevId: 439312700 Change-Id: Id696a25f50f24a5b1785c45ca8fa59794f86fd5c
* Address deprecation warning surfaced by Github presubmit testsAbseil Team2022-03-231-4/+4
| | | | | PiperOrigin-RevId: 436839469 Change-Id: I2bb90dce524c16bcc31569bb98772dcc62d08fbf
* Split gmock-matchers_test into 4 smaller test #3653Mattias Ellert2022-03-239-8645/+8857
| | | | | | | | | The one large test does not link in limited memory environments Closes #3653 PiperOrigin-RevId: 436753193 Change-Id: Idd59b6509994fc642147b88279ee791cd1d7bdd0
* Merge pull request #3779 from messerb5467:promote-inclusive-behaviorCopybara-Service2022-03-224-4/+4
|\ | | | | | | | | PiperOrigin-RevId: 436579789 Change-Id: I19faae341027efba83f1c2b3839636fc95780fc7
| * Merge branch 'main' into promote-inclusive-behaviorrefs/pull/3779/headBrad Messer2022-03-18135-7135/+5943
| |\
| * | Remove sanity as it is offensive to neurodiverse individuals.Brad Messer2022-03-184-4/+4
| | |
* | | Only print disabled test banner if the test matches gtest_filterAbseil Team2022-03-222-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | Currently, the "[ DISABLED ]" banner is printed for every test in a suite. When iterating on a single test gtest_filter this is very noisy. PiperOrigin-RevId: 436489088 Change-Id: If337087a7a0986b073fabf2b0a55d26485eb5c37
* | | Clarify public access on gmock examples.Abseil Team2022-03-211-4/+4
| |/ |/| | | | | | | PiperOrigin-RevId: 436268062 Change-Id: I3161b36121f78acf920d66fe121b2f1d5e5707b9
* | Running clang-format over all of GoogleTestAbseil Team2022-03-15126-7092/+5808
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few tests are examining code locations and looking af the resulting line numbers to verify that GoogleTest shows those to users correctly. Some of those locations change when clang-format is run. For those locations, I've wrapped portions in: // clang-format off ... // clang-format on There may be other locations that are currently not tickled by running clang-format. PiperOrigin-RevId: 434844712 Change-Id: I3a9f0a6f39eff741c576b6de389bef9b1d11139d