Commit Graph

1013 Commits

Author SHA1 Message Date
Abseil Team
5b7fd63d6d Export gmock-spec-builders.
gmock.h is the umbrella header to be used for rest of the library, and it also
enables users to export certain details. This wasn't working for some interfaces
like EXPECT_CALL because gmock-spec-builders wasn't explicitly exported.

PiperOrigin-RevId: 576966583
Change-Id: Ie050430cf11384977cd95f4ed6e73235d6857057
2023-10-26 13:15:23 -07:00
Dino Radakovic
518387203b StartsWith: Explicitly construct matcher-typed strings from matchee parameter
The current implementation breaks for absl::string_view on gcc, c++14: https://godbolt.org/z/Tzd3q1fqx

Closes #4391

PiperOrigin-RevId: 575853981
Change-Id: I7b782598add480eb69d4ca27ea4a4bf5f758f6a3
2023-10-23 10:11:36 -07:00
Dzmitry Ivaniuk
2d09ed35cf cmake: Fix comments in cmake files
Remove extra spaces. Fix so that the comment line starts with a capital letter and ends with a dot.
2023-09-29 17:26:23 +03:00
Copybara-Service
5bd0f08e0d Merge pull request #4374 from masbug:main
PiperOrigin-RevId: 568317621
Change-Id: Icf7fb519f96f5e88eb0df491eed143134c8ac6eb
2023-09-25 14:00:54 -07:00
Mitja Spes
e27b194c27 Fix compile warnings in gmock-function-mocker.h
Template type int changed to size_t.
This fixes compile warning `conversion to ‘long unsigned int’ from ‘int’ may change the sign of the result` in gmock-function-mocker.h.
2023-09-21 10:06:21 +02:00
Abseil Team
adc5145386 Update code with IWYU annotations.
PiperOrigin-RevId: 566424331
Change-Id: I0e16d979b9d79643c882c5082e154842983a5317
2023-09-18 15:04:08 -07:00
Copybara-Service
460ae98267 Merge pull request #4349 from sthd:httpToHttps
PiperOrigin-RevId: 559452348
Change-Id: I6f72001fd6b8e5a739c34121c8847c281d563b0f
2023-08-23 09:30:13 -07:00
sthd
f0eae4b399 changed http to https 2023-08-22 20:58:34 +03:00
Abseil Team
762d3a7f66 Clean up typos: Exhaused => Exhausted
PiperOrigin-RevId: 558801066
Change-Id: Ia225d12014748db87639414f4c8c28a0d0e9e489
2023-08-21 08:47:54 -07:00
Robert Shade
429432e341 Avoid unreachable code warning 2023-08-02 14:09:54 -04:00
Copybara-Service
c541e7c110 Merge pull request #4302 from ciband:feat/nrf52
PiperOrigin-RevId: 549006105
Change-Id: Ifbe2bf57e10df4c71e51dbfaf1687f4f621f5106
2023-07-18 08:16:57 -07:00
Chris Johnson
091d7eb897 add support for nrf52
Added support for Nordic nRF52 series of MCUs
2023-06-27 08:29:23 -05:00
Juan Ramos
812f35b26b cmake: Remove remaining checks for CMAKE_VERSION
Remove conditional code that doesn't need to exist anymore.
2023-06-20 19:09:04 -06:00
Copybara-Service
29836977ef Merge pull request #4288 from juan-lunarg:juan/cmake_min_3_dot_6
PiperOrigin-RevId: 541929012
Change-Id: I90423820611c2b6a6f81fe3f9ec2d23992ffbed1
2023-06-20 08:20:43 -07:00
Juan Ramos
4fed5f2850 cmake: Raise min to 3.6
From the CMake 3.27 release notes:
Compatibility with versions of CMake older than 3.5 is now
deprecated and will be removed from a future version. Calls to
cmake_minimum_required() or cmake_policy() that set the policy
version to an older value now issue a deprecation diagnostic.

