2706 Commits

Author SHA1 Message Date
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
Chris Johnson
47568eade6
fix: Correct *-all.cc file paths 2019-02-05 16:16:43 -06:00
Gennadiy Civil
9a502a5b14
Merge pull request #2100 from ngie-eign/test-clang-osx-every-travis-run
Test out changes with clang/OSX each PR using Travis CI
2019-02-05 12:12:38 -05:00
Gennadiy Civil
e28b50609e
Merge pull request #2103 from kw-udon/fix-json-in-advanced-md
Fix an invalid example of JSON report in advanced.md
2019-02-05 12:10:51 -05:00
Keiichi Watanabe
b3679d8565 Fix an invalid example of JSON report in advanced.md
This is just a mistake in the document. Google Test doesn't output
such an invalid JSON report.

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
2019-02-05 21:05:16 +09:00
Gennadiy Civil
f80d6644d4
Update .travis.yml 2019-02-04 15:30:37 -05:00
Gennadiy Civil
5dfcd1bc42
Update .travis.yml 2019-02-04 15:29:18 -05:00
Enji Cooper
9df5475b82 Test out changes with clang/OSX each PR using Travis CI
This will help ensure that test coverage isn't missed when changes that
can impact OSX with clang are submitted. Although not perfect, testing
changes on OSX with clang is an ok proxy [for now] for testing changes on
FreeBSD with clang (testing on FreeBSD is non-trivial, as Travis CI doesn't
support operating systems other than Linux and OSX).

