aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/include
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2818 from inazarenko:masterGennadiy Rozental2020-05-011-13/+2
|\ | | | | | | PiperOrigin-RevId: 308711492
* | Merge pull request #2818 from inazarenko:masterGennadiy Rozental2020-05-011-2/+13
|\| | | | | | | PiperOrigin-RevId: 308650221
| * Enable protobuf printing for open-source proto messages.Igor Nazarenko2020-04-191-2/+13
| |
* | Merge pull request #2815 from Quuxplusone:simpleGennadiy Rozental2020-05-012-8/+4
|\ \ | | | | | | | | | PiperOrigin-RevId: 308625388
| * | Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_.Arthur O'Dwyer2020-04-232-6/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | None of these are strictly needed for correctness. A large number of them (maybe all of them?) trigger `-Wdeprecated` warnings on Clang trunk as soon as you try to use the implicitly defaulted (but deprecated) copy constructor of a class that has deleted its copy assignment operator. By declaring a deleted copy assignment operator, the old code also caused the move constructor and move assignment operator to be non-declared. This means that the old code never got move semantics -- "move-construction" would simply call the defaulted (but deprecated) copy constructor instead. With the new code, "move-construction" calls the defaulted move constructor, which I believe is what we want to happen. So this is a runtime performance optimization. Unfortunately we can't yet physically remove the definitions of these macros from gtest-port.h, because they are being used by other code internally at Google (according to zhangxy988). But no new uses should be added going forward.
* / Googletest exportAbseil Team2020-05-011-3/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explicitly define copy constructors used in googletest tests As of C++11, providing a user-declared copy assignment operator should suppress the availability of an implicit default copy constructor. Classes that provide (or delete) a copy assignment operator must provide their own copy constructor if one is desired. This may be an explicit default copy constructor if appropriate. As googletest is a C++11 codebase, this change should be made without qualification. This addresses the -Wdeprecated-copy warnings issued by trunk clang: While compiling googletest/test/googletest-death-test-test.cc: In file included from .../googletest/test/googletest-death-test-test.cc:33: .../googletest/include/gtest/gtest-death-test.h:196:8: error: definition of implicit copy constructor for 'ExitedWithCode' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy] void operator=(const ExitedWithCode& other); ^ .../googletest/test/googletest-death-test-test.cc:279:16: note: in implicit copy constructor for 'testing::ExitedWithCode' first required here EXPECT_PRED1(pred0, status0); ^ While compiling googletest/test/googletest-param-test-test.cc: .../googletest/test/googletest-param-test-test.cc:502:8: error: definition of implicit copy constructor for 'NonDefaultConstructAssignString' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy] void operator=(const NonDefaultConstructAssignString&); ^ .../googletest/test/googletest-param-test-test.cc:507:36: note: in implicit copy constructor for 'NonDefaultConstructAssignString' first required here Combine(Values(0, 1), Values(NonDefaultConstructAssignString("A"), This matches other changes made elsewhere in the googletest codebase, such as 306f3754a71d. Perhaps those previous changes did not consider test code. PiperOrigin-RevId: 307495126
* Googletest exportAbseil Team2020-04-041-3/+5
| | | | | | | | This change updates testing::internal::IsAProtocolMessage to return true not just for full proto messages but also for lite ones (i.e. those inheriting directly from MessageLite). PiperOrigin-RevId: 304286535
* Googletest exportAbseil Team2020-03-241-0/+10
| | | | | | | | | | Add --gtest_fail_fast support to googletest. - Analogous functionality to to golang -test.failfast and python --failfast - Stops test execution upon first test failure. - Also add support Bazel equivalent env var (TESTBRIDGE_TEST_RUNNER_FAIL_FAST) PiperOrigin-RevId: 302488880
* Merge pull request #2746 from Romain-Geissler-1A:mastervslashg2020-03-201-5/+18
|\ | | | | | | PiperOrigin-RevId: 302045808
| * Make sure IsATTY does not clobber errno.Romain Geissler2020-03-111-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exposition of the problem: > cat main.cpp TEST(errnoTest, errnoTest) { ASSERT_EQ(errno, 0); } int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Compiled with gcc 10 like this: > g++ -pthread -o runtest main.cpp -Wl,-Bstatic -lgtest -Wl,-Bdynamic Before patch: > ./runtest [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from errnoTest [ RUN ] errnoTest.errnoTest [ OK ] errnoTest.errnoTest (0 ms) [----------] 1 test from errnoTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test. (output is colored, I run this inside an interactive terminal). > ./runtest | cat [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from errnoTest [ RUN ] errnoTest.errnoTest main.cpp:5: Failure Expected equality of these values: (*__errno_location ()) Which is: 25 0 [ FAILED ] errnoTest.errnoTest (0 ms) [----------] 1 test from errnoTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] errnoTest.errnoTest 1 FAILED TEST (output is not colored, since IsTTY return false, because of the pipe, however it also clobbered errno for the tests). After the patch, both cases are working fine: > ./runtest [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from errnoTest [ RUN ] errnoTest.errnoTest [ OK ] errnoTest.errnoTest (0 ms) [----------] 1 test from errnoTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test. > ./runtest | cat [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from errnoTest [ RUN ] errnoTest.errnoTest [ OK ] errnoTest.errnoTest (0 ms) [----------] 1 test from errnoTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test.
* | Googletest exportAbseil Team2020-03-171-6/+0
| | | | | | | | | | | | Move internal function out of header because Hyrum's law always wins. PiperOrigin-RevId: 301446904
* | Googletest exportAbseil Team2020-03-171-254/+159
|/ | | | | | Simplify the fallback printing logic to have a single sequence of trial printers. PiperOrigin-RevId: 298621376
* Googletest exportAbseil Team2020-02-281-1/+1
| | | | | | | Rename internal color enumerators to avoid conflicts with curses.h macro definitions. Fixes #2685 PiperOrigin-RevId: 297639382
* Googletest exportAbseil Team2020-02-113-31/+63
| | | | | | Add gmock Matcher<std::string_view> specialization. PiperOrigin-RevId: 294443240
* Googletest exportAbseil Team2020-02-071-2/+6
| | | | | | | | | | Disable warning C4800 for Visual Studio 2019. The compiler warning C4800 is disabled by default in Visual Studio 2019, but it can be enabled on the command line. The only version of Visual Studio that does not support warning C4800 is Visual Studio 2017. PiperOrigin-RevId: 292624510
* Googletest exportAbseil Team2020-02-071-0/+2
| | | | | | Adds missing `#define` guard around `TEST_F(...)` PiperOrigin-RevId: 291703056
* Googletest exportAbseil Team2020-01-211-2/+3
| | | | | | Add extra filtering so that the reported message differentiates between the case where INSTANTIATE_TEST_SUITE_P is missing vs. the case where TEST_P is missing. PiperOrigin-RevId: 290114508
* Googletest exportAbseil Team2020-01-161-1/+1
| | | | | | Correct the spelling of PARAMETERIZED. PiperOrigin-RevId: 289897278
* Googletest exportAbseil Team2020-01-163-0/+17
| | | | | | | | | | Add GTEST_ALLOW_UNINSTANTIATED_PARAMTERIZED_TEST to mark a paramaterized test as allowed to be un-instantiated. This allows test suites, that are defined in libraries and, for other reasons, get linked in (which should probably be avoided, but isn't always possible) to be marked as allowed to go uninstantiated. This can also be used to grandfather existing issues and expedite adoption of the checks with regards to new cases before they can be fixed. PiperOrigin-RevId: 289581573
* Googletest exportAbseil Team2020-01-091-1/+1
| | | | | | | | Removing GTEST_API from TrueWithString. This type is only used in test code on one side of a DLL boundary so it is not necessary. PiperOrigin-RevId: 288927929
* Googletest exportAbseil Team2020-01-091-1/+1
| | | | | | | Close #2658 Mark test case destrucors as override. PiperOrigin-RevId: 288507991
* Merge pull request #2639 from trzecieu:trzeci/move_ctor_assignAndy Soffer2020-01-022-5/+21
|\ | | | | | | PiperOrigin-RevId: 286896167
| * Make move operation noexcept.Piotr Paczkowski (trzeci.eu)2019-12-201-2/+2
| |
| * Define default destructor for test classesPiotr Paczkowski (trzeci.eu)2019-12-201-0/+1
| |
| * Deleted functions as part of public interfacePiotr Paczkowski (trzeci.eu)2019-12-201-4/+4
| |
| * Review notes: Return T& from assignment operatorsPiotr Paczkowski (trzeci.eu)2019-12-201-2/+2
| |
| * Disable move constructor and assignment operator for test classes.trzeci2019-12-172-2/+17
| | | | | | | | | | | | | | | | | | Disable move operations for TEST() and TEST_F() macros. Previous implementation disabled only copy ctor and assing operator, but this was violating rule of 5[1], which was captured by static code analysis tools like clang-tidy `cppcoreguidelines-special-member-functions`. [1]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c21-if-you-define-or-delete-any-default-operation-define-or-delete-them-all
* | Googletest exportAbseil Team2020-01-023-3/+38
| | | | | | | | | | | | | | | | Add option (default to disabled) to make C++ type parameterized tests (TYPED_TEST_P) fail when they're not instantiated. When an un-instantiated TYPED_TEST_P is found, a new test will be inserted that emits a suitable message. For now, that is just a notice, but the hope it to flip the bit to make it fail by default. PiperOrigin-RevId: 286408038
* | Merge pull request #2624 from ShabbyX:masterAndy Soffer2020-01-023-17/+19
|\ \ | |/ |/| | | PiperOrigin-RevId: 286397298
| * Revert "Googletest export": disallow empty prefixShahbaz Youssefi2019-12-161-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 20b5b8ecc7a81d23b4716e22a2b35fd53379c8c6. Reason for revert: Breaks existing applications, such as ANGLE (angleproject.org), requires adding an extra prefix that needs to be typed for no reason (when testing from command line) and increases the logs' sizes by a non-trivial amount due to the very large number of tests ANGLE runs. Original commit message: Add a compile time check to ensure that the parameters to TEST_P and INSTANTIATE_TEST_SUITE_P are not empty. Some compilers already fail in that case and, even where it works, it's likely to result in technically invalid code by virtue of creating reserved identifiers: https://en.cppreference.com/w/cpp/language/identifiers First, every project is perfectly capable of adding a prefix if they want to support such a compiler. This change penalizes every project. Second, using a prefix such as `_p` also results in reserved identifiers, so this change is not really solving the problem. For that matter, instead of generating `gtest_##prefix##...`, you can generate `gtest_x##prefix##...` to correctly fix the issue, including when empty prefixes are used.
| * Revert "Googletest export": Remove test for empty prefixShahbaz Youssefi2019-12-161-1/+4
| | | | | | | | | | | | | | | | | | | | This reverts commit 4c25e2b87fcb78abcfdee2739db9ed7a19754cd3. Reason for revert: Reverting the commit that disallows empty prefixes. Original commit message: Remove a test case rendered obsolete by disallowing empty argument for INSTANTIATE_TEST_SUITE_P. Remove the code that it was testing.
| * Workaround VS bug w.r.t empty arguments to macrosShahbaz Youssefi2019-12-161-1/+10
|/ | | | | | | | | | | | | | | | Empty arguments can be passed to macros per C99 and C++11 specs, which can then be forwarded to other macros. Visual Studio's compiler has a bug in the following situation: #define A(x) #x #define B(x, y) A(x) B(, b) In the above case, Visual Studio first expands x to nothing, then complains that A is not invoked with the right amount of arguments. However, x in A(x) is still one argument, even if it expands to no preprocessing tokens. See also https://stackoverflow.com/a/7674214.
* Googletest exportAbseil Team2019-12-131-1/+2
| | | | | | Add GTEST_API_ to correct a build failure under MSCV. PiperOrigin-RevId: 285208464
* Googletest exportAbseil Team2019-12-131-1/+14
| | | | | | | | | | | Detect when C++ parametric tests (TEST_P) are not instantiated. When an un-instantiated TEST_P is found, a new test will be inserted that will emit a warning message. This can be made to error with minor code edits. In the future, that is intended to be the default. PiperOrigin-RevId: 284901666
* Googletest exportAbseil Team2019-12-061-5/+3
| | | | | | | | | | Change googletest to notice failures during SetUpTestSuite() and TearDownTestSuite(). Previously, errors that occurred during those functions were logged but otherwise ignored. After this change, such failures will cause the test to fail and a brief summary will be printed at the bottom of the test log. See https://github.com/google/googletest/issues/2330. PiperOrigin-RevId: 284033342
* Googletest exportAbseil Team2019-11-261-1/+1
| | | | | | | | Wrap call to std::numeric_limits<>::max into round braces to appease MSVC. Closes #2589 PiperOrigin-RevId: 282581361
* Merge pull request #2591 from kuzkry:remove-workaround_g++-using-on-operator<<Gennadiy Rozental2019-11-261-4/+2
|\ | | | | | | PiperOrigin-RevId: 282575040
| * remove g++ 3.3 workaround: using on operator<<Krystian Kuzniarek2019-11-221-4/+2
| |
* | Googletest exportAbseil Team2019-11-223-44/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Use standard C++11 integer types in gtest-port.h. Remove testing::internal::{Int,Uint}{32,64} in favor of types guaranteed to be in <cstdint> since C++11. Tests for built-in integer type coverage are switched from {Int,Uint}64 to [unsigned] long long, which is guaranteed by C++11 to exist and be at least 64-bit wide. PiperOrigin-RevId: 281565263
* | Merge pull request #2569 from bgianfo:masterGennadiy Civil2019-11-201-2/+3
|\ \ | | | | | | | | | PiperOrigin-RevId: 281321427
| * | Fix FlatTuple compilation on older msvc.Brian Gianforcaro2019-11-151-2/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | googletest 1.10.0 fails to compile on msvc version 19.00.23917 with one compilation error: src\googletest\include\gtest\internal\gtest-internal.h(1188) : error C2039: 'FlatTupleBase<testing::internal::FlatTuple<bool,bool>,testing::internal::IndexSequence<0,1> >': is not a member of 'testing::internal::FlatTuple<bool,bool>' This PR fixes the compilation error by explicitly specifying the full type that Indices is located in the base type.
* | Googletest exportAbseil Team2019-11-081-4/+13
| | | | | | | | | | | | | | | | Correctly deal with stringification, and forbid empty arguments where they could slip thought, in the type parameterized test API. Note: even where empty args work, it's likely to result in technically invalid code by virtue of creating reserved identifiers: https://en.cppreference.com/w/cpp/language/identifiers PiperOrigin-RevId: 279330971
* | Merge pull request #2373 from Youw:masterXiaoyi Zhang2019-11-051-3/+33
|\ \ | |/ |/| | | PiperOrigin-RevId: 278601074
| * Added special catch for std::exception in GTEST_TEST_NO_THROW_Ihor Dutchak2019-10-301-3/+31
| |
* | Merge pull request #2453 from kuzkry:gtest-port-clean-up_kMaxBiggestIntXiaoyi Zhang2019-11-043-39/+58
|\ \ | | | | | | | | | PiperOrigin-RevId: 278008286
* | | Merge pull request #2453 from kuzkry:gtest-port-clean-up_kMaxBiggestIntvslashg2019-11-013-58/+39
|\| | | | | | | | | | | PiperOrigin-RevId: 277979766
| * | remove BiggestIntKrystian Kuzniarek2019-10-243-36/+19
| | |
* | | Merge pull request #2388 from kuzkry:remove-gtest-type-util.pumpvslashg2019-10-294-3515/+59
|\ \ \ | | | | | | | | | | | | PiperOrigin-RevId: 276944601
| * | | remove gtest-type-util.h.pumpKrystian Kuzniarek2019-10-252-192/+1
| | | |
| * | | replace autogenerated TemplatesX classes by variadic onesKrystian Kuzniarek2019-10-254-1743/+28
| | | |