This PR also removes manually setting policy CMP0048. This is
redundant since the CMake min is already 3.X
2023-06-19 11:21:44 -06:00
Copybara-Service
a3580180d1 Merge pull request #4146 from lygstate:fixes_std_pair_diff
PiperOrigin-RevId: 528781910
Change-Id: I4038332a6255921792bfb4a8098aa84243d48e15
2023-05-02 07:52:02 -07:00
Andy Soffer
76bce79a34
Merge branch 'main' into fixes_std_pair_diff 2023-05-01 14:27:38 -04:00
Dino Radakovic
797b0ad2a3 Use GTEST_INTERNAL_CPLUSPLUS_LANG instead of __cplusplus
Some versions of MSVC provide incorrect values for the latter and rely on _MSVC_LANG instead.
Fixes #4226.

PiperOrigin-RevId: 527919195
Change-Id: Ifcca4612074f5ebc5337094426866a187f79f90a
2023-04-28 10:16:07 -07:00
Tom Hughes
0bdaac5a14 Add qualifier to avoid argument dependent lookup
PiperOrigin-RevId: 527740306
Change-Id: I61308cc232c346d5ff8b0548d4c552a59633fffc
2023-04-27 18:17:59 -07:00
Patryk Gawroński
51eeae5a55 gmock: fix issue #4222
Rename 'Result' struct to 'NonMoveableStruct' in
gmock-spec-builders_test.cc in ExpectCallTest.NonMoveableType test
2023-04-25 01:45:26 +02:00
Tom Hughes
783d00fd19 Use '=default' to define trivial constructor/destructors
https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html

PiperOrigin-RevId: 526079054
Change-Id: Ia4db21e3e5f58b90de05d52fd94b291ed06d785d
2023-04-21 10:41:25 -07:00
Tom Hughes
baf182e006 Use the empty method to check for emptiness
PiperOrigin-RevId: 526046714
Change-Id: I6ad0deff2a7f6dfef75a643c95ad914c83b9ba38
2023-04-21 08:42:42 -07:00
Tom Hughes
a5308bb992 Add missing std includes
PiperOrigin-RevId: 525850646
Change-Id: I64387f5b933beb79cd05636dca81b7a75213383e
2023-04-20 14:29:09 -07:00
Copybara-Service
d25e625364 Merge pull request #4219 from jerylvaz:main
PiperOrigin-RevId: 524932412
Change-Id: Ie70282f7e82cb3b9442bd15bbe49bb9b00e56eb9
2023-04-17 13:23:38 -07:00
Jeryl Vaz
952560d3ec Suppress a clang-tidy warning in the MATCHER_P macro 2023-04-14 11:15:21 +02:00
Abseil Team
8fa9461cc2 Fix FunctionMocker compilation slowdown in 9d21db9e0a
The slowdown appears to be due to an implicit conversion of distinct (yet semantically identical) lambdas to `std::function`. Lifting out the lambdas into functors that don't get re-instantiated reduces compilation times by nearly half.

Fixes #4156

PiperOrigin-RevId: 523447948
Change-Id: Ib0ae0761a54d7b1f2b706b14b2858eedf47e2297
2023-04-11 10:55:11 -07:00
Derek Mauro
3656c2713e Fix redundant redeclaration warning
Fixes #4200

PiperOrigin-RevId: 520017094
Change-Id: Id707a1c0489edde083771ccd412d7035612474dc
2023-03-28 07:03:07 -07:00
Aaron Jacobs
5fce13091d gtest.cc: add a newline after a failure when there is no OS stack trace.
This makes the behavior consistent when GTEST_STACK_TRACE_DEPTH is set to zero
and not: there is always vertical whitespace separating failure messages.

