summaryrefslogtreecommitdiffstats
path: root/googletest/src/gtest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Allow clients to un-suppress output from gUnit EXPECT_EXIT tests.Abseil Team2023-06-151-3/+3
| | | | | | | | This is useful for running individual tests in a separate process, which is useful for testing e.g. flag changes which have a process-global effect. PiperOrigin-RevId: 540580573 Change-Id: I18a5d24d79425a9d595be3369efc44e2f655f6f8
* Skip entire test suite with `GTEST_SKIP()` in `SetUpTestSuite`Dino Radakovic2023-06-141-1/+2
| | | | | | | Fixes #4273 PiperOrigin-RevId: 540254167 Change-Id: I2555740d10284223539035bf73f88554fcf73f8a
* Use Abseil Flag public API for flag parsing.Abseil Team2023-04-261-15/+54
| | | | | | | This change brings InitGoogleTest semantic in accordance with the official documentation: only GoogleTest flags are removed from argc/argv. The rest of the flags remains in place. We do nothing special for flags with unrecognized gunit_/gtest_ prefix and we do not report them. PiperOrigin-RevId: 527257221 Change-Id: Ibb29a1bda1a44251a4ee579c0fb5bbdfd9965c21
* Use '=default' to define trivial constructor/destructorsrefs/pull/4221/headTom Hughes2023-04-211-4/+4
| | | | | | | https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html PiperOrigin-RevId: 526079054 Change-Id: Ia4db21e3e5f58b90de05d52fd94b291ed06d785d
* Add missing std includesTom Hughes2023-04-201-0/+3
| | | | | PiperOrigin-RevId: 525850646 Change-Id: I64387f5b933beb79cd05636dca81b7a75213383e
* Make parameter names in function declaration match the names in theTom Hughes2023-04-201-10/+10
| | | | | | | | | definitions https://clang.llvm.org/extra/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.html PiperOrigin-RevId: 525752102 Change-Id: Ibf9d3d1dbae8f95cfc7c6ad29fe4b677f4ee19cf
* gtest.cc: run tests within a test suite in a deterministic order.Abseil Team2023-04-051-0/+20
| | | | | | | | | Ensure that tests are run in the order specified in the source code, even if they are registered manually using RegisterTest. There should be no behavior change for the common case. PiperOrigin-RevId: 522136303 Change-Id: If155e2666780af0e514fbbf5ff2b157d5fe2fef1
* Rolled back due to breaking existing tests.Abseil Team2023-04-031-20/+0
| | | | | PiperOrigin-RevId: 521555658 Change-Id: I09742faceb82b2b7ceb423e850a8b50d532ad6ff
* gtest.cc: run tests within a test suite in a deterministic order.Aaron Jacobs2023-03-301-0/+20
| | | | | | | | | Ensure that tests are run in the order specified in the source code, even if they are registered manually using RegisterTest. There should be no behavior change for the common case. PiperOrigin-RevId: 520729483 Change-Id: I400c78400c6929fccae0676214d993251f31888f
* Internal Code ChangeAbseil Team2023-03-231-6/+5
| | | | | PiperOrigin-RevId: 518810140 Change-Id: Id3f9471f827894761080bc9199b0a092dc829b5f
* gtest.cc: add a newline after a failure when there is no OS stack trace.Aaron Jacobs2023-03-231-0/+2
| | | | | | | | 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
* Remove GTEST_FOR_GOOGLE_ macroTom Hughes2023-03-061-4/+0
| | | | | | | | The "more details" warning message printed by this macro is no longer needed. PiperOrigin-RevId: 513945729 Change-Id: I644910216dbef2fe92eee3a648f2078e705cc7a1
* Replace "#if GTEST_HAS_ABSL" with "#ifdef GTEST_HAS_ABSL"Tom Hughes2023-03-061-6/+6
| | | | | | | This allows compilation with "-Wundef" (#3267). PiperOrigin-RevId: 513945230 Change-Id: I45ef19c7ff3d20e97216bd031d406a03365471da
* Use "#ifdef" with public macrosTom Hughes2023-03-061-6/+6
| | | | | | | This allows compilation with "-Wundef" (#3267). PiperOrigin-RevId: 513944726 Change-Id: I1a3854bb2333d5dec6c0ff91ee1eddd9a766ab91
* Use "#ifdef GTEST_OS_..." instead of "#if GTEST_OS_..."Tom Hughes2023-03-061-31/+36
| | | | | | | This is compatible with compiling with "-Wundef" (#3267). PiperOrigin-RevId: 513943378 Change-Id: I47cf5fabbb77be061c4483a0adc54511af6b191c
* Eliminate argv list action parameter.Abseil Team2023-02-281-2/+1
| | | | | PiperOrigin-RevId: 512791992 Change-Id: Ie7fc37ea06ea7d9f595268c9ec84a0e144c297bb
* Merge pull request #4164 from sergio-nsk:patch-2Copybara-Service2023-02-271-0/+4
|\ | | | | | | | | PiperOrigin-RevId: 512753220 Change-Id: I3f7ad6c62c738d1d7405c50924b36deac8a9ac85
| * Fix error in_death_test_child_process: undeclared identifierrefs/pull/4164/headSergey2023-02-211-0/+3
|/ | | The error occurs if !GTEST_HAS_DEATH_TEST on Windows.
* Remove some filesystem APIs and tests under !GTEST_HAS_FILE_SYSTEMAbseil Team2023-02-141-1/+6
| | | | | PiperOrigin-RevId: 509537606 Change-Id: I68f7054e34b1fe76c1fd85099fffa4ee3c2b00c0
* Fix -Wsign-conversion warningsTom Hughes2023-02-021-5/+0
| | | | | | | | | | | | | | | | | | | | | | googletest/test/gtest_xml_outfile2_test_.cc:48:39: warning: implicit conversion turns floating-point number into integer: 'float' to 'int64_t' (aka 'long') [-Wfloat-conversion] RecordProperty("TestFloatProperty", float_prop); ~~~~~~~~~~~~~~ ^~~~~~~~~~ googletest/test/gtest_xml_outfile2_test_.cc:51:40: warning: implicit conversion turns floating-point number into integer: 'double' to 'int64_t' (aka 'long') [-Wfloat-conversion] RecordProperty("TestDoubleProperty", double_prop); ~~~~~~~~~~~~~~ ^~~~~~~~~~~ googletest/test/gtest_xml_outfile2_test_.cc:57:39: warning: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'int64_t' (aka 'long') [-Wsign-conversion] RecordProperty("TestSizetProperty", size_t_prop); ~~~~~~~~~~~~~~ ^~~~~~~~~~~ PiperOrigin-RevId: 506644143 Change-Id: I9c2cd5f52daebe25e73bb97f696687797ed2cabf
* Add a trailing decimal point to FormatTimeInMillisAsSeconds() output when inputAbseil Team2023-02-021-0/+8
| | | | | | | is an exact N seconds. PiperOrigin-RevId: 506610898 Change-Id: Idcd705c719e0e721148c350c8a14f27b9eb5c4f7
* Fix formatting of C++ filesTom Hughes2023-01-241-3/+3
| | | | | PiperOrigin-RevId: 504325204 Change-Id: Iaa1d6d0ab1dccaaeef26f9cb109d530835499240
* Fix GTEST_OS_ESP8266 checkTom Hughes2023-01-051-1/+1
| | | | | | | | Everywhere else in the code, we check the value of GTEST_OS_ESP8266, not just whether it is defined. PiperOrigin-RevId: 499946909 Change-Id: I86f7e8947abb4e928fc24d1416d8237987b27845
* Workaround for GCC12 bug illustrated by https://godbolt.org/z/Pe5aE59xGDerek Mauro2023-01-041-1/+2
| | | | | | | Fixes #4108 PiperOrigin-RevId: 499556061 Change-Id: I1cb1564f9b77e1825fddc9236965f4a3b661d96a
* Introduces a new porting flag (GTEST_HAS_FILE_SYSTEM) to indicate whether a ↵Abseil Team2022-12-121-4/+37
| | | | | | | platform supports filesystem operations. PiperOrigin-RevId: 494751986 Change-Id: I07f73bdf478a73934b8f1a69c1ab4abda1b231ae
* Fall back to the system clock when building with newlib on a system without ↵Tom Hughes2022-12-081-3/+10
| | | | | | | a monotonic clock. PiperOrigin-RevId: 493917905 Change-Id: I20137cfcda3671ffc8edcda2b6554aa392e3a00a
* Remove the unused class TestNameIsDerek Mauro2022-12-061-31/+0
| | | | | | | Fixes #4076 PiperOrigin-RevId: 493158910 Change-Id: Id66c0443a6f5f4d167ae39ac79766b32cf95a383
* Merge pull request #4058 from zloylos:support-kitty-termCopybara-Service2022-11-141-9/+10
|\ | | | | | | | | PiperOrigin-RevId: 488463135 Change-Id: I4180d766dabbe438210904e743e6e963122540f5
| * Support kitty TERMrefs/pull/4058/headDenis Hananein2022-11-101-0/+1
| | | | | | | | Signed-off-by: Denis Hananein <i@zloylos.me>
* | Defined a testing::SrcDir() function that returns the name of a directoryAbseil Team2022-11-111-9/+34
| | | | | | | | | | | | | | where ancillary data files can be found. PiperOrigin-RevId: 487896836 Change-Id: Ie6b1ba734e900fa33872b63090879ee6efe33411
* | RecordProperty serializes ints and 64-bit ints, including size_tsAbseil Team2022-11-071-6/+4
|/ | | | | PiperOrigin-RevId: 486685761 Change-Id: I164d2646e65670d341dbf437ee571953c456677a
* Fix JSON output format #3884refs/pull/4036/headDenis Hananein2022-10-111-0/+3
|
* [fuchsia] Use __builtin_trap to trigger gunit_break_on_failure on non-x86 archAbseil Team2022-10-061-0/+12
| | | | | | | In developing tests for the fuchsia debugger, it was found that in addition to catching gtest failures (which are implemented as software breakpoints) we also see PageFault exceptions, caused by this nullptr dereference. PiperOrigin-RevId: 479365782 Change-Id: I84d805d94c2e46b6f3c982ca1ae49c6ac3ed3430
* Add GoogleTest workaround for MSVC crash with Address Sanitizer (ASAN) on ↵Abseil Team2022-09-271-1/+2
| | | | | | | version 17.3.3 PiperOrigin-RevId: 477240422 Change-Id: I894037850617252e462783c0885e30fc8e7ad122
* Consider all TERM values ending in "-256color" to be color supporting. In ↵Abseil Team2022-08-261-6/+3
| | | | | | | particular this handles TERM=hterm-256color correctly. PiperOrigin-RevId: 470232889 Change-Id: Iea594a3fde2b8b0a10e527956d70ba0bb3452e08
* Merge pull request #3918 from assafpr:master2mainCopybara-Service2022-08-011-1/+1
|\ | | | | | | | | PiperOrigin-RevId: 464586117 Change-Id: Icda62f13b962f7408bb5698ae2b627391257d152
| * Update gtest.ccassafpr2022-06-271-1/+1
| | | | | | fix a broken link
* | Merge pull request #3927 from yutotnh:fix-typoCopybara-Service2022-07-181-3/+3
|\ \ | | | | | | | | | | | | PiperOrigin-RevId: 461699509 Change-Id: I9bab4474c5f52d4d66691dfb96a4d20f89fbcfeb
| * | fix: some typos in sourcerefs/pull/3927/headyutotnh2022-07-011-3/+3
| |/
* | Merge pull request #3928 from venik:venik-clean-upCopybara-Service2022-07-121-1/+1
|\ \ | | | | | | | | | | | | PiperOrigin-RevId: 460455562 Change-Id: I29efc09887651d8734586703fe0691482ba4c981
| * | cleanup from unique_ptr branchrefs/pull/3928/headAlexander Nikforov2022-07-011-1/+1
| |/
* | Merge pull request #3868 from eidosmontreal:fix_undefined_symbol_kMaxRangeCopybara-Service2022-07-111-0/+2
|\ \ | |/ |/| | | | | PiperOrigin-RevId: 460222898 Change-Id: I652b8058aa98b56d849c5ab1399f75e531dcc959
| * Fix for undefined symbol: testing::internal::Random::kMaxRangerefs/pull/3868/headGaspard Petit2022-05-311-0/+2
| |
* | Merge pull request #3866 from eidosmontreal:simplify_shouldusecolorCopybara-Service2022-06-131-5/+0
|\ \ | |/ |/| | | | | PiperOrigin-RevId: 454616721 Change-Id: I33b5671646ec027da48cc941baf84b4ddc722e07
| * Simplify ColoredPrintf to rely on ShouldUseColorGaspard Petit2022-05-301-7/+1
|/ | | | 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`
* 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
* 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
* Remove the legacy internal GTEST_DISALLOW_* macrosDerek Mauro2022-04-221-4/+9
| | | | | PiperOrigin-RevId: 443715444 Change-Id: I3ffd54b63d2728ae4a668ee7875c8c3c8188087c
* Use the Abseil flags library when Abseil is presentDerek Mauro2022-04-041-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Only print disabled test banner if the test matches gtest_filterAbseil Team2022-03-221-1/+1
| | | | | | | | 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