Commit Graph

1351 Commits

Author SHA1 Message Date
dmauro
9d698f6905 Googletest export
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
2021-06-08 18:36:20 -04:00
Derek Mauro
4feb6c77de Merge pull request #3393 from JC3:patch-1
PiperOrigin-RevId: 377289133
2021-06-08 18:36:11 -04:00
Abseil Team
c0777e6565 Googletest export
Remove the dependency on Objective C++ in iOS builds.

252ce9c52d introduced the use of
NSTemporaryDirectory() on iOS, which requires Core Foundation, and
Objective C++.

This CL replaces NSTemporaryDirectory() with an equivalent solution
(according to Apple's documentation at [1]) available to C/C++ code.
Avoiding Objective C++ and Core Foundation makes it easier to integrate
googletest in projects that can't use the supplied Bazel build files.

[1] https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585-SW10

PiperOrigin-RevId: 375474990
2021-05-25 13:34:32 -04:00
durandal
df157130cb Googletest export
Add a note documenting that death test macros accept arbitrary gmock matchers against child-process stderr, not just regexes.

PiperOrigin-RevId: 372365998
2021-05-13 15:08:25 -04:00
Abseil Team
f381758e29 Googletest export
This callsite was previously updated to use ZX_INFO_PROCESS_V2 as a part of a soft transition. It is now time to revert back to `ZX_INFO_PROCESS` (which is now an alias of the former). See fxbug.dev/30751 for more details.

PiperOrigin-RevId: 372339833
2021-05-13 15:08:17 -04:00
Jason C
200c7ea1fb
isalnum -> IsAlNum for correct handling of signed chars
I spotted this in 7dd7a053a9 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.
2021-05-04 18:04:13 -04:00
Abseil Team
f5e592d8ee Googletest export
Revert ac3c2a8d04 -- it seems to break some gcc users (#3384)

PiperOrigin-RevId: 370834917
2021-04-29 10:40:44 -04:00
Abseil Team
252ce9c52d Googletest export
Fix iOS logging issues in tests

PiperOrigin-RevId: 370484087
2021-04-26 14:07:25 -04:00
Andy Soffer
23ef29555e Merge pull request #3314 from Vollstrecker:master
PiperOrigin-RevId: 369550590
2021-04-21 10:24:41 -04:00
Abseil Team
f16d43cd38 Googletest export
This callsite was previously updated to use ZX_INFO_PROCESS_V2 as a part of a soft transition. It is now time to revert back to `ZX_INFO_PROCESS` (which is now an alias of the former). See fxbug.dev/30751 for more details.

PiperOrigin-RevId: 369370855
2021-04-21 10:24:32 -04:00
Abseil Team
0d9daa9936 Googletest export
This callsite was previously updated to use ZX_INFO_PROCESS_V2 as a part of a soft transition. It is now time to revert back to `ZX_INFO_PROCESS` (which is now an alias of the former). See fxbug.dev/30751 for more details.

PiperOrigin-RevId: 369349579
2021-04-21 10:24:25 -04:00
Andy Soffer
566fdcc928 Merge pull request #3364 from jbampton:fix-spelling
PiperOrigin-RevId: 369217358
2021-04-21 10:24:17 -04:00
Vollstrecker
8043818e1b
Use URL instead of git-repo 2021-04-20 10:09:33 +02:00
dmauro
eaf9a3fd77 Googletest export
Use the time_point from steady_clock instead of the template
This fixes the build on some embedded compilers

PiperOrigin-RevId: 368879480
2021-04-16 17:33:13 -07:00
Abseil Team
831bc03504 Googletest export
Fix -Wconversion issues on Fuchsia

PiperOrigin-RevId: 368520510
2021-04-15 20:41:37 -07:00
John Bampton
050b517518 chore: fix spelling 2021-04-15 11:53:53 +10:00
Vollstrecker
c79eb87c11
Mention to explicitely set the option to it's default. 2021-04-14 23:13:01 +02:00
Vollstrecker
38c316fc5c
Changes like Requested. 2021-04-14 14:58:03 +02:00
Abseil Team
4400d68de4 Googletest export
Add support to run gtest on Xtensa platform.

This add support to run GTest base test suits on Xtensa
(https://ip.cadence.com/ipportfolio/tensilica-ip) base simulator.
Xtensa only provides libc and some basic operations and does not run an
operating system by default.

PiperOrigin-RevId: 368162205
2021-04-13 17:58:07 -07:00
Dino Radaković
ec7fa96f29 Merge pull request #3158 from GauthamBanasandra:patch-1
PiperOrigin-RevId: 367681693
2021-04-12 20:14:10 -07:00
Abseil Team
d0303e40c5 Googletest export
Migrate away from deprecated --heap_check=strict

PiperOrigin-RevId: 367226846
2021-04-07 23:39:25 -07:00
Abseil Team
601a68150d Googletest export
This is part of a soft transition over to having ZX_INFO_PROCESS
populate a new struct. See fxbug.dev/30751 for more details.

PiperOrigin-RevId: 367083068
2021-04-07 23:39:18 -07:00
Abseil Team
4048829db1 Googletest export
Add macros to omit {EXPECT,ASSERT}_{TRUE,FALSE}

PiperOrigin-RevId: 366455905
2021-04-05 16:13:34 -07:00
Dino Radaković
6c5c4554ac Merge pull request #3155 from ZedThree:cmake-alias-libraries
PiperOrigin-RevId: 365572439
2021-03-29 21:29:19 -07:00
Abseil Team
df7fee587d Googletest export
Delete extra whitespace in gtest_xml_test_utils.py

PiperOrigin-RevId: 365140844
2021-03-25 16:04:59 -07:00
Abseil Team
1a8ecf1813 Googletest export
Print std::u8string, std::u16string, and std::u32string as string literals

Previously, these types were printed as "{ U+123, U+456, U+789 }". However,
printed output in that form is difficult to compare against any literals that
might be defined in code. Instead, just treat these types like std::string
and std::wstring, escaping non-ASCII characters with a hexadecimal escape
sequence.

The tests have also been updated to cover the new functionality: as a bonus,
the tests now also pass with the MSVC toolchain.

Internally, the code has been reorganized to primarily operate in terms of
char32_t, under the assumption that char32_t will always be at least as big
as wchar_t. While that assumption is currently true, perhaps it won't be in
the future...

PiperOrigin-RevId: 364033132
2021-03-22 15:18:50 -04:00
Andy Soffer
b7d472f122 Merge pull request #3291 from Be-ing:remove_zi_msvc
PiperOrigin-RevId: 363063211
2021-03-16 09:51:31 -04:00
Abseil Team
ac1d60c2b5 Googletest export
gtest: Output a canned test suite for environment failures in XML/JSON

This surfaces useful information about the environment failure in a structured form.

As we can see from the updated test, previously unsurfaced information is now present.

PiperOrigin-RevId: 362292322
2021-03-16 09:51:18 -04:00
Abseil Team
3bd41ab23f Internal change
PiperOrigin-RevId: 362216935
2021-03-16 09:51:10 -04:00
Vollstrecker
5065389aab
Use Fetchcontent instead of ExternalProject
Hi,

instead of ExternalProject and a new file that is spawned in a new process, it's easier to just use FetchContent. cmake 3.14 should be old enough to be spread.
2021-03-13 16:58:42 +01:00
Abseil Team
763eaa4305 Googletest export
Use monotonic time to measure test duration

System time may be updated while a test is running. When this occurs a
duration measured using system time may appear to move backwards, or
jump far forwards.
This change updates the duration measurement to use monotonic time
instead. Timestamps for the test start still use system time.

PiperOrigin-RevId: 361700881
2021-03-09 10:59:35 -08:00
Abseil Team
bb4f87e6c6 Googletest export
gtest.cc: Split out functions for printing `TestResult` objects

This will make it possible to reuse this code for outputting the "ad_hoc" `TestResult` objects in structured form in XML/JSON.

PiperOrigin-RevId: 361604860
2021-03-09 10:59:28 -08:00
Dino Radaković
bcfcf75ef6 Merge pull request #3184 from N-Dekker:PrintTo-type_index-overload
PiperOrigin-RevId: 361175466
2021-03-09 10:59:10 -08:00
Abseil Team
e8b478a735 Googletest export
Update gtest doc link

PiperOrigin-RevId: 359622286
2021-02-26 17:58:17 -05:00
Be
497db77a0a
remove -Zi from MSVC compiler options
This is incompatible with compiler caches such as sccache and
clcache. If a project including Google Test specifies /Z7 instead,
building fails with:

sccache C:\PROGRA~2\MICROS~1\2019\ENTERP~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\cl.exe  /nologo /TP -D__SSE2__ -D__SSE__ -I..\lib\googletest-1.10.x\googlemock\include -I..\lib\googletest-1.10.x\googlemock -I..\lib\googletest-1.10.x\googletest\include -I..\lib\googletest-1.10.x\googletest /DWIN32 /D_WINDOWS /W4 /GR  /MD /Z7 /O2 /Ob1 /DNDEBUG -GS -W4 -WX -wd4251 -wd4275 -nologo -J -Zi -D_UNICODE -DUNICODE -DWIN32 -D_WIN32 -DSTRICT -DWIN32_LEAN_AND_MEAN -wd4702 -DGTEST_HAS_PTHREAD=0 -EHsc -D_HAS_EXCEPTIONS=1  /Gy /showIncludes /Folib\googletest-1.10.x\googlemock\CMakeFiles\gmock_main.dir\src\gmock-all.cc.obj /Fdbin\gmock_main.pdb /FS -c ..\lib\googletest-1.10.x\googlemock\src\gmock-all.cc
FAILED: lib/googletest-1.10.x/googlemock/CMakeFiles/gmock_main.dir/src/gmock-all.cc.obj
..\lib\googletest-1.10.x\googletest\src\gtest-all.cc: fatal error C1041: cannot open program database 'D:\a\mixxx\mixxx\build\bin\gmock_main.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS
cl : Command line warning D9025 : overriding '/Z7' with '/Zi'
2021-02-25 18:19:43 -06:00
Niels Dekker
ac3c2a8d04 overload PrintTo for std::type_info and std::type_index
Included the string returned by their `name()` member function with the output of `PrintTo`.

Typical use case:

    std::unique_ptr<AbstractProduct> product = FactoryMethod();
    // Assert that the product is of type X:
    ASSERT_EQ(std::type_index{typeid(*product)},
              std::type_index{typeid(ProductX)});

Possible output in case of a test assert failure, now including the names of the compared type indices:

> error: Expected equality of these values:
>  std::type_index(typeid(*product))
>    Which is: 8-byte object <D0-65 54-8C F6-7F 00-00> ("class ProductY")
>  std::type_index(typeid(ProductX))
>    Which is: 8-byte object <40-64 54-8C F6-7F 00-00> ("class ProductX")

With help from Krystian Kuzniarek.
2021-02-25 13:23:52 +01:00
Abseil Team
daa0df7b41 Googletest export
Explicitly skip tests after fatal global environment setup errors

Previously the tests were all skipped, but the resulting output claimed all
tests passed.

Before:
```
[----------] Global test environment set-up.
<failure message>
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (83 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 0 tests, listed below:
```

After:
```
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
<failure message>
[----------] 1 test from SomeTest
[ RUN      ] SomeTest.DoesFoo
<...>: Skipped
[  SKIPPED ] SomeTest.DoesFoo (0 ms)
[----------] 1 test from SomeTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (68 ms total)
[  PASSED  ] 0 tests.
[  SKIPPED ] 1 test, listed below:
[  SKIPPED ] SomeTest.DoesFoo
[  FAILED  ] 0 tests, listed below:
```

PiperOrigin-RevId: 358026389
2021-02-18 13:27:15 -05:00
Abseil Team
0a3a3a845e Googletest export
Make include guards conform with https://google.github.io/styleguide/cppguide.html#The__define_Guard, attempt #2

PiperOrigin-RevId: 357056902
2021-02-18 13:26:24 -05:00
Andy Soffer
e09d2b6a79 Merge pull request #3216 from corentinmusard:master
PiperOrigin-RevId: 356610323
2021-02-11 12:49:33 -05:00
Abseil Team
d4144d4ee2 Googletest export
Revert include guard fix

PiperOrigin-RevId: 356588893
2021-02-11 12:49:24 -05:00
Abseil Team
0b4ecf54ca Internal change
PiperOrigin-RevId: 356572459
2021-02-11 12:49:17 -05:00
Abseil Team
af058521ad Googletest export
Fix #2987
Removing const before passing any types through UniversalPrinter.

PiperOrigin-RevId: 356508875
2021-02-11 12:49:00 -05:00
Abseil Team
36b7792047 Googletest export
Make include guards conform with https://google.github.io/styleguide/cppguide.html#The__define_Guard

PiperOrigin-RevId: 355882793
2021-02-11 12:48:43 -05:00
Abseil Team
7e73533abc Googletest export
Delete Google-internal IWYU pragmas

PiperOrigin-RevId: 355398547
2021-02-05 10:41:10 -08:00
dmcardle
fd873f6d7d Googletest export
Use linear-time string globbing in UnitTestOptions::MatchesFilter.

Algorithm is based on https://research.swtch.com/glob.

Closes #3227

PiperOrigin-RevId: 355222440
2021-02-05 10:40:36 -08:00
Abseil Team
f23cf00027 Googletest export
Address `-Wpedantic` issue introduced in https://github.com/google/googletest/pull/3204

Raised via 4898cdacfe (commitcomment-46413996)

PiperOrigin-RevId: 354198931
2021-02-05 10:39:47 -08:00
Abseil Team
726118846d Googletest export
Document the fact that MatchAndExplain(T, MatchResultListener*) is supported.

PiperOrigin-RevId: 354172275
2021-02-05 10:39:39 -08:00
Abseil Team
d114398800 Googletest export
Remove uses of GTEST_HAS_TYPED_TEST_P and GTEST_HAS_TYPED_TEST.

PiperOrigin-RevId: 353935996
2021-02-05 10:39:30 -08:00
Abseil Team
3351eba0aa Googletest export
Delete obsolete comment, gtest-param-test.h isn't generated by pump anymore

PiperOrigin-RevId: 353680589
2021-01-26 15:43:38 -05:00
Abseil Team
997c36c188 Googletest export
Stop using pump for generating internal/custom/gmock-generated-actions.h

PiperOrigin-RevId: 352660735
2021-01-26 15:42:55 -05:00