Commit Graph

2771 Commits

Author SHA1 Message Date
Gennadiy Civil
10e98c4f2a Merge pull request #2180 from twam:master
PiperOrigin-RevId: 239404016
2019-03-21 10:43:14 -04:00
Abseil Team
f1883b1824 Googletest export
Remove mention of unused type ProtocolMessage.

PiperOrigin-RevId: 239242706
2019-03-21 10:43:06 -04:00
Abseil Team
a4b63e7efb Googletest export
Action helpers need to pass by const& so that they can work with unique_ptr.

PiperOrigin-RevId: 239062671
2019-03-21 10:42:58 -04:00
antismap
f233360933
Note about INSTANTIATE_TEST_SUITE_P / INSTANTIATE_TEST_CASE_P keyword change
See https://github.com/google/googletest/issues/2065
2019-03-21 14:38:50 +01:00
Gennadiy Civil
f957bd0c25
Merge pull request #2181 from sethraymond/patch-1
DesignDoc Markdown table was broken
2019-03-20 11:52:49 -04:00
Tobias Müller
c3ac2655f7 Remove old_crtdbg_flag_ member if not required 2019-03-19 09:29:48 +01:00
Seth Raymond
1619ebcf29
DesignDoc Markdown table was broken
Added a missing newline
2019-03-15 09:27:08 -04:00
Gennadiy Civil
8b6d3f9c4a Merge pull request #2158 from CarloWood:master
PiperOrigin-RevId: 236716851
2019-03-05 08:39:41 -05:00
Abseil Team
3dd2e841c3 Googletest export
Fix emission of -Wzero-as-null-pointer-constant when comparing integers.

The following code fails to compile:

#pragma clang diagnostic error "-Wzero-as-null-pointer-constant"
void foo() {
  EXPECT_EQ(0, 0);
}

This happens because gtest checks the first argument to EXPECT_EQ and
ASSERT_EQ is a null pointer constant. The magic it does to do this causes the
warning to be emitted.

This patch removes that check. It replaces the explicit check with a Compare
overload that can only be selected when 0 or nullptr is passed on the LHS
with a pointer on the right.

This patch does not suppress -Wzero-as-null-pointer-constant when users
are actually using it as NULL.

PiperOrigin-RevId: 236654634
2019-03-05 08:39:34 -05:00
Abseil Team
a1dd07786b Googletest export
Build gmock cleanly with clang -Wextra-semi and -Wextra-semi-stmt