PiperOrigin-RevId: 518744611
Change-Id: I5b4af40633849850660504c3f497a76601d4311d
2023-03-22 20:19:44 -07:00
Abseil Team
e9faae170f Internal Code Change
PiperOrigin-RevId: 518213370
Change-Id: I88d0acc195dadf8d03cd15c8534c721141db14ea
2023-03-21 02:36:37 -07:00
Abseil Team
471087fbfc Introduce std::make_unique and bool literals where possible
PiperOrigin-RevId: 517910526
Change-Id: I398704f4b2ca0a55c86a06ca8b47d34c8670ddd7
2023-03-20 02:43:48 -07:00
Abseil Team
391ce627de Internal Code Change
PiperOrigin-RevId: 515855852
Change-Id: I8016eefd45c36089e189bbd1ebbe9fdabe68255b
2023-03-11 02:48:36 -08:00
Lawrence Wolf-Sonkin
038e392ebd [gtest] Drop custom-rolled heterogeneous comparator functors in favor of C++ standard ones
* Standard heterogeneous comparator functors such as `std::equal_to<>` and `std::less<>` [have been available since C++14](https://en.cppreference.com/w/cpp/utility/functional/less_void)
* Now that [C++14 is the minimum supported version of C++ in Googletest](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md), let's delete these duplications of the standard library

PiperOrigin-RevId: 515743068
Change-Id: I1563a2f94039c3a6688429298555545a922f6d7e
2023-03-10 14:43:13 -08:00
Abseil Team
1a727c27aa Internal Code Change
PiperOrigin-RevId: 514678702
Change-Id: I5b0089d905152ccb85022be395ed340e42586234
2023-03-07 03:06:06 -08:00
Tom Hughes
dc10c3b5e5 Use "#ifdef" with public macros
This allows compilation with "-Wundef" (#3267).

PiperOrigin-RevId: 513944726
Change-Id: I1a3854bb2333d5dec6c0ff91ee1eddd9a766ab91
2023-03-06 07:15:44 -08:00
Tom Hughes
23142843f7 Use "#ifdef GTEST_OS_..." instead of "#if GTEST_OS_..."
This is compatible with compiling with "-Wundef" (#3267).

PiperOrigin-RevId: 513943378
Change-Id: I47cf5fabbb77be061c4483a0adc54511af6b191c
2023-03-06 07:14:21 -08:00
Abseil Team
cead3d57c9 Internal Code Change
PiperOrigin-RevId: 513770561
Change-Id: I82fbed177c6ba4e2e5b776ae3e0255c868e32e25
2023-03-03 02:25:22 -08:00
Yonggang Luo
6f1c4b3d7b Fixes the test gmock_output_test.py with MSVC
For MSVC, gmock_output_test.py output struct std::pair<int,bool>, for GCC, it's output
std::pair<int, bool>, it's not the same, my intention is getting these to be same by removing
struct  for MSVC's outptu, and strip redundant space for GCC.

As a by-product,
```
#ifdef _MSC_VER
#define ERROR_DESC "class std::runtime_error"
#else
#define ERROR_DESC "std::runtime_error"
#endif
```
can be simplified to

```
#define ERROR_DESC "std::runtime_error"
```

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
2023-03-01 00:13:32 +08:00
Abseil Team
7a7231c442 Fix link in ReportUninterestingCall message
This CL changes the link in the ReportUninterestingCall message from
.../gmock_cook_book.md#knowing-when-to-expect to
.../gmock_cook_book.md#knowing-when-to-expect-useoncall. This is necessary
following https://github.com/google/googletest/commit/31ff597.

PiperOrigin-RevId: 510138974
Change-Id: Ic98c84b07751d27dfc95eddbe7874f76d68b456f
2023-02-16 07:33:48 -08:00
Yonggang Luo
097f64e986 Revert "Fix gmock_output_test when using MSVC"
This reverts commit 0a3b403fe0.
2023-02-09 15:29:01 +08:00
Tom Hughes
0570e2d930 Remove GTEST_USES_PCRE references
Nothing defines GTEST_USES_PCRE anymore. It was only meant for
internal use, so nothing public should be relying on it:
https://github.com/google/googletest/issues/2735#issuecomment-644849438.

Found when compiling with "-Wundef".

Fixes #2735.

PiperOrigin-RevId: 507823660
Change-Id: Ie19e576ff01dc3b16381338578ece92adccfc09b
2023-02-07 10:38:08 -08:00
Martijn Vels
ee33b34bec Fix GTEST_HAS_ABSL define check for [-Werror=undef] compilations
PiperOrigin-RevId: 507788664
Change-Id: Ib8cfbf3102a38e210fdae8a548fd84f0723ccc10
2023-02-07 08:28:15 -08:00
Abseil Team
3d568bdda5 Add support for the alternative base64 encoding in RFC 4648 section 5 to WhenBase64Unescaped.
PiperOrigin-RevId: 507527786
Change-Id: Ie5e088b1814981f6c760d7e25418a430172705ec
2023-02-06 11:00:05 -08:00
Tom Hughes
ebedaa18c7 Fix include order
PiperOrigin-RevId: 506424617
Change-Id: If7f0beb92022589523db204a6b5cbe9249cebf62
2023-02-01 14:32:28 -08:00
Tom Hughes
394a8a568c Remove GMOCK_RENAME_MAIN
GMOCK_RENAME_MAIN appears unused.

PiperOrigin-RevId: 506387823
Change-Id: I732c1f64f9038991a5c9aea1f2ad6fff07622afa
2023-02-01 12:14:47 -08:00
Tom Hughes
0a3b403fe0 Fix gmock_output_test when using MSVC
std::pair is printed as "struct std::pair<int,bool>" when using MSVC
vs "std::pair<int,bool>" with other compilers. Switch to "std::tuple", which
is the same for all compilers.

See
https://learn.microsoft.com/en-us/cpp/standard-library/pair-structure
https://learn.microsoft.com/en-us/cpp/standard-library/tuple-class

PiperOrigin-RevId: 506340295
Change-Id: Ib4ce2f74d54888a4e4173f42da1b55cc5583f7d4
2023-02-01 09:33:23 -08:00
Tom Hughes
4fb7039fda Use GTEST_DISABLE_MSC_WARNINGS macros to disable warnings
Prior to this change we had a mixture of pragmas and
GTEST_DISABLE_MSC_WARNINGS; this change consolidates all instances
to use the macros.

PiperOrigin-RevId: 505786926
Change-Id: I2be8f6304387393995081af42ed32c2ad1bba5a7
2023-01-30 13:45:46 -08:00
Tom Hughes
f1c05d4544 Use explicit short to fix MSVC compiler warning
warning C4244: 'initializing': conversion from 'int' to 'short', possible
loss of data

PiperOrigin-RevId: 505774670
Change-Id: I3524040334a4b265bae12cfacdd2b615cbb1cfc8
2023-01-30 12:58:34 -08:00
Copybara-Service
e3dbee4b35 Merge pull request #4115 from SunBlack:codespell
PiperOrigin-RevId: 505740434
Change-Id: I963f6a6b667a030c87f211173f578f7c35733e68
2023-01-30 10:55:07 -08:00
Tom Hughes
137dcd18cc Remove pylint disable comments that no longer trigger warnings
PiperOrigin-RevId: 504633130
Change-Id: I3fdbc83975fea97aa53f7325d323adead0a30e24
2023-01-25 12:35:34 -08:00
Tom Hughes
d1ad27e0a4 Fix formatting in subset of Python files
These files were formatted with automated tools. The remaining Python
files require some manual fix ups, so they will be fixed separately.

PiperOrigin-RevId: 504579820
Change-Id: I3923bd414bffe3ded6163ec496cd09ace3951928
2023-01-25 09:14:26 -08:00