summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3866 from eidosmontreal:simplify_shouldusecolorCopybara-Service2022-06-131-1/+2
|\ | | | | | | | | PiperOrigin-RevId: 454616721 Change-Id: I33b5671646ec027da48cc941baf84b4ddc722e07
| * Simplify ColoredPrintf to rely on ShouldUseColorGaspard Petit2022-05-301-1/+2
| | | | | | | | Use ShouldUseColor to set use_color instead of having a separate check for the windows mobile cases; these cases are now moved directly to `DoIsATTY`
* | Remove undefined internal function.Abseil Team2022-06-091-8/+0
|/ | | | | | | Fixes #3856 PiperOrigin-RevId: 453992227 Change-Id: I5f3330a454bdcd6b0522ebba4cdfe2c888f8e638
* 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
* 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
* Use RE2 for the regex implementation when building with Bazel and using AbseilDerek Mauro2022-04-261-28/+42
| | | | | | | | | | | | | | | | | | | 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
* Merge pull request #3797 from glandium:issue3514Copybara-Service2022-04-261-3/+4
|\ | | | | | | | | 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-229-95/+146
| | | | | | | | | | PiperOrigin-RevId: 443715444 Change-Id: I3ffd54b63d2728ae4a668ee7875c8c3c8188087c
* | Eliminate the legacy GTEST_COMPILE_ASSERT_ macroDerek Mauro2022-04-211-11/+0
|/ | | | | PiperOrigin-RevId: 443462203 Change-Id: I0c43f981663a7531ff5da4d4be01fb3d6762273d
* Use the Abseil flags library when Abseil is presentDerek Mauro2022-04-042-41/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Running clang-format over all of GoogleTestAbseil Team2022-03-1519-1057/+957
| | | | | | | | | | | | | | | | 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
* Remove references to deleted script gen_gtest_pred_impl.pyDino Radakovic2022-03-141-3/+0
| | | | | PiperOrigin-RevId: 434464892 Change-Id: Iaa2277f26d0049b3d792e87f64679774a28205c6
* GetCurrentOsStackTraceExceptTop (both the method of UnitTestImpl and the ↵Abseil Team2022-02-011-0/+14
| | | | | | | | | wrapper function in gtest.cc) rely on the fact that the inner call is not getting optimized. This CL annotates them with the appropriate attributes. PiperOrigin-RevId: 425663217 Change-Id: Ib9ec2a69a7dd98d37640b56d4d7798572da66669
* Factor out AssertionResult into dedicated gtest-assertion-result header + ↵Abseil Team2022-01-193-188/+237
| | | | | | | implementation files to prevent cyclic includes between gtest.h and gtest_pred_impl.h PiperOrigin-RevId: 422863083 Change-Id: I299018a860152216adc206780c32923c03bedb2a
* Consistently apply IWYU pragmas across googletest and googlemock headersAbseil Team2022-01-1819-18/+73
| | | | | PiperOrigin-RevId: 422559250 Change-Id: I9f630f2186724950e5e9fbd7093d5264e8bf0a71
* Merge pull request #3725 from bsilver8192:remove-another-disallow-assignCopybara-Service2022-01-111-15/+0
| | | | | PiperOrigin-RevId: 421044680 Change-Id: If585089811f1b67eab6f339125c27174ee5bc290
* Add NOLINT to address modernize-use-trailing-return-type in TEST_F usesAbseil Team2021-12-071-4/+8
| | | | | | | | | | | | | | | | | | Example command: ``` clang_tidy '--config={Checks: "modernize-use-trailing-return-type"}' googletest-death-test-test.cc ``` Example error: ``` warning: use a trailing return type for this function [modernize-use-trailing-return-type] TEST(NotADeathTest, Test) { ^ ``` PiperOrigin-RevId: 414836261 Change-Id: I5f758423667559abfbf313190543666bc4ce0e6e
* Googletest exportAbseil Team2021-11-091-0/+1
| | | | | | | | | | | | Add missing InitGoogleTest line in "Registering tests" example code Copying the original code gives the following error message """ IMPORTANT NOTICE - DO NOT IGNORE: This test program did NOT call testing::InitGoogleTest() before calling RUN_ALL_TESTS(). This is INVALID. Soon Google Test will start to enforce the valid usage. Please fix it ASAP, or IT WILL START TO FAIL. """ PiperOrigin-RevId: 408385714
* Googletest exportAbseil Team2021-11-091-0/+6
| | | | | | Add printer for std::type_info. PiperOrigin-RevId: 408375407
* Googletest exportAbseil Team2021-11-031-1/+1
| | | | | | | | Address unused variable warning in gtest.h Closes #3645 PiperOrigin-RevId: 407393922
* Merge pull request #3638 from limitedAtonement:3637-disabled-outputCJ Johnson2021-11-031-0/+4
|\ | | | | | | PiperOrigin-RevId: 407356792
| * Re #3637 Show Disabled Tests in testing outputrefs/pull/3638/headlmat2021-11-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Showing disabled tests is implemented by a new member function on the TestEventListener interface (which is responsible for printing testing output). The new function is called OnTestSkipped and it is invoked when a disabled test is encountered. The PrettyUnitTestResultPrinter has the canonical implementation of this new function. The BriefUnitTestResultPrinter and the EmptyTestEventListener get a nullary implementation. The JsonUnitTestResultPrinter and XmlUnitTestResultPrinter inherit that trivial implementation from the EmptyTestEventListener.
* | Googletest exportdmauro2021-11-031-9/+14
| | | | | | | | | | | | | | | | | | Guard #includes for threading related headers with GTEST_IS_THREADSAFE Some platforms that don't support threading give errors for including these headers PiperOrigin-RevId: 406133623
* | Googletest exportdmauro2021-11-031-15/+1
| | | | | | | | | | | | | | Remove GoogleTest's SleepMilliseconds function. It is only used in tests and a portable implementation is available. PiperOrigin-RevId: 405437102
* | Googletest exportdmauro2021-11-031-60/+35
|/ | | | | | | | | | Replace the multiple implementations of Notification with a single portable implementation. The also removes the awkward loop with sleep in Notification and will allow the removal of SleepMilliseconds. PiperOrigin-RevId: 405399733
* Googletest exportAbseil Team2021-10-131-0/+6
| | | | | | Add printer for __{u,}int128_t. PiperOrigin-RevId: 402417369
* Merge pull request #3581 from cclauss:codespelldinord2021-10-052-4/+4
|\ | | | | | | PiperOrigin-RevId: 400792845
| * Fix remaining typos discovered by codespellrefs/pull/3581/headChristian Clauss2021-09-242-4/+4
| |
* | Googletest exportAbseil Team2021-09-302-0/+10
|/ | | | | googletest: Add printer for {std,absl}::nullopt. PiperOrigin-RevId: 399928554
* Internal changeAbseil Team2021-07-291-6/+6
| | | | PiperOrigin-RevId: 387381497
* Googletest exportAbseil Team2021-07-2217-36/+0
| | | | | | Delete GOOGLETEST_CM.* tags from C++ code. PiperOrigin-RevId: 386268534
* Googletest exportAbseil Team2021-07-221-1/+1
| | | | | | Fix include guards in gen_pred_test.py PiperOrigin-RevId: 386052814
* Merge pull request #3472 from jwnimmer-tri:fix-dont-macrosCJ Johnson2021-07-221-3/+4
|\ | | | | | | PiperOrigin-RevId: 385627491
| * Fix location of GOOGLETEST_CM0011 markerrefs/pull/3472/headDerek Mauro2021-07-141-1/+1
| |
| * Use GTEST_DONT_DEFINE_TEST_F to guard TEST_FJeremy Nimmer2021-07-011-4/+5
| | | | | | | | | | | | | | | | | | | | | | The documentation is clear that the FOO we'll be guarding always matches the spelling of the DONT macro. A single guard macro should not toggle more than one implementation macro. This fixes a regression in 7413280c52c1f759395572a384165023d24eeb57. Relatedly, improve the documentation of the DONT macros to bring the list of valid FOO values up to date.
* | Googletest exportAbseil Team2021-07-075-26/+45
| | | | | | | | | | | | Introduce GTEST_FLAG_GET and GTEST_FLAG_SET macros. PiperOrigin-RevId: 382808313
* | Googletest exportAbseil Team2021-07-071-0/+6
|/ | | | | | | | | | | | | | | | | | | 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
* Fix EXPECT_DEATH() and ASSERT_DEATH() triggering -Wcovered-switch-defaultrefs/pull/3457/headAlex Karatarakis2021-06-231-2/+0
| | | | | | | | | | EXPECT_DEATH() and ASSERT_DEATH() have a switch case where every possible case is covered. This makes the default case unnecessary and triggers -Wcovered-switch-default. Due to these being macros, the lines are expanded in user code and are thus subject to warnings of the target codebase. Fixes #3456
* Merge pull request #3200 from ellert:port-to-GNU/HurdCJ Johnson2021-06-172-3/+8
|\ | | | | | | PiperOrigin-RevId: 379383941
| * Port to GNU/Hurdrefs/pull/3200/headMattias Ellert2020-12-302-3/+8
| |
* | Merge pull request #3183 from georgthegreat:patch-1CJ Johnson2021-06-171-1/+1
|\ \ | | | | | | | | | PiperOrigin-RevId: 378915968
| * | Use proper feature test macro to test if library supports char8_trefs/pull/3183/headYuriy Chernyshov2020-12-241-1/+1
| | | | | | | | | | | | | | | Reference is here: https://en.cppreference.com/w/cpp/feature_test This PR fixes the weird case of compiling with `clang++ -std=c++17 -fchar8_t`
* | | Merge pull request #3421 from florin-crisan:bugfix/3420-dll-link-failureDerek Mauro2021-06-082-4/+4
|\ \ \ | | | | | | | | | | | | PiperOrigin-RevId: 377367006
| * | | #3420 Declare MarkAsIgnored as a DLL exportrefs/pull/3421/headFlorin Crișan2021-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was causing the following linker error on Microsoft Visual C++ when compiling as a DLL: ``` googletest-param-test-test.cc.obj : error LNK2019: unresolved external symbol "public: __cdecl testing::internal::MarkAsIgnored::MarkAsIgnored(char const *)" (??0MarkAsIgnored@internal@testing@@QEAA@PEBD@Z) referenced in function "void __cdecl works_here::`dynamic initializer for 'gtest_allow_ignore_NotInstantiatedTest''(void)" (??__Egtest_allow_ignore_NotInstantiatedTest@works_here@@YAXXZ) ```
| * | | #3420 Properly declare all overloads of testing::internal::PrintTo as DLL ↵Florin Crișan2021-06-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | exports This was causing the following linker error on Microsoft Visual C++ when compiling as a DLL: ``` googletest-printers-test.cc.obj : error LNK2019: unresolved external symbol "void __cdecl testing::internal::PrintTo(char16_t const *,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?PrintTo@internal@testing@@YAXPEB_SPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: static void __cdecl testing::internal::UniversalPrinter<char16_t const *>::Print(char16_t const * const &,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?Print@?$UniversalPrinter@PEB_S@internal@testing@@SAXAEBQEB_SPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) googletest-printers-test.cc.obj : error LNK2019: unresolved external symbol "void __cdecl testing::internal::PrintTo(char32_t const *,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?PrintTo@internal@testing@@YAXPEB_UPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: static void __cdecl testing::internal::UniversalPrinter<char32_t const *>::Print(char32_t const * const &,class std::basic_ostream<char,struct std::char_traits<char> > *)" (?Print@?$UniversalPrinter@PEB_U@internal@testing@@SAXAEBQEB_UPEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) ```
* | | | Googletest exportdmauro2021-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix MSVC warning C4275: non dll-interface class 'testing::MatcherDescriberInterface' used as base for dll-interface class 'testing::internal::MatcherBase<std::string>' Fixes #3415 PiperOrigin-RevId: 377352684
* | | | Merge pull request #3393 from JC3:patch-1Derek Mauro2021-06-081-1/+1
|\ \ \ \ | |/ / / |/| | | | | | | PiperOrigin-RevId: 377289133
| * | | isalnum -> IsAlNum for correct handling of signed charsrefs/pull/3393/headJason C2021-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | I spotted this in https://github.com/assimp/assimp/pull/3880/commits/7dd7a053a91322fad88cdf958c6d0b3b7b91cb90 and figured I'd fix it here, too. If this is not the right thing to do, please lmk so I can undo it in assimp, too. Seems right, though. It's the only spot in gtest where a ctype call was made directly.
* | | | Googletest exportdurandal2021-05-131-15/+19
|/ / / | | | | | | | | | | | | | | | Add a note documenting that death test macros accept arbitrary gmock matchers against child-process stderr, not just regexes. PiperOrigin-RevId: 372365998