Commit Graph

3215 Commits

Author SHA1 Message Date
Abseil Team
7413280c52 Googletest export
Adds missing `#define` guard around `TEST_F(...)`

PiperOrigin-RevId: 291703056
2020-02-07 13:34:11 -05:00
Abseil Team
87061810f4 Googletest export
Move part of functionality of Matcher* class to the base one. Reduce copypaste.

Make constructor and conversion operator of Matcher* class independent of pump.

PiperOrigin-RevId: 291405510
2020-02-07 13:34:03 -05:00
Abseil Team
f1a6db9d4a Googletest export
Deleted an orphaned duplicate file and exclude another that shouldn't be part of :gtest_all_test.

This showed up while trying to debug the presubmit failure for: https://github.com/google/googletest/pull/2683

PiperOrigin-RevId: 291398123
2020-02-07 13:33:55 -05:00
Abseil Team
22397f28ef Googletest export
Add missing explicit keyword for gmock_Impl constructor.

When switching to using GMOCK_PP in ACTION* macroses `explicit` keyword was
missed in gmock_Impl constructor causing ClangTidy warnings in ACTION_P macro.

PiperOrigin-RevId: 291159975
2020-02-07 13:33:47 -05:00
Abseil Team
10b1902d89 Googletest export
Fix SCOPED_TRACE() message header in example

PiperOrigin-RevId: 290800241
2020-01-21 16:26:40 -05:00
Abseil Team
d01e356e15 Googletest export
Allow copying of the string in MatchAndExplain.

Otherwise, conversions from std::string_view to std::string will fail as being
explicit

PiperOrigin-RevId: 290301103
2020-01-21 16:26:33 -05:00
Xiaoyi Zhang
9417fb401a Merge pull request #2665 from bysreg:fix_noshortcircuitfailure_detectsflakyshortcircuit_test
PiperOrigin-RevId: 290256504
2020-01-21 16:26:24 -05:00
Xiaoyi Zhang
c59c7bab50 Merge pull request #2672 from ivan1993br:ivan1993br-platformio_update
PiperOrigin-RevId: 290255937
2020-01-21 16:26:16 -05:00
Abseil Team
18b67bfc58 Googletest export
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
2020-01-21 16:26:08 -05:00
Abseil Team
8b4817e3df Googletest export
Correct the spelling of PARAMETERIZED.

PiperOrigin-RevId: 289897278
2020-01-16 13:56:21 -05:00
Abseil Team
5336106b66 Googletest export
Use GMOCK_PP to create GMOCK_INTERNAL_ACTION macro.

Create GMOCK_INTERNAL_ACTION macro that generates ACTION_P* macroses using
GMOCK_PP.

PiperOrigin-RevId: 289815906
2020-01-16 13:56:12 -05:00
Abseil Team
3e79d366e3 Googletest export
Wire up things to support marking a type paramaterized test as allowed to be un-instantiated.

PiperOrigin-RevId: 289699939
2020-01-16 13:56:04 -05:00
Abseil Team
7a8591e6e4 Googletest export
Use GMOCK_PP to generate args boilerplate.

Move common args describing part to separate macroses that uses GMOCK_PP to
generate sequences.

PiperOrigin-RevId: 289655624
2020-01-16 13:55:54 -05:00
Abseil Team
0b024bd91a Googletest export
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
2020-01-16 13:55:45 -05:00
Abseil Team
ed16134fb3 Googletest export
Change testing::TempDir() return value for Android

PiperOrigin-RevId: 289102017
2020-01-16 13:55:36 -05:00
Ivan Oliveira Tarifa
aa4315646b
Remove exclusion of *-main and*-all targets
Removing exclusion of *-main and*-all targets from the library.json used on platformio.
2020-01-15 08:45:14 -03:00
Muhammad Hilman Beyri
c7137f0b84 Use IsReadableTypeName IsReadableTypeName in OfType function in gmock-matchers_test.cc 2020-01-12 21:29:54 -05:00
Muhammad Hilman Beyri
3aa538cbfc fix unit test failure on NoShortCircuitOnFailure and DetectsFlakyShortCircuit when GTEST_HAS_RTTI is 1 2020-01-12 16:53:09 -05:00
Abseil Team
d854bd6acc Googletest export
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
2020-01-09 18:25:32 -05:00
Abseil Team
c901f67ddf Googletest export
Move part of functionality of Action* class to the base one. Reduce copypaste.

Make constructor and conversion operator of Action* class independent of pump.

PiperOrigin-RevId: 288907005
2020-01-09 18:25:24 -05:00
Abseil Team
8417b73322 Googletest export
Close #2658
Mark test case destrucors as override.

PiperOrigin-RevId: 288507991
2020-01-09 18:25:16 -05:00
Abseil Team
4b9c1691c4 Googletest export
Use C++11 variadic templates for Invoke in gmock-generated-actions.h.

Replace InvokeArgumentAdl with Invoke that uses C++11 variadic templates.

PiperOrigin-RevId: 288449236
2020-01-09 18:25:08 -05:00
Abseil Team
306f3754a7 Googletest export
Explicitly default copy constructor in BoundSecondMatcher

Since C++11, implicit defaulting of copy constructors is deprecated for types
with user-defined copy assignment operators, so we should explicitly default the
copy constructor of BoundSecondMatcher.

