Commit Graph

976 Commits

Author SHA1 Message Date
Abseil Team
cead3d57c9 Internal Code Change
PiperOrigin-RevId: 513770561
Change-Id: I82fbed177c6ba4e2e5b776ae3e0255c868e32e25
2023-03-03 02:25:22 -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
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
Tom Hughes
2491710524 Fix formatting of C++ files
PiperOrigin-RevId: 504325204
Change-Id: Iaa1d6d0ab1dccaaeef26f9cb109d530835499240
2023-01-24 11:10:09 -08:00
Derek Mauro
544c96ed5b Remove FloatingPoint::Max() in favor of std::numeric_limits::max()
In #4113 a user says Max clashes with a macro. Since it is only used in
a test, use std::numeric_limits::max() instead.

Note that in headers, the macro issue can be mitigated with
parenthesis like this: `(std::numeric_limits<T>::max)()`

PiperOrigin-RevId: 504284906
Change-Id: Ibf430caec1a6afdf6b303534fec6a4fd00a6373f
2023-01-24 08:41:35 -08:00
Tom Hughes
bdb3b0a493 Replace deprecated python calls
assert_ -> assertTrue/assertFalse/assertIn/assertNotIn
assertEquals -> assertEqual

PiperOrigin-RevId: 502654909
Change-Id: I25d30095a83c3806606cb80d676b3c979495e6bd
2023-01-17 12:16:29 -08:00
Abseil Team
ac7a126f39 gmock_output_test: normalize golden file output to unix line endings
When checked out on Windows, the repo might use \r\n line endings,
and so the golden output has them.  Adjust for that.

PiperOrigin-RevId: 502577222
Change-Id: Iabfe537f6d95a49bf6bdcb934e855d28c65f6f89
2023-01-17 07:12:50 -08:00
Tom Hughes
356fc30125 Fix -Wshadow warnings
../googlemock/test/gmock-actions_test.cc:687:36: warning: declaration of ‘v’ shadows a member of ‘testing::{anonymous}::ReturnTest_SupportsReferenceLikeReturnType_Test::TestBody()::Result’ [-Wshadow]
  687 |     Result(const std::vector<int>& v) : v(&v) {}  // NOLINT
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^
../googlemock/test/gmock-actions_test.cc:686:29: note: shadowed declaration is here
  686 |     const std::vector<int>* v;
      |                             ^

../googlemock/test/gmock-actions_test.cc: In constructor ‘testing::{anonymous}::ReturnTest_PrefersConversionOperator_Test::TestBody()::Out::Out(int)’:
../googlemock/test/gmock-actions_test.cc:720:28: warning: declaration of ‘x’ shadows a member of ‘testing::{anonymous}::ReturnTest_PrefersConversionOperator_Test::TestBody()::Out’ [-Wshadow]
  720 |     explicit Out(const int x) : x(x) {}
      |                  ~~~~~~~~~~^
../googlemock/test/gmock-actions_test.cc:718:9: note: shadowed declaration is here
  718 |     int x;
      |         ^

PiperOrigin-RevId: 501580618
Change-Id: I584710fbbe440ec724f88746e51f3be5653c32d5
2023-01-12 09:04:13 -08:00
Tom Hughes
e5e46b09a1 IWYU: Add missing std includes
PiperOrigin-RevId: 499893032
Change-Id: I33304802b7c82ae2d008f3ee89df38866e5f57ba
2023-01-05 08:44:01 -08:00
SunBlack
64e0945546 Fix typos found by codespell 2023-01-04 17:36:11 +01:00
Abseil Team
3fa7f983c6 Shut up a Clang warning.
Clang warns on this pattern because it looks like the author might
have meant to use the value of the first part of the comma operator,
so it warns that it isn't being used. The cast here signals to Clang
that this behavior is intentional.

This was discovered while updating gmock in Android. Clang's -Wcomma
warning is on by default with either -Wall or -Werror, so users of
gmock with those on in combination with -Werror are unable to build
without this fix.

PiperOrigin-RevId: 495655990
Change-Id: Iaf27e2199669f5b6185a877738234e551b6b6556
2022-12-15 11:50:51 -08:00
Abseil Team
ad54e90f57 Refactor matrix verification into VerifyMatchMatrix.
PiperOrigin-RevId: 494786543
Change-Id: I7769558dd2ca046d8957bf352dc04cfb48ff7c3a
2022-12-12 11:51:48 -08:00
Abseil Team
1f643f71d4 Make SizeIsMatcher::Impl conform to the contract of MatcherDescriberInterface.
MatcherDescriberInterface specifies that DescribeTo "should print a verb phrase", but "size ..." is not a verb phrase. Currently, ElementsAre(SizeIs(9)) is described as "has 1 element that size is equal to 9". With this change, it will be described as "has 1 element that has a size that is equal to 9".