Extends 56ef07a203 to take -Wc++98-compat-extra-semi
(https://reviews.llvm.org/D43162) and -Wextra-semi-stmt
(https://reviews.llvm.org/D52695) into account.

For https://crbug.com/926235.

PiperOrigin-RevId: 236643095
2019-03-05 08:39:28 -05:00
Abseil Team
db9b85e275 Googletest export
Let embedders customize GTEST_INTERNAL_DEPRECATED().

GTEST_INTERNAL_DEPRECATED is currently used to nudge googletest users to migrate off old TEST_CASE macros to the new TEST_SUITE macros. This move is non-trivial for Chromium (see https://crbug.com/925652), and might be difficult for other big projects with many dependencies.

This CL facilitates moving off of deprecated APIs by making it possible for an embedder to define GTEST_INTERNAL_DEPRECATED() in gtest/internal/custom/gtest-port.h. Example usage:

1) #define GTEST_INTERNAL_DEPRECATED() to nothing, to disable deprecation warnings while migrating off googletest's deprecated APIs. This can be preferable to having to disable all deprecation warnings (-Wno-error=deprecated or -Wno-deprecated-declarations).

2) #define GTEST_INTERNAL_DEPRECATED() for an unsupported compiler.

PiperOrigin-RevId: 236171043
2019-03-01 16:18:24 -05:00
Abseil Team
56ef07a203 Googletest export
Build gmock cleanly with clang -Wextra-semi

For https://crbug.com/926235.
From https://github.com/google/googletest/pull/2139.
Fixes https://github.com/google/googletest/issues/2138.

PiperOrigin-RevId: 235832527
2019-03-01 16:18:17 -05:00
Carlo Wood
fc979623a9 Minor build system fixes. 2019-03-01 08:11:56 +01:00
Abseil Team
efecb0bfa6 Googletest export
Replace more pump'd code with variadic templates.

PiperOrigin-RevId: 235584585
2019-02-25 17:20:00 -05:00
Gennadiy Civil
5154386c5f
Merge pull request #2152 from rsinnet/patch-1
Fix grammatical error in primer.md
2019-02-25 12:43:55 -05:00
Ryan Sinnet
d70cd4e358
Fix grammatical error in primer.md 2019-02-25 08:03:28 -08:00
Gennadiy Civil
37ae1fc5e6 Merge pull request #2147 from ngie-eign:gtest-test-death-test-dont-hardcode-test-name
PiperOrigin-RevId: 235248114
2019-02-22 16:39:33 -05:00
Gennadiy Civil
b6473fcf90 Merge pull request #2126 from ngie-eign:clang-add-more-strict-warnings
PiperOrigin-RevId: 235220570
2019-02-22 16:18:28 -05:00
Enji Cooper
cd09534dec Don't hardcode the filename in CxxExceptionDeathTest.PrintsMessageForStdException
Due to some caveats in the FreeBSD build system and the fact that the
source file is used to compile 2 different death tests with different
flags, I needed (as a shortterm workaround) to copy the test to 2
differently named files.

While this works for compiling the test, as I discovered, this doesn't
work with running `CxxExceptionDeathTest.PrintsMessageForStdException`,
as the testcase hardcodes `googletest-death-test_ex_test.cc`. Use `__FILE__`
when looking for failures, as opposed to looking for the hardcoded name
as it can vary depending on how the test was built.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-21 12:10:15 -08:00
Gennadiy Civil
7203f37f57 Merge pull request #2137 from ngie-eign:clang-ignore-sign-conversion
PiperOrigin-RevId: 235012245
2019-02-21 13:14:17 -05:00
Gennadiy Civil
1411d27a94 Merge pull request #2061 from samolisov:building-with-bazel-as-a-dll-on-windows
PiperOrigin-RevId: 234845565
2019-02-20 15:22:43 -05:00
Gennadiy Civil
c5a792d1b6 Merge pull request #2125 from ngie-eign:clang-unused-parameter
PiperOrigin-RevId: 234844287
2019-02-20 15:22:35 -05:00
Gennadiy Civil
c374893023 Merge pull request #2123 from ngie-eign:clang-inconsistent-missing-override
PiperOrigin-RevId: 234840107
2019-02-20 15:22:28 -05:00
misterg
873e479817 Googletest export
Internal Change

PiperOrigin-RevId: 234823465
2019-02-20 13:35:36 -05:00
Abseil Team
0e424c7594 Googletest export
Update gtest-death-test to use new Fuchsia API

Fuchsia has renamed this API and removed the need for several parameters. We now use the newer, simpler API.

PiperOrigin-RevId: 234617715
2019-02-20 13:35:30 -05:00
Gennadiy Civil
6d4d2f06be
Merge pull request #2141 from dspinellis/index-fix
Avoid array index out of range
2019-02-20 13:04:20 -05:00
Diomidis Spinellis
9dc235b59c Avoid array index out of range
Issue: #2140
2019-02-20 00:59:21 +02:00
Enji Cooper
fcf59ca7bf Ignore -Wsign-conversion issues
clang++ compilation when `-Wsign-conversion` is currently broken and the
issues within the code are varied and widespread. For the time being
ignore `-Wsign-conversion` issues, even though some of them are valid
and bleed over into issues that would be found with
`-Wtautological-compare`, et al.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-18 19:19:34 -08:00
Enji Cooper
1c22797cd3 Fix clang -Wunused-parameter warnings
Comment out unused method parameters in their relevant definitions.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-13 14:38:51 -08:00
Enji Cooper
5388473acf Fix clang -Winconsistent-missing-override warnings
`DescribeTo(..)` and `MatchAndExplain(..)` in `gmock-matchers_test` both
override virtual methods. Remove the `virtual` keyword and apply `override` to
them instead.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-13 14:38:51 -08:00
Enji Cooper
2147806d2d Fix clang -Winconsistent-missing-override warnings
`DescribeTo(..)` and `MatchAndExplain(..)` in `gmock-matchers_test` both
override virtual methods. Remove the `virtual` keyword and apply `override` to
them instead.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-13 14:38:50 -08:00
Enji Cooper
a4af76cf8c Add cxx_strict_flags for clang to match FreeBSD's WARNS flags
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-13 14:38:49 -08:00
Gennadiy Civil
d850e14471 Merge pull request #2112 from knuto:pr/fix_null_pointer
PiperOrigin-RevId: 233825166
2019-02-13 17:04:09 -05:00
Gennadiy Civil
54ec41f000 Merge pull request #2121 from ngie-eign:add-dragonflybsd-and-kfreebsd-support
PiperOrigin-RevId: 233789488
2019-02-13 14:07:33 -05:00
Gennadiy Civil
f73b2fb39e Merge pull request #2114 from knuto:pr/libtool_support
PiperOrigin-RevId: 233773676
2019-02-13 14:07:26 -05:00
Gennadiy Civil
ea43be9d1a Merge pull request #2119 from ngie-eign:clang-wunused-private-field
PiperOrigin-RevId: 233762751
2019-02-13 11:56:43 -05:00
Gennadiy Civil
e5e846da7f Merge pull request #2120 from ngie-eign:clang-compile-with-basic-warns-flags
PiperOrigin-RevId: 233762520
2019-02-13 11:56:17 -05:00
Gennadiy Civil
75c3396099 Merge pull request #2113 from knuto:pr/set_old_gtest_ver
PiperOrigin-RevId: 233748252
2019-02-13 10:24:59 -05:00
Enji Cooper
96826743ea Import patch-bsd-defines from FreeBSD ports [1]
As noted in the patch description:
* Add DragonFly and GNU/kFreeBSD support.
* Implement GetThreadCount() for BSDs.

1. https://svnweb.freebsd.org/ports/head/devel/googletest/files/patch-bsd-defines?revision=488934

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-12 22:43:07 -08:00
Enji Cooper
1ded83195d Compile clang with -Wall -Wshadow -Werror
It was not compiling any of the code with warnings prior to this.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-12 16:45:40 -08:00
Enji Cooper
ed2fe122f8 Fix -Wunused-private-field issues with clang
Provide dummy accessors for private values that are set in initializers,
but not actually used.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-12 16:40:01 -08:00
misterg
c4ccab33aa Googletest export
Internal Change

PiperOrigin-RevId: 233614147
2019-02-12 13:20:40 -05:00
Gennadiy Civil
b37574c1bf Merge pull request #2107 from ciband:feat/finish_platformio_support
PiperOrigin-RevId: 233108234
2019-02-12 13:20:34 -05:00
Gennadiy Civil
b68ec344bf Merge pull request #2101 from MaEtUgR:fix-cmake-cygwin
PiperOrigin-RevId: 233096223
2019-02-12 13:20:27 -05:00
Abseil Team
4f79e316ac Googletest export
Internal changes.

PiperOrigin-RevId: 232953166
2019-02-12 13:20:20 -05:00
Abseil Team
28a96d1834 Googletest export
Fix matcher comparisons for std::reference_wrapper.

The googletest docs indicate that std::reference_wrapper should be used to for
objects that should not be copied by the matcher (in fact, the ByRef() function
is basically the same as a call to std::cref).

However, for many types (such as std::string), the overloaded operator== will
not resolve correctly. Specifically, this is problematic if operator== depends
on template argument deduction, where the same type is named on LHS and RHS.

Because template argument deduction happens before any implict conversions for
purposes of overload resolution, attempting to compare T with
std::reference_wrapper<T> simply looks like a comparison of unlike types.

For exapmle, std::reference_wrapper<std::string> is implicitly convertible to
'const std::string&', which would be able to choose an overload specialization
of operator==. However, the implicit conversion can only happen after template
argument deduction for operator==, so a specialization that would other be an
applicable overload is never considered.

Note also that this change only affects matchers. There are good reasons that
matchers may need to transparently hold a std::reference_wrapper. Other
comparisons (like EXPECT_EQ, et. al.) don't need to capture a reference: they
don't need to defer evaluation (as in googlemock), and they don't need to avoid
copies (as the call chain of matchers does).

PiperOrigin-RevId: 232499175
2019-02-12 13:20:14 -05:00
Abseil Team
dda0df3b0a Googletest export
Internal change

PiperOrigin-RevId: 232362580
2019-02-12 13:20:05 -05:00
Knut Omang
60cf03313d Set gtest version correctly for older cmake versions
Signed-off-by: Knut Omang <knut.omang@oracle.com>
2019-02-11 20:19:58 +01:00
Knut Omang
f4d3cdb657 Generate a libgtest.la to help libtool managing dependencies
When building and using googletest from an install tree
we want libtool to generate rpath in the dependent binaries
to allow them to be executed from a build without a need
for LD_LIBRARY_PATH or similar.

For libtool based project this happens automatically
as projects generates .la files and install them.
Provide such a file for gtest as well to allow it to
work smoothly with libtool based projects.

Signed-off-by: Knut Omang <knut.omang@oracle.com>
2019-02-11 20:17:34 +01:00
Jonathan Wakely
48e6f1f387 Stop TestInfo::Run() calling a function through null pointer
If the object was never created then trying to call &Test::DeleteSelf_
will dereference a null pointer, with undefined behaviour.

Fixes #845
2019-02-11 20:15:30 +01:00