744 Commits

Author SHA1 Message Date
misterg
ac885f3ab2 WIP 2017-08-09 11:47:54 -04:00
Herbert Thielen
33edcaed89 be more specific on Test Case 2017-08-09 16:41:38 +02:00
Eduardo Cáceres
67fcf00703 Punctuation
Missing periods
2017-08-09 14:10:23 +02:00
Herbert Thielen
e022dcded8 Merge branch 'master' into hethi/remove-old-docs 2017-08-09 11:03:27 +02:00
misterg
ab8f2b0d09 WIP, win testing 2017-08-08 15:54:36 -04:00
misterg
40a909b4e5 WIP, windows testing 2017-08-08 15:37:38 -04:00
misterg
a2006b2ab0 WIP, windows testing 2017-08-08 15:34:40 -04:00
misterg
c75de0aa92 WIP, windows testing 2017-08-08 15:32:30 -04:00
misterg
8815087cfa WIP 2017-08-08 15:17:56 -04:00
Gennadiy Civil
40aa72c7dc Merge pull request #675 from theHacker/master
Fix: Markdown in V1_7_Primer.md
2017-08-08 11:53:40 -04:00
Gennadiy Civil
22d1a7a1a7 Merge pull request #909 from AsturaPhoenix/patch-1
Update Primer.md
2017-08-07 23:01:42 -04:00
Gennadiy Civil
7890f7215e Merge pull request #1180 from aconverse/master
Use wider types to prevent unsigned overflow diagnostics
2017-08-07 15:37:15 -04:00
David Benjamin
ca6a70c608 Pass MSVC's C4826 warning.
MSVC has an optional warning which flags when 32-bit pointers get cast
into a 64-bit value. This is a little overaggressive I think, but to
ease compiling in projects with aggressive warnings, fix this by just
casting to const void * directly. Modern GCCs seem to compile it just
fine.
2017-08-07 14:56:40 -04:00
misterg
aecea3842c Samples changes upstreaming 2017-08-07 13:25:03 -04:00
misterg
52a9c14c48 Samples changes upstreaming 2017-08-07 13:20:57 -04:00
Herbert Thielen
0f702cebb0 add note about different definitions of Test Case
There are contradictory definitions of the term "test case", so prepare
new users in Primer.md to avoid confusion.
2017-08-05 15:12:12 +02:00
Herbert Thielen
212f4d793e fix small typo in comment 2017-08-05 12:42:00 +02:00
Alex Converse
deb99a9d26 Use wider types to prevent unsigned overflow diagnostics
The rest of the (covered) codebase is already integer overflow clean.
This is a cherry-pick of an internal change.

TESTED=gtest_shuffle_test goes from fail to pass with -fsanitize=integer
2017-08-03 14:12:25 -07:00
Gennadiy Civil
ca102b1f9d Merge pull request #1030 from vpfautz/master
Fixed some typos
2017-08-03 16:49:13 -04:00
Gennadiy Civil
e1f3d8d175 Merge pull request #671 from mehagar/patch-1
Fix typo in AdvancedGuide.md
2017-08-02 17:07:27 -04:00
Gennadiy Civil
0cb2eeb5f1 Merge pull request #764 from flyd1005/wip-fix-typo
remove duplicated words
2017-08-02 17:04:33 -04:00
Gennadiy Civil
73f321590a Merge pull request #962 from klimkin/klimkin-patch-typo
Fix a typo
2017-08-02 16:55:50 -04:00
Gennadiy Civil
d966d5fbe0 Merge pull request #968 from nicolacavallini/link_typed_test_docs
added link to sample 6 in the  documentation of typed test
2017-08-02 16:45:13 -04:00
misterg
f63e2a14a2 WIP 2017-08-01 14:36:29 -04:00
Herbert Thielen
ec19d455bc fix links to Google C++ Style Guide 2017-07-30 17:05:48 +02:00
Herbert Thielen
b3908406e6 remove doc of former versions
The documentation of former versions is available in the history (e.g.
by checking out the appropriate git tags), so there is no need to keep
them in parallel to the current documentation.
2017-07-30 16:26:29 +02:00
Herbert Thielen
f6ac9a30a4 remove obsolete reference to SVN trunk 2017-07-30 16:25:58 +02:00
Gennadiy Civil
6527ee0624 Merge pull request #1107 from lipk/patch-1
Minor grammar fix in docs.
2017-07-26 15:29:54 -04:00
Zulkarnine Mahmud
2960aa54e2 Remove duplicate code 2017-07-16 21:59:26 +09:00
Zulkarnine Mahmud
a6b146dfdd Fix assumption for foreground bit offset 2017-07-15 17:44:18 +09:00
Vincent Palancher
4568374a6e Fixes a typo in FAQ.md 2017-07-05 14:12:58 +02:00
Che-Hsun Liu
509f7fe840 Update googletest README.md
Use `EXCLUDE_FROM_ALL` in `add_subdirectory` to prevent `make install` from including lots of headers from gtest/gmock.
```
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
                 ${CMAKE_BINARY_DIR}/googletest-build
                 EXCLUDE_FROM_ALL)
```
2017-07-02 20:19:03 +08:00
Scott Slack-Smith
c958e26fd0 *Silence false positive memory leaks reported by Microsoft's debug CRT*
Add a new RAII MemoryIsNotDeallocated class that excludes memory allocations from Microsoft’s debug CRT leak detection report.
We use this RAII class to silence 2 false positive leaks that are caused by memory allocations that are intentionally never deallocated.

*Background*
The MS debug CRT has a lightweight memory leak detection mechanism that can only detect if a memory allocation is missing a matching deallocation.
Consequently, it will report a false positive leak for memory that’s intentionally never deallocated. For example, memory that’s reachable for the entire lifetime of a app.
Note the MS debug CRT is always tracking memory allocations but the final memory leak report is disabled by default. As you can’t avoid paying for its cost, you may as well use it.

The memory leak report can be enabled by calling the following function
  #ifdef _MSC_VER
  _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
  #endif // _MSC_VER
anywhere before exiting main.

For example, the following are the false positive leaks reported before this change;

Detected memory leaks!
Dumping objects ->
{750} normal block at 0x015DF938, 8 bytes long.
Data: <  ]     > 00 F9 5D 01 00 00 00 00
{749} normal block at 0x015DEE60, 32 bytes long.
Data: <` ] ` ] ` ]     > 60 EE 5D 01 60 EE 5D 01 60 EE 5D 01 01 01 CD CD
{748} normal block at 0x015DF900, 12 bytes long.
Data: <8 ] ` ]     > 38 F9 5D 01 60 EE 5D 01 00 00 00 00
{747} normal block at 0x015DA0F8, 24 bytes long.
Data: <                > FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00
Object dump complete.

As you can see from above it’s not easy to identify the above are false positives. Consequently, if false positive leaks are not fixed or silenced, then it becomes impractical to identify real memory leaks.
2017-06-30 17:12:56 +01:00
Zulkarnine Mahmud
6a75e3c169 Remove unnecessary const 2017-06-29 09:52:41 +09:00
Zulkarnine Mahmud
26b7ac3b18 Add helper functions for text color calculation 2017-06-29 09:47:52 +09:00
Billy Donahue
4bab34d208 Merge pull request #1081 from krytarowski/netbsd-1
Add NetBSD support
2017-06-23 19:35:25 -04:00
Zulkarnine Mahmud
271fb8ff5e Fix a problem when bg_color == fg_color
Invert the intensity bit if the background_color == foreground_color
2017-06-22 11:06:17 +09:00
Chris-Sharpe
19cace2873 Colouring in help text 2017-06-21 16:19:25 +01:00
Zulkarnine Mahmud
365df11427 Add background_mask instead of using magic number 2017-06-21 09:17:51 +09:00
Zulkarnine Mahmud
649aa29552 Fix background color in ColoredPrintf
Re-use existing background color for Widows' console window.
This fixes a problem where the background color for ColoredPrintf would be BLACK even if the user's console is using a different BG color.
2017-06-20 15:40:53 +09:00
Tanzinul Islam
e494290512 Allow death test child to bypass WER under MinGW
The mechanics of suppressing debugger trapping and Windows Error Reporting for the crashed child process in a death test are currently guarded under the `GTEST_HAS_SEH` macro. This seems unnecessary, as the logic does not call any APIs related to Structured Error Handling.

Replace the guarding macro with the more permissive `GTEST_OS_WINDOWS`, so that Windows toolchains without SEH support (e.g. MinGW) can benefit from it.

Fixes: #1116
2017-06-19 03:12:42 +01:00
Billy Donahue
c2d90bddc6 Create gtest-internal.h 2017-06-11 18:34:04 -04:00
jorgehb
00ed9b566e Fixing float comparison broken link
Updating the link with a valid one. The old one was considered obsolete by the publisher.
2017-06-08 10:01:55 -04:00
lipk
dca9d5fc51 Remove unnecessary 'the'. 2017-05-30 17:29:32 +02:00
Billy Donahue
42bc671f47 Merge pull request #1091 from nico/wmicro
Fix -Wmicrosoft-cast warnings when using gtest with clang on Windows.
2017-05-23 11:10:42 -04:00
Gennadiy Civil
76491b74de Changes add ability to overwrite TempDir(), issue https://github.com/google/googletest/issues/1093 2017-05-18 10:19:28 -04:00
Billy Donahue
7cc548dcbf Merge pull request #1089 from nico/stdstring
Use std::string and ::string explicitly in gtest and gmock code.
2017-05-16 17:00:03 -04:00
Billy Donahue
078d5d930a Merge pull request #1090 from nico/typo
Fixing typo in documentation.
2017-05-15 23:54:23 -04:00
Nico Weber
e1466ba4fe Gender-neutralize comments in gtest.h.
This merges a Google-internal change.
2017-05-15 18:00:29 -04:00
Nico Weber
09fd5b3ebf Use std::string and ::string explicitly in gtest and gmock code.
This merges a Google-internal change (117235625).

Original CL description:
This CL was created manually in about an hour with sed, a Python script
to find all the places unqualified 'string' was mentioned, and some help
from Emacs to add the "std::" qualifications, plus a few manual tweaks.
2017-05-15 17:53:04 -04:00
Nico Weber
b2cbbec04c Fix -Wmicrosoft-cast warnings when using gtest with clang on Windows.
This upstreams a Google-internal change.

Original CL description:
The C++ standard says that function pointers are not implicitly
convertible to object pointers. Visual Studio disregards that and allows
implicit conversion between function pointers and object points, and
enough code relies on this that clang follows suit in
Microsoft-compatibility mode.

However, clang emits a -Wmicrosoft-cast warning when such a conversion
is done:

E:\b\c\b\win_clang\src\sandbox\win\src\sync_dispatcher.cc(42,7):
    warning: implicit conversion between pointer-to-function and
             pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]

This change fixes this warning in gtest, while hopefully not changing
any behavior. The change does two things:

1. It replaces the if in DefaultPrintTo with SFINAE
2. In C++11 mode, it uses enable_if<is_function<>> instead of
   ImplicitlyConvertible<T*, const void*> to check if the
   explicit cast is needed.

With this change, functions will use the branch with the reintpret_casts
with Visual Studio and clang/win, and clang no longer needs to warn
that it implicitly converts a function pointer to a void pointer.
2017-05-15 17:21:25 -04:00
Nico Weber
6c0c8a7ea5 Fixing typo in documentation.
This upstreams a Google-internal change.
2017-05-15 17:12:19 -04:00
Billy Donahue
294f72bc77 Merge pull request #725 from donhuff/xcode-headers
Add missing headers to Xcode framework target.
2017-05-15 11:44:37 -04:00
Billy Donahue
8c7f93feda Merge pull request #1078 from pwnall/gtest_api_port
Pick up GTEST_API_ definition in gtest/internal/custom/gtest-port.h.
2017-05-10 22:10:01 -04:00
Billy Donahue
887d569eb0 Merge pull request #965 from davidben/format-attr
Annotate ColoredPrintf with the format attribute and fix bugs.
2017-05-07 01:07:16 -04:00
Kamil Rytarowski
fac0dfbe73 Add NetBSD support
NetBSD is a modern UNIX-like Operating System.

Enable GTEST_HAS_PTHREAD and GTEST_HAS_DEATH_TEST on NetBSD.
2017-05-06 04:18:58 +02:00
Victor Costan
b7cf4414d9 Pick up GTEST_API_ definition in gtest/internal/custom/gtest-port.h.
This makes it possible for a port to define the specifier used for
exported symbols without having to change Google Test.
2017-05-04 10:19:47 -07:00
Billy Donahue
0ad83afdaa Merge pull request #1034 from dankegel/master
Minimal changes to fix build failures on Microsoft Visual Studio 2015
2017-05-02 14:53:21 -04:00
Gennadiy Civil
611e8a99de Changes to make TempDir() public
Fixes #1076.
2017-05-02 14:16:11 -04:00
Claus Stovgaard
a6418a4dd1 Merge remote-tracking branch 'github_google/master' into master-github_frosteyes 2017-04-05 10:18:07 +02:00
Dan Kegel
518e0519ca Minimal changes to fix build failures on Microsoft Visual Studio 2015
Fixes the following errors:

hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [googlemock\gtest\gtest-printers_test.vcxproj]
hash_set(17): error C2338: <hash_set> is deprecated and will be REMOVED. Please use <unordered_set>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [googlemock\gtest\gtest-printers_test.vcxproj]
googletest\test\gtest_catch_exceptions_test_.cc(152): error C2220: warning treated as error - no 'object' file generated
googletest\test\gtest_catch_exceptions_test_.cc(152): warning C4297: 'CxxExceptionInDestructorTest::~CxxExceptionInDestructorTest': function assumed not to throw an exception but does
  googletest\test\gtest_catch_exceptions_test_.cc(152): note: destructor or deallocator has a (possibly implicit) non-throwing exception specification

There were already some checks for _MSC_VER in the code, so this commit
continues in that vein.
2017-03-01 18:40:48 -08:00
vpfautz
a2451c7403 Fixed some typos 2017-02-26 19:15:33 +01:00
Olivier Clavel
fa892afcb9 Wrong version reported (1.7.0 should be 1.8.0)
`gtest-config --version` reports wrong version.

Made against master branch but please note that this affects tag release-1.8.0 and the distribution tarballs.
2017-02-13 14:59:00 +01:00
srz_zumix
9655b9f53d fix typo /GTEST_ATTRIBUTE_UNUSED/GTEST_ATTRIBUTE_UNUSED_/ 2017-02-03 08:05:22 +09:00
Mike Bjorge
06a81e9357 Add GTEST_ATTRIBUTE_UNUSED_ to REGISTER_TYPED_TEST_CASE_P
If REGISTER_TYPED_TEST_CASE_P is included in a header file, but
the .cc file does not declare INSTANTIATE_TYPED_TEST_CASE_P, an
unused-variable warning may be raised by the compiler.
2017-01-09 16:02:55 -08:00
nicolacavallini
2eaab21554 added link to sample 6 in the documentation of typed test 2016-12-23 11:45:08 +01:00
David Benjamin
53c478d639 Annotate ColoredPrintf with the format attribute and fix bugs.
googletest doesn't currently build with clang's very aggressive
-Wformat-nonliteral warning. It requires that all non-literal format
strings come from the argument of a function annotated with a compatible
format attribute.

