Commit 24696c39 authored by Che-Hsun Liu's avatar Che-Hsun Liu Committed by GitHub
Browse files

Merge branch 'master' into master

parents 509f7fe8 673c975a
This page lists all documentation wiki pages for Google Mock **1.6**
- **if you use a released version of Google Mock, please read the documentation for that specific version instead.**
* [ForDummies](V1_6_ForDummies.md) -- start here if you are new to Google Mock.
* [CheatSheet](V1_6_CheatSheet.md) -- a quick reference.
* [CookBook](V1_6_CookBook.md) -- recipes for doing various tasks using Google Mock.
* [FrequentlyAskedQuestions](V1_6_FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list.
To contribute code to Google Mock, read:
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
* [Pump Manual](http://code.google.com/p/googletest/wiki/V1_6_PumpManual) -- how we generate some of Google Mock's source files.
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This page lists all documentation wiki pages for Google Mock **(the SVN trunk version)**
- **if you use a released version of Google Mock, please read the documentation for that specific version instead.**
* [ForDummies](V1_7_ForDummies.md) -- start here if you are new to Google Mock.
* [CheatSheet](V1_7_CheatSheet.md) -- a quick reference.
* [CookBook](V1_7_CookBook.md) -- recipes for doing various tasks using Google Mock.
* [FrequentlyAskedQuestions](V1_7_FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list.
To contribute code to Google Mock, read:
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
* [Pump Manual](http://code.google.com/p/googletest/wiki/PumpManual) -- how we generate some of Google Mock's source files.
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -1029,9 +1029,9 @@ class DoBothAction { ...@@ -1029,9 +1029,9 @@ class DoBothAction {
// return sqrt(x*x + y*y); // return sqrt(x*x + y*y);
// } // }
// ... // ...
// EXEPCT_CALL(mock, Foo("abc", _, _)) // EXPECT_CALL(mock, Foo("abc", _, _))
// .WillOnce(Invoke(DistanceToOriginWithLabel)); // .WillOnce(Invoke(DistanceToOriginWithLabel));
// EXEPCT_CALL(mock, Bar(5, _, _)) // EXPECT_CALL(mock, Bar(5, _, _))
// .WillOnce(Invoke(DistanceToOriginWithIndex)); // .WillOnce(Invoke(DistanceToOriginWithIndex));
// //
// you could write // you could write
...@@ -1041,8 +1041,8 @@ class DoBothAction { ...@@ -1041,8 +1041,8 @@ class DoBothAction {
// return sqrt(x*x + y*y); // return sqrt(x*x + y*y);
// } // }
// ... // ...
// EXEPCT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); // EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin));
// EXEPCT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); // EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
typedef internal::IgnoredValue Unused; typedef internal::IgnoredValue Unused;
// This constructor allows us to turn an Action<From> object into an // This constructor allows us to turn an Action<From> object into an
......
...@@ -646,7 +646,7 @@ class SafeMatcherCastImpl { ...@@ -646,7 +646,7 @@ class SafeMatcherCastImpl {
// type U. // type U.
GTEST_COMPILE_ASSERT_( GTEST_COMPILE_ASSERT_(
internal::is_reference<T>::value || !internal::is_reference<U>::value, internal::is_reference<T>::value || !internal::is_reference<U>::value,
cannot_convert_non_referentce_arg_to_reference); cannot_convert_non_reference_arg_to_reference);
// In case both T and U are arithmetic types, enforce that the // In case both T and U are arithmetic types, enforce that the
// conversion is not lossy. // conversion is not lossy.
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(T) RawT; typedef GTEST_REMOVE_REFERENCE_AND_CONST_(T) RawT;
......
...@@ -288,7 +288,7 @@ class MaxBipartiteMatchState { ...@@ -288,7 +288,7 @@ class MaxBipartiteMatchState {
// Each element of the left_ vector represents a left hand side node // Each element of the left_ vector represents a left hand side node
// (i.e. an element) and each element of right_ is a right hand side // (i.e. an element) and each element of right_ is a right hand side
// node (i.e. a matcher). The values in the left_ vector indicate // node (i.e. a matcher). The values in the left_ vector indicate
// outflow from that node to a node on the the right_ side. The values // outflow from that node to a node on the right_ side. The values
// in the right_ indicate inflow, and specify which left_ node is // in the right_ indicate inflow, and specify which left_ node is
// feeding that right_ node, if any. For example, left_[3] == 1 means // feeding that right_ node, if any. For example, left_[3] == 1 means
// there's a flow from element #3 to matcher #1. Such a flow would also // there's a flow from element #3 to matcher #1. Such a flow would also
......
# Copyright 2017 Google Inc.
# All Rights Reserved.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Author: misterg@google.com (Gennadiy Civil)
#
# Bazel Build for Google C++ Testing Framework(Google Test)-googlemock
""" gmock own tests """
cc_test(
name = "gmock_all_test",
size = "small",
srcs = glob(
include = [
"gmock-*.cc",
],
),
linkopts = select({
"//:win": [],
"//conditions:default": [
"-pthread",
],
}),
deps = ["//:gtest"],
)
...@@ -1120,7 +1120,7 @@ TEST(ActionTemplateTest, WorksForIntegralTemplateParams) { ...@@ -1120,7 +1120,7 @@ TEST(ActionTemplateTest, WorksForIntegralTemplateParams) {
EXPECT_FALSE(b); // Verifies that resetter is deleted. EXPECT_FALSE(b); // Verifies that resetter is deleted.
} }
// Tests that ACTION_TEMPLATES works for template template parameters. // Tests that ACTION_TEMPLATE works for a template with template parameters.
ACTION_TEMPLATE(ReturnSmartPointer, ACTION_TEMPLATE(ReturnSmartPointer,
HAS_1_TEMPLATE_PARAMS(template <typename Pointee> class, HAS_1_TEMPLATE_PARAMS(template <typename Pointee> class,
Pointer), Pointer),
......
...@@ -102,10 +102,14 @@ endif() ...@@ -102,10 +102,14 @@ endif()
######################################################################## ########################################################################
# #
# Install rules # Install rules
install(TARGETS gtest gtest_main if(INSTALL_GTEST)
DESTINATION lib) install(TARGETS gtest gtest_main
install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
DESTINATION include) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
######################################################################## ########################################################################
# #
......
...@@ -216,7 +216,7 @@ pkginclude_internal_HEADERS = \ ...@@ -216,7 +216,7 @@ pkginclude_internal_HEADERS = \
lib_libgtest_main_la_SOURCES = src/gtest_main.cc lib_libgtest_main_la_SOURCES = src/gtest_main.cc
lib_libgtest_main_la_LIBADD = lib/libgtest.la lib_libgtest_main_la_LIBADD = lib/libgtest.la
# Bulid rules for samples and tests. Automake's naming for some of # Build rules for samples and tests. Automake's naming for some of
# these variables isn't terribly obvious, so this is a brief # these variables isn't terribly obvious, so this is a brief
# reference: # reference:
# #
......
...@@ -15,7 +15,7 @@ assertions. ...@@ -15,7 +15,7 @@ assertions.
These three assertions do not actually test a value or expression. Instead, These three assertions do not actually test a value or expression. Instead,
they generate a success or failure directly. Like the macros that actually they generate a success or failure directly. Like the macros that actually
perform a test, you may stream a custom failure message into the them. perform a test, you may stream a custom failure message into them.
| `SUCCEED();` | | `SUCCEED();` |
|:-------------| |:-------------|
...@@ -32,7 +32,7 @@ output in the future. ...@@ -32,7 +32,7 @@ output in the future.
`FAIL()` generates a fatal failure, while `ADD_FAILURE()` and `ADD_FAILURE_AT()` generate a nonfatal `FAIL()` generates a fatal failure, while `ADD_FAILURE()` and `ADD_FAILURE_AT()` generate a nonfatal
failure. These are useful when control flow, rather than a Boolean expression, failure. These are useful when control flow, rather than a Boolean expression,
deteremines the test's success or failure. For example, you might want to write determines the test's success or failure. For example, you might want to write
something like: something like:
``` ```
...@@ -128,7 +128,7 @@ c is 10<br> ...@@ -128,7 +128,7 @@ c is 10<br>
1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this FAQ](FAQ.md#the-compiler-complains-no-matching-function-to-call-when-i-use-assert_predn-how-do-i-fix-it) for how to resolve it. 1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this FAQ](FAQ.md#the-compiler-complains-no-matching-function-to-call-when-i-use-assert_predn-how-do-i-fix-it) for how to resolve it.
1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know. 1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know.
_Availability_: Linux, Windows, Mac _Availability_: Linux, Windows, Mac.
### Using a Function That Returns an AssertionResult ### ### Using a Function That Returns an AssertionResult ###
...@@ -675,7 +675,7 @@ syntax only. ...@@ -675,7 +675,7 @@ syntax only.
## How It Works ## ## How It Works ##
Under the hood, `ASSERT_EXIT()` spawns a new process and executes the Under the hood, `ASSERT_EXIT()` spawns a new process and executes the
death test statement in that process. The details of of how precisely death test statement in that process. The details of how precisely
that happens depend on the platform and the variable that happens depend on the platform and the variable
`::testing::GTEST_FLAG(death_test_style)` (which is initialized from the `::testing::GTEST_FLAG(death_test_style)` (which is initialized from the
command-line flag `--gtest_death_test_style`). command-line flag `--gtest_death_test_style`).
...@@ -1344,7 +1344,7 @@ TYPED_TEST(FooTest, DoesBlah) { ...@@ -1344,7 +1344,7 @@ TYPED_TEST(FooTest, DoesBlah) {
TYPED_TEST(FooTest, HasPropertyA) { ... } TYPED_TEST(FooTest, HasPropertyA) { ... }
``` ```
You can see `samples/sample6_unittest.cc` for a complete example. You can see [`samples/sample6_unittest.cc`](../samples/sample6_unittest.cc) for a complete example.
_Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac; _Availability:_ Linux, Windows (requires MSVC 8.0 or above), Mac;
since version 1.1.0. since version 1.1.0.
...@@ -1444,7 +1444,7 @@ absolutely have to test non-public interface code though, you can. There are ...@@ -1444,7 +1444,7 @@ absolutely have to test non-public interface code though, you can. There are
two cases to consider: two cases to consider:
* Static functions (_not_ the same as static member functions!) or unnamed namespaces, and * Static functions (_not_ the same as static member functions!) or unnamed namespaces, and
* Private or protected class members * Private or protected class members.
## Static Functions ## ## Static Functions ##
...@@ -1551,7 +1551,7 @@ exception, you could catch the exception and assert on it. But Google ...@@ -1551,7 +1551,7 @@ exception, you could catch the exception and assert on it. But Google
Test doesn't use exceptions, so how do we test that a piece of code Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure? generates an expected failure?
`"gtest/gtest-spi.h"` contains some constructs to do this. After `"gtest/gtest-spi.h"` contains some constructs to do this. After
`#include`ing this header, you can use `#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` | | `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
......
...@@ -80,8 +80,8 @@ instructions for how to sign and return it. ...@@ -80,8 +80,8 @@ instructions for how to sign and return it.
## Coding Style ## ## Coding Style ##
To keep the source consistent, readable, diffable and easy to merge, To keep the source consistent, readable, diffable and easy to merge,
we use a fairly rigid coding style, as defined by the [google-styleguide](http://code.google.com/p/google-styleguide/) project. All patches will be expected we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected
to conform to the style outlined [here](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml). to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html).
## Updating Generated Code ## ## Updating Generated Code ##
......
This page lists all documentation wiki pages for Google Test **(the SVN trunk version)** This page lists all documentation markdown files for Google Test **(the
-- **if you use a released version of Google Test, please read the current git version)**
documentation for that specific version instead.** -- **if you use a former version of Google Test, please read the
documentation for that specific version instead (e.g. by checking out
the respective git branch/tag).**
* [Primer](Primer.md) -- start here if you are new to Google Test. * [Primer](Primer.md) -- start here if you are new to Google Test.
* [Samples](Samples.md) -- learn from examples. * [Samples](Samples.md) -- learn from examples.
...@@ -11,4 +13,4 @@ documentation for that specific version instead.** ...@@ -11,4 +13,4 @@ documentation for that specific version instead.**
To contribute code to Google Test, read: To contribute code to Google Test, read:
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
* [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files. * [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files.
\ No newline at end of file
...@@ -54,7 +54,7 @@ Underscore (`_`) is special, as C++ reserves the following to be used by ...@@ -54,7 +54,7 @@ Underscore (`_`) is special, as C++ reserves the following to be used by
the compiler and the standard library: the compiler and the standard library:
1. any identifier that starts with an `_` followed by an upper-case letter, and 1. any identifier that starts with an `_` followed by an upper-case letter, and
1. any identifier that containers two consecutive underscores (i.e. `__`) _anywhere_ in its name. 1. any identifier that contains two consecutive underscores (i.e. `__`) _anywhere_ in its name.
User code is _prohibited_ from using such identifiers. User code is _prohibited_ from using such identifiers.
...@@ -960,12 +960,11 @@ Have you read a ...@@ -960,12 +960,11 @@ Have you read a
the Google Test Primer page? the Google Test Primer page?
## I want to use Google Test with Visual Studio but don't know where to start. ## ## I want to use Google Test with Visual Studio but don't know where to start. ##
Many people are in your position and one of the posted his solution to Many people are in your position and one of them posted his solution to our mailing list.
our mailing list.
## I am seeing compile errors mentioning std::type\_traits when I try to use Google Test on Solaris. ## ## I am seeing compile errors mentioning std::type\_traits when I try to use Google Test on Solaris. ##
Google Test uses parts of the standard C++ library that SunStudio does not support. Google Test uses parts of the standard C++ library that SunStudio does not support.
Our users reported success using alternative implementations. Try running the build after runing this commad: Our users reported success using alternative implementations. Try running the build after running this command:
`export CC=cc CXX=CC CXXFLAGS='-library=stlport4'` `export CC=cc CXX=CC CXXFLAGS='-library=stlport4'`
...@@ -1015,7 +1014,7 @@ instead of ...@@ -1015,7 +1014,7 @@ instead of
``` ```
in order to define a test. in order to define a test.
Currently, the following `TEST`, `FAIL`, `SUCCEED`, and the basic comparison assertion macros can have alternative names. You can see the full list of covered macros [here](http://www.google.com/codesearch?q=if+!GTEST_DONT_DEFINE_\w%2B+package:http://googletest\.googlecode\.com+file:/include/gtest/gtest.h). More information can be found in the "Avoiding Macro Name Clashes" section of the README file. Currently, the following `TEST`, `FAIL`, `SUCCEED`, and the basic comparison assertion macros can have . You can see the full list of covered macros [here](../include/gtest/gtest.h). More information can be found in the "Avoiding Macro Name Clashes" section of the README file.
## Is it OK if I have two separate `TEST(Foo, Bar)` test methods defined in different namespaces? ## ## Is it OK if I have two separate `TEST(Foo, Bar)` test methods defined in different namespaces? ##
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment