Merge branch 'master' into master
This commit is contained in:
commit
16c65a476a
@ -1,5 +1,5 @@
|
||||
# Build matrix / environment variable are explained on:
|
||||
# http://about.travis-ci.org/docs/user/build-configuration/
|
||||
# https://docs.travis-ci.com/user/customizing-the-build/
|
||||
# This file can be validated on:
|
||||
# http://lint.travis-ci.org/
|
||||
|
||||
|
@ -170,7 +170,7 @@ Admittedly, this test is contrived and doesn't do much. You can easily achieve t
|
||||
|
||||
## Using Google Mock with Any Testing Framework ##
|
||||
If you want to use something other than Google Test (e.g. [CppUnit](http://sourceforge.net/projects/cppunit/) or
|
||||
[CxxTest](http://cxxtest.tigris.org/)) as your testing framework, just change the `main()` function in the previous section to:
|
||||
[CxxTest](https://cxxtest.com/)) as your testing framework, just change the `main()` function in the previous section to:
|
||||
```
|
||||
int main(int argc, char** argv) {
|
||||
// The following line causes Google Mock to throw an exception on failure,
|
||||
|
@ -528,7 +528,7 @@ interface, which then can be easily mocked. It's a bit of work
|
||||
initially, but usually pays for itself quickly.
|
||||
|
||||
This Google Testing Blog
|
||||
[post](http://googletesting.blogspot.com/2008/06/defeat-static-cling.html)
|
||||
[post](https://testing.googleblog.com/2008/06/defeat-static-cling.html)
|
||||
says it excellently. Check it out.
|
||||
|
||||
## My mock object needs to do complex stuff. It's a lot of pain to specify the actions. Google Mock sucks! ##
|
||||
|
@ -242,7 +242,7 @@ class AbstractRpcServer(object):
|
||||
The authentication process works as follows:
|
||||
1) We get a username and password from the user
|
||||
2) We use ClientLogin to obtain an AUTH token for the user
|
||||
(see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
|
||||
(see https://developers.google.com/identity/protocols/AuthForInstalledApps).
|
||||
3) We pass the auth token to /_ah/login on the server to obtain an
|
||||
authentication cookie. If login was successful, it tries to redirect
|
||||
us to the URL we provided.
|
||||
@ -506,7 +506,7 @@ def EncodeMultipartFormData(fields, files):
|
||||
(content_type, body) ready for httplib.HTTP instance.
|
||||
|
||||
Source:
|
||||
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306
|
||||
https://web.archive.org/web/20160116052001/code.activestate.com/recipes/146306
|
||||
"""
|
||||
BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
|
||||
CRLF = '\r\n'
|
||||
@ -807,7 +807,7 @@ class SubversionVCS(VersionControlSystem):
|
||||
# svn cat translates keywords but svn diff doesn't. As a result of this
|
||||
# behavior patching.PatchChunks() fails with a chunk mismatch error.
|
||||
# This part was originally written by the Review Board development team
|
||||
# who had the same problem (http://reviews.review-board.org/r/276/).
|
||||
# who had the same problem (https://reviews.reviewboard.org/r/276/).
|
||||
# Mapping of keywords to known aliases
|
||||
svn_keywords = {
|
||||
# Standard keywords
|
||||
@ -860,7 +860,7 @@ class SubversionVCS(VersionControlSystem):
|
||||
status_lines = status.splitlines()
|
||||
# If file is in a cl, the output will begin with
|
||||
# "\n--- Changelist 'cl_name':\n". See
|
||||
# http://svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
|
||||
# https://web.archive.org/web/20090918234815/svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
|
||||
if (len(status_lines) == 3 and
|
||||
not status_lines[0] and
|
||||
status_lines[1].startswith("--- Changelist")):
|
||||
|
@ -37,7 +37,7 @@
|
||||
// causes a link error when _tmain is defined in a static library and UNICODE
|
||||
// is enabled. For this reason instead of _tmain, main function is used on
|
||||
// Windows. See the following link to track the current status of this bug:
|
||||
// http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=394464 // NOLINT
|
||||
// https://web.archive.org/web/20170912203238/connect.microsoft.com/VisualStudio/feedback/details/394464/wmain-link-error-in-the-static-library // NOLINT
|
||||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
# include <tchar.h> // NOLINT
|
||||
|
||||
|
@ -20,7 +20,7 @@ macro(fix_default_compiler_settings_)
|
||||
if (MSVC)
|
||||
# For MSVC, CMake sets certain flags to defaults we want to override.
|
||||
# This replacement code is taken from sample in the CMake Wiki at
|
||||
# http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace.
|
||||
# https://gitlab.kitware.com/cmake/community/wikis/FAQ#dynamic-replace.
|
||||
foreach (flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
|
@ -6,7 +6,7 @@ This guide will explain how to use the Google Testing Framework in your Xcode pr
|
||||
|
||||
Here is the quick guide for using Google Test in your Xcode project.
|
||||
|
||||
1. Download the source from the [website](http://code.google.com/p/googletest) using this command: `svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only`.
|
||||
1. Download the source from the [website](https://github.com/google/googletest) using this command: `svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only`.
|
||||
1. Open up the `gtest.xcodeproj` in the `googletest-read-only/xcode/` directory and build the gtest.framework.
|
||||
1. Create a new "Shell Tool" target in your Xcode project called something like "UnitTests".
|
||||
1. Add the gtest.framework to your project and add it to the "Link Binary with Libraries" build phase of "UnitTests".
|
||||
@ -18,7 +18,7 @@ The following sections further explain each of the steps listed above in depth,
|
||||
|
||||
# Get the Source #
|
||||
|
||||
Currently, the gtest.framework discussed here isn't available in a tagged release of Google Test, it is only available in the trunk. As explained at the Google Test [site](http://code.google.com/p/googletest/source/checkout">svn), you can get the code from anonymous SVN with this command:
|
||||
Currently, the gtest.framework discussed here isn't available in a tagged release of Google Test, it is only available in the trunk. As explained at the Google Test [site](https://github.com/google/googletest), you can get the code from anonymous SVN with this command:
|
||||
|
||||
```
|
||||
svn checkout http://googletest.googlecode.com/svn/trunk/ googletest-read-only
|
||||
@ -28,7 +28,7 @@ Alternatively, if you are working with Subversion in your own code base, you can
|
||||
|
||||
To use `svn:externals`, decide where you would like to have the external source reside. You might choose to put the external source inside the trunk, because you want it to be part of the branch when you make a release. However, keeping it outside the trunk in a version-tagged directory called something like `third-party/googletest/1.0.1`, is another option. Once the location is established, use `svn propedit svn:externals _directory_` to set the svn:externals property on a directory in your repository. This directory won't contain the code, but be its versioned parent directory.
|
||||
|
||||
The command `svn propedit` will bring up your Subversion editor, making editing the long, (potentially multi-line) property simpler. This same method can be used to check out a tagged branch, by using the appropriate URL (e.g. `http://googletest.googlecode.com/svn/tags/release-1.0.1`). Additionally, the svn:externals property allows the specification of a particular revision of the trunk with the `-r_##_` option (e.g. `externals/src/googletest -r60 http://googletest.googlecode.com/svn/trunk`).
|
||||
The command `svn propedit` will bring up your Subversion editor, making editing the long, (potentially multi-line) property simpler. This same method can be used to check out a tagged branch, by using the appropriate URL (e.g. `https://github.com/google/googletest/releases/tag/release-1.0.1`). Additionally, the svn:externals property allows the specification of a particular revision of the trunk with the `-r_##_` option (e.g. `externals/src/googletest -r60 http://googletest.googlecode.com/svn/trunk`).
|
||||
|
||||
Here is an example of using the svn:externals properties on a trunk (read via `svn propget`) of a project. This value checks out a copy of Google Test into the `trunk/externals/src/googletest/` directory.
|
||||
|
||||
|
@ -154,7 +154,7 @@ c is 10
|
||||
> `ASSERT_PRED*` or `EXPECT_PRED*`, please see
|
||||
> [this](faq#OverloadedPredicate) for how to resolve it.
|
||||
> 1. Currently we only provide predicate assertions of arity <= 5. If you need
|
||||
> a higher-arity assertion, let [us](http://g/opensource-gtest) know.
|
||||
> a higher-arity assertion, let [us](https://github.com/google/googletest/issues) know.
|
||||
|
||||
**Availability**: Linux, Windows, Mac.
|
||||
|
||||
@ -382,7 +382,7 @@ Verifies that `val1` is less than, or almost equal to, `val2`. You can replace
|
||||
|
||||
### Asserting Using gMock Matchers
|
||||
|
||||
Google-developed C++ mocking framework [gMock](http://go/gmock) comes with a
|
||||
Google-developed C++ mocking framework [gMock](../../googlemock) comes with a
|
||||
library of matchers for validating arguments passed to mock objects. A gMock
|
||||
*matcher* is basically a predicate that knows how to describe itself. It can be
|
||||
used in these assertion macros:
|
||||
@ -402,17 +402,17 @@ using ::testing::StartsWith;
|
||||
EXPECT_THAT(Foo(), StartsWith("Hello"));
|
||||
```
|
||||
|
||||
Read this [recipe](http://go/gmockguide#using-matchers-in-gunit-assertions) in
|
||||
Read this [recipe](../../googlemock/docs/CookBook.md#using-matchers-in-google-test-assertions) in
|
||||
the gMock Cookbook for more details.
|
||||
|
||||
gMock has a rich set of matchers. You can do many things googletest cannot do
|
||||
alone with them. For a list of matchers gMock provides, read
|
||||
[this](http://go/gmockguide#using-matchers). Especially useful among them are
|
||||
some [protocol buffer matchers](http://go/protomatchers). It's easy to write
|
||||
your [own matchers](http://go/gmockguide#NewMatchers) too.
|
||||
[this](../../googlemock/docs/CookBook.md#using-matchers). Especially useful among them are
|
||||
some [protocol buffer matchers](https://github.com/google/nucleus/blob/master/nucleus/testing/protocol-buffer-matchers.h). It's easy to write
|
||||
your [own matchers](../../googlemock/docs/CookBook.md#writing-new-matchers-quickly) too.
|
||||
|
||||
For example, you can use gMock's
|
||||
[EqualsProto](http://cs/#piper///depot/google3/testing/base/public/gmock_utils/protocol-buffer-matchers.h)
|
||||
[EqualsProto](https://github.com/google/nucleus/blob/master/nucleus/testing/protocol-buffer-matchers.h)
|
||||
to compare protos in your tests:
|
||||
|
||||
```c++
|
||||
@ -433,7 +433,7 @@ and you're ready to go.
|
||||
|
||||
(Please read the [previous](#AssertThat) section first if you haven't.)
|
||||
|
||||
You can use the gMock [string matchers](http://go/gmockguide#string-matchers)
|
||||
You can use the gMock [string matchers](../../googlemock/docs/CheatSheet.md#string-matchers)
|
||||
with `EXPECT_THAT()` or `ASSERT_THAT()` to do more string comparison tricks
|
||||
(sub-string, prefix, suffix, regular expression, and etc). For example,
|
||||
|
||||
|
@ -162,7 +162,7 @@ result, any in-memory side effects they incur are observable in their respective
|
||||
sub-processes, but not in the parent process. You can think of them as running
|
||||
in a parallel universe, more or less.
|
||||
|
||||
In particular, if you use [gMock](http://go/gmock) and the death test statement
|
||||
In particular, if you use [gMock](../../googlemock) and the death test statement
|
||||
invokes some mock methods, the parent process will think the calls have never
|
||||
occurred. Therefore, you may want to move your `EXPECT_CALL` statements inside
|
||||
the `EXPECT_DEATH` macro.
|
||||
@ -289,7 +289,7 @@ Please make sure you have read [this](advanced.md#how-it-works).
|
||||
|
||||
In particular, death tests don't like having multiple threads in the parent
|
||||
process. So the first thing you can try is to eliminate creating threads outside
|
||||
of `EXPECT_DEATH()`. For example, you may want to use [mocks](http://go/gmock)
|
||||
of `EXPECT_DEATH()`. For example, you may want to use [mocks](../../googlemock)
|
||||
or fake objects instead of real ones in your tests.
|
||||
|
||||
Sometimes this is impossible as some library you must use may be creating
|
||||
@ -704,7 +704,7 @@ mistake in production. Such cleverness also leads to
|
||||
advise against the practice, and googletest doesn't provide a way to do it.
|
||||
|
||||
In general, the recommended way to cause the code to behave differently under
|
||||
test is [Dependency Injection](http://go/dependency-injection). You can inject
|
||||
test is [Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection). You can inject
|
||||
different functionality from the test and from the production code. Since your
|
||||
production code doesn't link in the for-test logic at all (the
|
||||
[`testonly`](http://go/testonly) attribute for BUILD targets helps to ensure
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
*googletest* helps you write better C++ tests.
|
||||
|
||||
googletest is a testing framework developed by the [Testing
|
||||
Technology](http://engdoc/eng/testing/TT/) team with Google's specific
|
||||
googletest is a testing framework developed by the Testing
|
||||
Technology team with Google's specific
|
||||
requirements and constraints in mind. No matter whether you work on Linux,
|
||||
Windows, or a Mac, if you write C++ code, googletest can help you. And it
|
||||
supports *any* kind of tests, not just unit tests.
|
||||
@ -75,7 +75,7 @@ the terms:
|
||||
Meaning | googletest Term | [ISTQB](http://www.istqb.org/) Term
|
||||
:----------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- | :----------------------------------
|
||||
Exercise a particular program path with specific input values and verify the results | [TEST()](#simple-tests) | [Test Case](http://glossary.istqb.org/search/test%20case)
|
||||
A set of several tests related to one component | [TestCase](https://g3doc.corp.google.com/third_party/googletest/googletest/g3doc/primer.md#basic-concepts) | [TestSuite](http://glossary.istqb.org/search/test%20suite)
|
||||
A set of several tests related to one component | [TestCase](#basic-concepts) | [TestSuite](http://glossary.istqb.org/search/test%20suite)
|
||||
|
||||
## Basic Concepts
|
||||
|
||||
|
@ -381,7 +381,7 @@
|
||||
#if GTEST_LANG_CXX11
|
||||
# define GTEST_HAS_STD_TUPLE_ 1
|
||||
# if defined(__clang__)
|
||||
// Inspired by http://clang.llvm.org/docs/LanguageExtensions.html#__has_include
|
||||
// Inspired by https://clang.llvm.org/docs/LanguageExtensions.html#include-file-checking-macros
|
||||
# if defined(__has_include) && !__has_include(<tuple>)
|
||||
# undef GTEST_HAS_STD_TUPLE_
|
||||
# endif
|
||||
@ -393,7 +393,7 @@
|
||||
# elif defined(__GLIBCXX__)
|
||||
// Inspired by boost/config/stdlib/libstdcpp3.hpp,
|
||||
// http://gcc.gnu.org/gcc-4.2/changes.html and
|
||||
// http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x
|
||||
// https://web.archive.org/web/20140227044429/gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x
|
||||
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
|
||||
# undef GTEST_HAS_STD_TUPLE_
|
||||
# endif
|
||||
@ -1801,7 +1801,7 @@ class GTEST_API_ Mutex {
|
||||
// Initializes owner_thread_id_ and critical_section_ in static mutexes.
|
||||
void ThreadSafeLazyInit();
|
||||
|
||||
// Per http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx,
|
||||
// Per https://blogs.msdn.microsoft.com/oldnewthing/20040223-00/?p=40503,
|
||||
// we assume that 0 is an invalid value for thread IDs.
|
||||
unsigned int owner_thread_id_;
|
||||
|
||||
|
@ -242,7 +242,7 @@ class AbstractRpcServer(object):
|
||||
The authentication process works as follows:
|
||||
1) We get a username and password from the user
|
||||
2) We use ClientLogin to obtain an AUTH token for the user
|
||||
(see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
|
||||
(see https://developers.google.com/identity/protocols/AuthForInstalledApps).
|
||||
3) We pass the auth token to /_ah/login on the server to obtain an
|
||||
authentication cookie. If login was successful, it tries to redirect
|
||||
us to the URL we provided.
|
||||
@ -506,7 +506,7 @@ def EncodeMultipartFormData(fields, files):
|
||||
(content_type, body) ready for httplib.HTTP instance.
|
||||
|
||||
Source:
|
||||
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306
|
||||
https://web.archive.org/web/20160116052001/code.activestate.com/recipes/146306
|
||||
"""
|
||||
BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
|
||||
CRLF = '\r\n'
|
||||
@ -807,7 +807,7 @@ class SubversionVCS(VersionControlSystem):
|
||||
# svn cat translates keywords but svn diff doesn't. As a result of this
|
||||
# behavior patching.PatchChunks() fails with a chunk mismatch error.
|
||||
# This part was originally written by the Review Board development team
|
||||
# who had the same problem (http://reviews.review-board.org/r/276/).
|
||||
# who had the same problem (https://reviews.reviewboard.org/r/276/).
|
||||
# Mapping of keywords to known aliases
|
||||
svn_keywords = {
|
||||
# Standard keywords
|
||||
@ -860,7 +860,7 @@ class SubversionVCS(VersionControlSystem):
|
||||
status_lines = status.splitlines()
|
||||
# If file is in a cl, the output will begin with
|
||||
# "\n--- Changelist 'cl_name':\n". See
|
||||
# http://svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
|
||||
# https://web.archive.org/web/20090918234815/svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
|
||||
if (len(status_lines) == 3 and
|
||||
not status_lines[0] and
|
||||
status_lines[1].startswith("--- Changelist")):
|
||||
|
@ -264,7 +264,7 @@ Mutex::~Mutex() {
|
||||
// to clean them up.
|
||||
// TODO(yukawa): Switch to Slim Reader/Writer (SRW) Locks, which requires
|
||||
// nothing to clean it up but is available only on Vista and later.
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa904937.aspx
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/Sync/slim-reader-writer--srw--locks
|
||||
if (type_ == kDynamic) {
|
||||
::DeleteCriticalSection(critical_section_);
|
||||
delete critical_section_;
|
||||
|
@ -784,7 +784,7 @@ static void TestExitMacros() {
|
||||
|
||||
// Of all signals effects on the process exit code, only those of SIGABRT
|
||||
// are documented on Windows.
|
||||
// See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.
|
||||
// See https://msdn.microsoft.com/en-us/query-bi/m/dwwzkt4c.
|
||||
EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar";
|
||||
|
||||
# elif !GTEST_OS_FUCHSIA
|
||||
|
@ -5,7 +5,7 @@
|
||||
// examples. It is set in the "Based On:" dropdown in the "Project" info
|
||||
// dialog.
|
||||
// This file is based on the Xcode Configuration files in:
|
||||
// http://code.google.com/p/google-toolbox-for-mac/
|
||||
// https://github.com/google/google-toolbox-for-mac
|
||||
//
|
||||
|
||||
#include "General.xcconfig"
|
||||
|
@ -4,7 +4,7 @@
|
||||
// These are Framework target settings for the gtest framework and examples. It
|
||||
// is set in the "Based On:" dropdown in the "Target" info dialog.
|
||||
// This file is based on the Xcode Configuration files in:
|
||||
// http://code.google.com/p/google-toolbox-for-mac/
|
||||
// https://github.com/google/google-toolbox-for-mac
|
||||
//
|
||||
|
||||
// Dynamic libs need to be position independent
|
||||
|
@ -4,7 +4,7 @@
|
||||
// These are General configuration settings for the gtest framework and
|
||||
// examples.
|
||||
// This file is based on the Xcode Configuration files in:
|
||||
// http://code.google.com/p/google-toolbox-for-mac/
|
||||
// https://github.com/google/google-toolbox-for-mac
|
||||
//
|
||||
|
||||
// Build for PPC and Intel, 32- and 64-bit
|
||||
|
@ -5,7 +5,7 @@
|
||||
// and examples. It is set in the "Based On:" dropdown in the "Project" info
|
||||
// dialog.
|
||||
// This file is based on the Xcode Configuration files in:
|
||||
// http://code.google.com/p/google-toolbox-for-mac/
|
||||
// https://github.com/google/google-toolbox-for-mac
|
||||
//
|
||||
|
||||
#include "General.xcconfig"
|
||||
|
@ -4,7 +4,7 @@
|
||||
// These are static library target settings for libgtest.a. It
|
||||
// is set in the "Based On:" dropdown in the "Target" info dialog.
|
||||
// This file is based on the Xcode Configuration files in:
|
||||
// http://code.google.com/p/google-toolbox-for-mac/
|
||||
// https://github.com/google/google-toolbox-for-mac
|
||||
//
|
||||
|
||||
// Static libs can be included in bundles so make them position independent
|
||||
|
Loading…
Reference in New Issue
Block a user