Fixing that reports that ColoredPrintf's callers weren't passing the
normal -Wformat warning. Some messages were passed directly into the
format string rather than via "%s".
2016-12-21 20:57:21 -05:00
Billy Donahue
5e7fd50e17 Merge pull request #658 from audiofanatic/ExternalProject_at_configure_time
Added docs for ExternalProject download during CMake step
2016-12-18 11:59:12 -05:00
Craig Scott
c0059a79f8 2.6.4 is the minimum CMake version, so enforce it (#656) 2016-12-17 19:15:04 -05:00
Craig Scott
cb502b7ad1 Added CMake configure-time download instructions to docs
Adds instructions for how to add gtest and gmock to
another CMake project directly. Downloading of the
googletest sources happens as configure time, allowing
it to be added to the main build directly via the
add_subdirectory() command. This ensures googletest is
built with the same compiler settings, etc. and will
typically result in a more robust and more convenient
build arrangement.
2016-12-18 09:01:27 +11:00
Alexey Klimkin
3ec005239f Fix a typo
Help says "FILE_PATH defaults to test_details.xml", but the real path is test_detail.xml.
2016-12-12 16:38:14 -08:00
srz_zumix
75b683df46 Fix or condition typo ( '|' -> '||' ) 2016-11-11 12:21:56 +09:00
Martin Oberhuber
008e54c1dd Fix #923 - support CMAKE_CROSSCOMPILING_EMULATOR for tests
Replaced legacy syntax of cmake add_test() with more modern syntax.
This allows running gtests's own tests on remote (cross) systems
using CMAKE_CROSSCOMPILING_EMULATOR with cmake-3.3 or newer.
2016-11-05 09:25:59 +01:00
Billy Donahue
a2b8a8e076 Merge pull request #918 from DanAlbert/fix-android-GTEST_HAS_CLONE
Fix detection of GTEST_HAS_CLONE for Android.
2016-11-03 16:36:28 -04:00
Billy Donahue
3447fc31b4 Merge pull request #728 from DanAlbert/tuple-stlport
Fix a test to compile when tuple isn't available.
2016-11-02 13:54:19 -04:00
Dan Albert
4eafafbde5 Fix detection of GTEST_HAS_CLONE for Android.
This was not in Gingerbread for anything but ARM (even though the
libs were hacked to lie about it being available in gingerbread).
2016-11-01 06:37:49 -07:00
Ross Wang
0b6d947517 Update Primer.md
Correcting typo: "text fixture" => "test fixture"
2016-10-18 13:56:03 -07:00
iignatev
7fbc5986cc enable null detection on Solaris Studio 12u4+ 2016-10-17 20:49:59 +03:00
Arkadiy Shapkin
d8fe70f477 Fix build with MinGW-w64 2016-09-05 00:57:49 +03:00
tommyleo2
82396f2d54 Update Primer.md
fix bug in string comparison assertions table where _str2_ is mistakenly written as _str_2
2016-09-02 19:45:48 +08:00
Claus Stovgaard
68f19facc2 Moved the ignoring of *.pyc files to top level for also covering googlemock python scripts. 2016-08-30 16:15:46 +02:00
Billy Donahue
ed9d1e1ff9 Merge pull request #721 from ilmagico/fix-mingw-threads
Fix compilation of googletest with MinGW using Win32 threads
2016-08-24 08:15:38 -04:00
Arkadiy Shapkin
43c0ae3375 Support running MSVC build on AppVeyour 2016-06-27 11:40:27 +03:00
Billy Donahue
ce7ec96eda Rollback change #808. 2016-06-26 18:33:10 -04:00
David Mott
2489c30747 Fix to tests that return object which implement operator bool 2016-06-25 16:21:09 -05:00
David Mott
e35015f539 fix to operator precedence in GTEST_TEST_BOOLEAN_ with expressions that implement operator bool 2016-06-25 15:41:19 -05:00
Tobias Markus
08d76be4cc Performance fixes reported by cppcheck 2016-05-22 18:35:52 +02:00
Li Peng
266a185a52 remove duplicated words
Signed-off-by: Li Peng <lip@dtdream.com>
2016-04-27 16:41:27 +08:00
Manuel Binna
207147495c Fix whitespace in paragraph 2016-03-16 06:49:57 +01:00
Billy Donahue
72416fab75 Merge pull request #724 from duggelz/master
Read Bazel's $XML_OUTPUT_FILE environment variable
2016-03-15 18:20:27 -04:00
Don Huff
d254052f7f Update C++ language and library settings to match SDK projects. 2016-03-11 07:58:27 -06:00
Dan Albert
3429113886 Fix a test to compile when tuple isn't available. 2016-03-02 15:51:28 -08:00
Doug Greiman
d23cf2b157 Restructure test so each scenario is independent. 2016-03-02 12:07:42 -08:00
Doug Greiman
6991f422b6 Fix env_var_test to ignore XML_OUTPUT_FILE if already set 2016-03-01 17:44:02 -08:00
Doug Greiman
5db9cbbc23 Restructure $XML_OUTPUT_FILE logic 2016-02-26 14:26:23 -08:00
Doug Greiman
12b2f23e8e Fix inconsistent style 2016-02-25 19:03:46 -08:00
Don Huff
407b0aaf85 Add missing headers to Xcode framework target. 2016-02-25 10:09:16 -06:00
Doug Greiman
d6790f26ca Read Bazel's $XML_OUTPUT_FILE environment variable
If $XML_OUTPUT_FILE is set, and $GTEST_OUTPUT and --gtest_output are not
specified, produce output as if GTEST_OUTPUT=xml:$XML_OUTPUT_FILE had
been set.
2016-02-23 18:50:08 -08:00
Daniele Tamino
a138385e48 Don't use pthread when on MinGW even if available
It's not supported, and native Windows threading is available for MinGW
2016-02-22 14:07:12 -08:00
Daniele Tamino
9759dcda3c Fix compilation on MinGW with native threads 2016-02-22 14:07:12 -08:00