In order to support this, install the packages via homebrew using a
`addons::homebrew::packages` block (similar to `addons::apt::packages`
for Ubuntu), as documented in the Travis CI docs
( https://docs.travis-ci.com/user/installing-dependencies/ ). While
here, try pushing apt* calls into the Travis config for Ubuntu, instead
of delaying the equivalent calls in the `ci/*.sh` scripts. Keep the
`ci/*.sh` scripts for ease of testing locally (and extend the OSX one to
install gcc 4.9 and llvm 3.9, like the travis config does).

In order to accomodate this change (and because the homebrew package for
llvm@3.9 doesn't automatically add clang*-3.9 to `$PATH`), `$PATH` needs
to be adjusted to find the llvm@3.9 toolchain.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-02-04 12:19:27 -08:00
misterg
50059a12b9 Googletest export
Address -Wgnu-zero-variadic-macro-arguments
Originally in OSS PR #2063 https://github.com/google/googletest/pull/2063
Fix regression in INSTANTIATE_TEST_SUITE_P macro to accept function pointers properly.

PiperOrigin-RevId: 232316698
2019-02-04 14:19:58 -05:00
misterg
52ea4f7bea Googletest export
Mark legacy _TEST_CASE_ macros as deprecated

PiperOrigin-RevId: 232303251
2019-02-04 14:19:50 -05:00
Abseil Team
876bdfa565 Googletest export
Update example code in gtest.h to prefer override over virtual now
that it is widely available in C++11.

PiperOrigin-RevId: 232057792
2019-02-04 14:19:41 -05:00
Gennadiy Civil
471f5bc433 Merge pull request #2098 from ciband:feat/finish_platformio_support
PiperOrigin-RevId: 232028696
2019-02-04 14:19:31 -05:00
Matthias Grob
f89253434f cmake: detect Cygwin which needs extensions to build 2019-02-04 20:03:46 +01:00
Matthias Grob
67265e0706 cmake: move global project definition to beginning
such that necessary cmake variables to detect Cygwin are defined
when setting the C++ standard and we can distinguish.
2019-02-04 20:03:46 +01:00
Abseil Team
0ea2d8f8fa Googletest export
Fix stack overflow in AnyOfArray tests.

PiperOrigin-RevId: 231881125
2019-02-01 12:52:31 -05:00
Chris Johnson
53798de939
chore: Add PlatformIO supported platforms list 2019-02-01 10:05:31 -06:00
Chris
b2b2462250 fix: Add Arduino to embedded platform list
Added Arduino to the embedded platform list to allow for a stubbed out version
of GetCurrentDir.
2019-01-31 21:56:34 -06:00
Chris
fe519d64a6 fix: Add *_all.cc files to ignore list
Added [gmock|gtest]_all.cc to PIO ignore list to avoid getting duplicate
symbols since PIO will compile the individual files.
2019-01-31 21:56:30 -06:00
Gennadiy Civil
4f4c01d8c8
Merge pull request #2092 from Billy4195/Update_README
Fix README.md broken link
2019-01-31 17:15:49 -05:00
Billy SU
1c23efb424
Fix README.md broken link
Fix the **include/gtest/internal/gtest-port.h** link in the `Tweaking Google Test` title
2019-01-31 08:23:15 +08:00
Gennadiy Civil
e04254989d
Merge pull request #2091 from google/gennadiycivil-patch-1
Repeat #2090
2019-01-30 15:36:27 -05:00
Gennadiy Civil
acde02c635
Repeat #2090
Testing
2019-01-30 14:44:27 -05:00
Ashley Hedberg
8e37822b4b Merge pull request #2063 from mathbunnyru:master
PiperOrigin-RevId: 231456275
2019-01-30 14:26:14 -05:00
Gennadiy Civil
ce29e55cfc
Merge pull request #2090 from KellyWalker/patch-1
Update advanced.md casing in example
2019-01-30 13:19:14 -05:00
Kelly Walker
2775733ee1
Update advanced.md casing in example
Updated the example that says not to use SetupTestSuite with a small 'u' to actually use a small 'u'
2019-01-30 09:01:58 -06:00
Gennadiy Civil
9318a18ccf
Added -Wgnu-zero-variadic-macro-arguments" clang
This is inspired by work in http://go/gh/google/googletest/pull/2063 but in a separate commit
2019-01-29 14:38:50 -05:00
Gennadiy Civil
1f42ae7353 Merge pull request #2063 from mathbunnyru:master
PiperOrigin-RevId: 231434457
2019-01-29 14:32:06 -05:00
Gennadiy Civil
01148677a9 Merge pull request #2086 from hugolm84:fix-dynamic/static-runtime-link
PiperOrigin-RevId: 231286700
2019-01-28 17:31:42 -05:00
Hugo Lindström
718bb65acf Avoid dynamic/static runtime linking (LNK4098) by properly replacing MD(d)->MT(d) in both C and CXX flags, resolves 2074 2019-01-28 21:07:41 +01:00
Gennadiy Civil
5ec7f0c4a1 Merge pull request #2079 from acozzette:fix-dist
PiperOrigin-RevId: 230902623
2019-01-25 11:01:36 -05:00
Adam Cozzette
46b81732b6 Fixed "make dist"
I made a few updates to the Makefile.am files so that "make dist"
succeeds and produces a usable tarball. We need this for protobuf
because the protobuf tarballs include a bundled copy of googletest.
2019-01-24 14:51:40 -08:00
Gennadiy Civil
bf07131c1d Merge pull request #2041 from ciband:chore/fix_library_json
PiperOrigin-RevId: 230554814
2019-01-23 13:27:16 -05:00
Abseil Team
fdc59ffd05 Googletest export
Add AllOfArray matcher that verifies a value matches all member of some array/container/list/set/..., e.g:
EXPECT_THAT(1, AnyOfArray({1, 2, 3}))
In the simplest form this is identical to AnyOf(1, 2, 3). But unlike that one it works on containers.

Add AnyOfArray matcher that verifies a value matches any member of some
array/container/list/set/...

PiperOrigin-RevId: 230403653
2019-01-23 13:27:08 -05:00
Abseil Team
569fba4d74 Googletest export
Make internal FunctionMocker class final

PiperOrigin-RevId: 230332778
2019-01-22 13:12:13 -05:00
Pavel Samolysov
91bfc08228 Enable CI on Windows (appveyor) with Bazel
Signed-off-by: Pavel Samolysov <samolisov@gmail.com>
2019-01-22 12:28:09 +03:00
Abseil Team
9518a57428 Googletest export
Fix mocking method arguments with templated copy constructors.

A previous change removed workarounds for old compilers from googletest and googlemock. Unfortunately, a bit of code that started as a workaround for Symbian's C++ compiler is still needed to avoid copy/move constructor ambiguity when mocking functions with certain argument types.

The test case added by this CL is extracted from Chrome's codebase, and was discovered while attempting to roll googletest.

PiperOrigin-RevId: 229801765
2019-01-18 14:06:03 -05:00
Ayaz Salikhov
7c4164bf40 Fix INSTANTIATE_TEST_CASE_P with zero variadic arguments 2019-01-18 14:53:56 +03:00
Abseil Team
0adeadd283 Googletest export
Refactor the `Invoke` and `InvokeWithoutArgs` actions:
 - Replace pump'd classes and functions with templates.
 - Make the polymorphic actions be polymorphic functors instead.
 - Fix Invoke(Callback*) to work with subclasses of the callbacks, instead of trying to diagnose that in gmock_doctor.

PiperOrigin-RevId: 229604112
2019-01-17 14:41:08 -05:00
misterg
eb9225ce36 Googletest export
Change remaining samples to use new Test Suite API

PiperOrigin-RevId: 229231566
2019-01-14 17:02:11 -05:00
Abseil Team
9acd065a90 Googletest export
Add move-only argument support to almost all remaining matchers.

PiperOrigin-RevId: 229030728
2019-01-14 17:02:03 -05:00
Abseil Team
097407fd3c Googletest export
Deduplicate testing::ReferenceWrapper with std::reference_wrapper.
Minor cleanups in matchers_test.

PiperOrigin-RevId: 229022872
2019-01-14 17:01:56 -05:00
Pavel Samolysov
c868da1988 Enable building as a shared library (dll) on Windows with Bazel
While the google test library is being built as a shared library using Bazel,
so that there is a rule like

cc_test(
     name = "iterator_traits_test",
     linkstatic = 0,
     deps = ["@gtest//:gtest_main"],
     ...
)

in a BUILD file, the following error appears on Windows:

INFO: Found 1 test target...
ERROR: C:/../external/gtest/BUILD.bazel:55:1: output 'external/gtest/gtest.if.lib' was not created
ERROR: C:/../external/gtest/BUILD.bazel:55:1: not all outputs were created or valid
Target //test:iterator_traits_test failed to build

The reason is a missing "win_def_file" attribute of the "gtest" and
"gtest_main" rules in the BUILD.bazel inside the google test library
package.

The "windows_export_all_symbols" feature is added to the rules, this
feature forces Bazel to export all symbols from the google test library
to linker. I believe exporting all symbols from a testing library makes
no problem for the application from a point of view on encapsulation.

Signed-off-by: Pavel Samolysov <samolisov@gmail.com>
2019-01-14 16:20:56 +03:00
misterg
0599a7b841 Googletest export
Change tests to use new Test Suite API

PiperOrigin-RevId: 228908894
2019-01-11 13:59:22 -05:00
Gennadiy Civil
2edadcedf3
Workaround homebrew issue 2019-01-10 18:20:44 -05:00
Gennadiy Civil
6693e85b04 Merge branch 'master' of github.com:google/googletest 2019-01-10 16:33:42 -05:00
Abseil Team
bc1023b413 Googletest export
Fix warning about deprecation of implicit operations such as copy constructors or assignment operators.

Specifically:

MatcherBase's default copy constructor, assignment operator, move operator, and move assignment operator are now declared explicitly rather than depending on the compiler implicit generation (which is disallowed/warned against due to MatcherBase's declaration of the destructor).

PiperOrigin-RevId: 228573333
2019-01-10 16:32:37 -05:00
Abseil Team
7a7e2bba1d Googletest export
...text exposed to GitHub repo https://www.github.com/google/googletest

PiperOrigin-RevId: 228573333
2019-01-10 16:18:48 -05:00
gennadiycivil
50f1a77955 Merge pull request #2051 from enptfb55:master
PiperOrigin-RevId: 228337465
2019-01-08 11:51:17 -05:00
misterg
f31bf1d362 Googletest export
Replace testing::internal::ImplicitlyConvertible with std::is_convertible
Fixes #2054

PiperOrigin-RevId: 228334305
2019-01-08 11:51:05 -05:00
Abseil Team
216c37f057 Googletest export
Drop generated file gmock-generated-internal-utils.h.

PiperOrigin-RevId: 228232195
2019-01-08 11:50:56 -05:00
Chris
45c58aa6f3 fix: Add Arduino setup()/loop() functions back
Added setup()/loop() functions back to *_main.cc files to support compiling in CI.  Future features could enable this for the end user.
2019-01-07 12:37:34 -06:00
gennadiycivil
644319b9f0 Merge pull request #2048 from ciband:chore/clang_tidy
PiperOrigin-RevId: 228173023
2019-01-07 12:09:34 -05:00
Abseil Team
b6cd405286 Googletest export
Fix GTEST_IS_NULL_LITERAL_ for types that have magic implicit conversions.

PiperOrigin-RevId: 227879345
2019-01-07 12:09:25 -05:00
Sal Amato
8369b5bbd0 fixing build errors for unused parameter 2019-01-06 06:24:26 -05:00
Chris
ade8baa7d2 clang-tidy: modernize-deprecated-headers 2019-01-05 11:21:56 -06:00
Chris
23e6937873 misc: Reapply Arduino functions 2019-01-03 21:23:06 -06:00
Chris
202dcabf39 misc: Revert formatting changes. 2019-01-03 21:22:00 -06:00
Chris
fd1c7976ae Merge branch 'chore/fix_library_json' of https://github.com/ciband/googletest into chore/fix_library_json 2019-01-03 21:15:19 -06:00
Chris Johnson
0ffa5f9779
Merge branch 'master' into chore/fix_library_json 2019-01-03 21:13:20 -06:00
Chris
23533009b8 chore: Add Windows cmake files to .gitignore 2019-01-03 21:06:20 -06:00
Chris
adc5045cbf chore: Alphabetize exclude directories. 2019-01-03 21:01:02 -06:00
Gennadiy Civil
3880b13e4c
Merge pull request #2042 from gennadiycivil/master
Update Docs TestCase->TestSuite
2019-01-03 21:36:19 -05:00
Gennadiy Civil
58e62f7a98 Merge branch 'master' of https://github.com/google/googletest 2019-01-03 17:18:32 -05:00
Gennadiy Civil
5d3a2cd9c8 Update docs, TestCase->TestSuite 2019-01-03 17:18:03 -05:00
misterg
827515f8a0 Googletest export
Fixes #1261

PiperOrigin-RevId: 227740670
2019-01-03 16:40:27 -05:00
misterg
3a460a26b7 Googletest export
TestCase->TestSuite refactoring

PiperOrigin-RevId: 227702164
2019-01-03 16:40:20 -05:00