PiperOrigin-RevId: 287587847
2020-01-02 16:49:38 -05:00
Andy Soffer
07ab939af7 Merge pull request #2632 from Kravlalala:cmake/mingw_msys_build
PiperOrigin-RevId: 287587126
2020-01-02 16:49:30 -05:00
Abseil Team
0d98d87e10 Googletest export
Add missing period.

PiperOrigin-RevId: 287553550
2020-01-02 16:49:22 -05:00
Abseil Team
153909f096 Googletest export
Fix typo in example.

PiperOrigin-RevId: 287212448
2020-01-02 16:49:14 -05:00
Andy Soffer
fbe34cecf4 Merge pull request #2639 from trzecieu:trzeci/move_ctor_assign
PiperOrigin-RevId: 286896167
2020-01-02 16:49:07 -05:00
Abseil Team
a13a062618 Googletest export
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
2020-01-02 16:48:59 -05:00
Andy Soffer
008629ae21 Merge pull request #2624 from ShabbyX:master
PiperOrigin-RevId: 286397298
2020-01-02 16:48:50 -05:00
Abseil Team
d0a521255e Googletest export
Use C++11 variadic templates for InvokeArgumentAdl in gmock-generated-actions.h.

Make InvokeArgumentAdl use variadic templates to generate its overloads instead
of using pump.py syntax.

PiperOrigin-RevId: 286267615
2020-01-02 16:48:42 -05:00
Abseil Team
6f1a8ffde9 Googletest export
Use C++11 variadic templates for InvokeArgumentAdl in gmock-generated-actions.h.

Make InvokeArgumentAdl use variadic templates to generate its overloads instead
of using pump.py syntax.

PiperOrigin-RevId: 286148805
2020-01-02 16:48:34 -05:00
Piotr Paczkowski (trzeci.eu)
bf31ed376a
Make move operation noexcept. 2019-12-20 09:51:35 +01:00
Piotr Paczkowski (trzeci.eu)
cc05a3ca01
Define default destructor for test classes 2019-12-20 09:45:28 +01:00
Piotr Paczkowski (trzeci.eu)
05701fee28
Deleted functions as part of public interface 2019-12-20 09:41:58 +01:00
Piotr Paczkowski (trzeci.eu)
77b3a250ea
Review notes: Return T& from assignment operators 2019-12-20 09:39:06 +01:00
trzeci
9d8222ad66
Disable move constructor and assignment operator for test classes.
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
2019-12-17 23:43:31 +01:00
CJ Johnson
d166e09483 Merge pull request #2590 from kuzkry:remove-workaround_g++-stale-comments
PiperOrigin-RevId: 285812343
2019-12-16 16:03:59 -05:00
krzysio
0a0c826629 Googletest export
Don't use fully qualified ::std types in code examples.

Having a nested user-defined 'std' namespace anywhere in a program is a minefield and shouldn't be either explicitly supported or implicitly condoned.

PiperOrigin-RevId: 285790182
2019-12-16 16:03:51 -05:00
Shahbaz Youssefi
1800a38fb7 Revert "Googletest export": disallow empty prefix
This reverts commit 20b5b8ecc7.
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.
2019-12-16 13:01:59 -05:00
Shahbaz Youssefi
4b7809c2f5 Revert "Googletest export": Remove test for empty prefix
This reverts commit 4c25e2b87f.
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.
2019-12-16 13:01:52 -05:00
Shahbaz Youssefi
d201646906 Workaround VS bug w.r.t empty arguments to macros
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.
2019-12-16 11:27:52 -05:00
Matt Calabrese
5b162a79d4 Merge pull request #2589 from kuzkry:remove-workaround_g++-no-space-after-first-macro-argument
PiperOrigin-RevId: 285255373
2019-12-13 12:58:11 -05:00
Abseil Team
d16f86ff1c Googletest export
Add GTEST_API_ to correct a build failure under MSCV.

PiperOrigin-RevId: 285208464
2019-12-13 12:58:02 -05:00
Abseil Team
d8eeb9760a Googletest export
Use C++11 variadic templates for ActionHelper in gmock-generated-actions.h.

Make ActionHelper use variadic templates to generate Perform static member function specializations instead of using pump.py syntax.

PiperOrigin-RevId: 284988441
2019-12-13 12:57:53 -05:00
Abseil Team
d442089d53 Googletest export
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
2019-12-13 12:57:44 -05:00
Matt Calabrese
88ba008c23 Merge pull request #2595 from kuzkry:remove-workaround_msvc-warning-4355
PiperOrigin-RevId: 284234675
2019-12-13 12:57:35 -05:00
Matt Calabrese
a3097c826e Merge pull request #2592 from kuzkry:remove-workaround_msvc-error-C2665
PiperOrigin-RevId: 284207090
2019-12-13 12:57:26 -05:00
misterg
6251071a20 Googletest export
Require all appveyor googletest windows builds to work on Pull Requests to increase CI coverage

PiperOrigin-RevId: 284206759
2019-12-13 12:57:17 -05:00
Ilya Kravchuk
20b8e7a1c8 Activate GNU extensions in case of MSYS generator 2019-12-13 13:47:04 +03:00
Mark Barolak
78fdd6c00b Merge pull request #2609 from kuzkry:revert-2596
PiperOrigin-RevId: 284041013
2019-12-06 11:34:42 -05:00