PiperOrigin-RevId: 492022324
Change-Id: I4083335f2419462464957521c1e033643b53b763
2022-11-30 14:42:31 -08:00
Abseil Team
a16bfcfda1 Disables -Wunused-member-function and -Wused-but-marked-unused that trigger via MOCK_METHOD() and EXPECT_THAT() macros.
Fixes: #4052, #4055
PiperOrigin-RevId: 491647393
Change-Id: I8e2ad838156fa8c7e9dccd1740af797e694992b6
2022-11-29 08:44:15 -08:00
Abseil Team
6b63c98ac4 Remove incorrect GTEST_ATTRIBUTE_UNUSED_ from InSequence class.
Fixes: #4048
PiperOrigin-RevId: 486951561
Change-Id: I4fae101b5ac5ed4f46c32aba8c36519e1f784db1
2022-11-08 07:58:14 -08:00
Copybara-Service
3026483ae5 Merge pull request #4041 from zloylos:allow-naming-expectations
PiperOrigin-RevId: 483683590
Change-Id: Id22de3a22018324e5c1e21e262ac5e027a83bf3e
2022-10-25 08:39:19 -07:00
Denis Hananein
09e1c64f86 Fix format without expectation name
Signed-off-by: Denis Hananein <i@zloylos.me>
2022-10-21 15:37:38 +02:00
Denis Hananein
0d26378919 Change messages
Signed-off-by: Denis Hananein <i@zloylos.me>
2022-10-21 14:03:45 +02:00
Denis Hananein
f3eb2b7e38 Allow naming expectations #3970
Signed-off-by: Denis Hananein <i@zloylos.me>
2022-10-20 23:13:06 +02:00
Abseil Team
d29b143bda Workaround for Visual C++ error C2039 with std::tuple_element_t.
Fixes #3931

PiperOrigin-RevId: 480659507
Change-Id: I6fabef63b1285189a06375227273d9de2456e37a
2022-10-12 10:31:07 -07:00
Marat Dukhan
7a3abfec0a Port GoogleTest to QuRT (Hexagon RTOS) 2022-09-26 14:49:00 -07:00
Abseil Team
0f6885405c Remove obsolete MSVC warning pragmas for Invalid<T>()
Remove the MSVC pragmas for disabling warning C4717 (infinite recursion) for
Invalid<T>() because that warning has been fixed in cl/441474979.

PiperOrigin-RevId: 473012585
Change-Id: I5f1bf88379bd4f2bf005e029c04766ac4caadd84
2022-09-08 09:42:31 -07:00
Abseil Team
0e0d9feefa Fixed header guards to match style guide conventions.
PiperOrigin-RevId: 471524660
Change-Id: Ie11e6a7a5a5497f64d5b9c382f1017094e043093
2022-09-01 07:25:03 -07:00
Copybara-Service
9080381758 Merge pull request #3916 from asmodai27:main
PiperOrigin-RevId: 471062949
Change-Id: I3f063c441b3d4275d931016c431519c14e68d51c
2022-08-30 12:40:01 -07:00
Hardik Vala
25cc5777a1 Add support of 19-member structs to gmock UnpackStructImpl.
PiperOrigin-RevId: 469171380
Change-Id: Ic75fc0523924e40e620552d4c04b79dad22a68e0
2022-08-22 06:42:57 -07:00
Copybara-Service
6045bf2ade Merge pull request #3918 from assafpr:master2main
PiperOrigin-RevId: 464586117
Change-Id: Icda62f13b962f7408bb5698ae2b627391257d152
2022-08-01 11:47:51 -07:00
Abseil Team
dd7a9d29a3 Add support of 18-member structs to gmock UnpackStructImpl.
PiperOrigin-RevId: 463961734
Change-Id: Ib62e320a745c190955f181c1f4f12e4cd407ef22
2022-07-28 17:15:30 -07:00
Dino Radakovic
b1e9b6323a Add IsEmpty overload for C-style strings
Fixes #3937

PiperOrigin-RevId: 463180144
Change-Id: I21b528acc4c3f3aba4234642be01fcead7fe7f00
2022-07-25 14:38:26 -07:00
Copybara-Service
91480a4e79 Merge pull request #3927 from yutotnh:fix-typo
PiperOrigin-RevId: 461699509
Change-Id: I9bab4474c5f52d4d66691dfb96a4d20f89fbcfeb
2022-07-18 13:29:19 -07:00
Copybara-Service
bea621c3c3 Merge pull request #3928 from venik:venik-clean-up
PiperOrigin-RevId: 460455562
Change-Id: I29efc09887651d8734586703fe0691482ba4c981
2022-07-12 07:19:18 -07:00
Alexander Nikforov
7107c44188 cleanup from unique_ptr branch 2022-07-01 15:33:13 -07:00
yutotnh
6c57d607c7
fix: typo in test name 2022-07-01 18:33:00 +09:00
yutotnh
2cf9987ce3
fix: some typos in comment 2022-07-01 18:32:49 +09:00
Abseil Team
d9335595b4 Add support of 17-member structs to gmock UnpackStructImpl.
PiperOrigin-RevId: 458018249
Change-Id: I7df8f75ef5b5a6478e7301f959c221810ff9f0b3
2022-06-29 11:10:54 -07:00
Abseil Team
9406a60c78 Mark internal-only function as having internal linkage.
PiperOrigin-RevId: 457550818
Change-Id: I9046801b64ce4581d742d650451332fd56489632
2022-06-27 13:16:09 -07:00
assafpr
d0af91ead3
Update gmock-matchers.h
branch master changed to main on link
2022-06-27 09:56:59 +03:00
assafpr
1547c2acc8
Update gmock-actions.h
master branch changed to main in links
2022-06-27 09:55:28 +03:00
assafpr
66d2463610
Update gmock-spec-builders_test.cc
master branch changed to main in link
2022-06-27 09:53:40 +03:00
assafpr
dfa990f942
Update gmock-spec-builders.cc 2022-06-27 09:50:36 +03:00
Jérôme Travert
72901486ba
Avoid implicit conversion from int to char 2022-06-26 18:59:46 +02:00