Unverified Commit 27bb844e authored by Conor Burgess's avatar Conor Burgess Committed by GitHub
Browse files

Merge branch 'master' into fix-argc

parents 8f90d46c ed8d02cf
...@@ -129,7 +129,7 @@ AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"], ...@@ -129,7 +129,7 @@ AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"],
GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags` GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
GTEST_LIBS=`${GTEST_CONFIG} --libs` GTEST_LIBS=`${GTEST_CONFIG} --libs`
GTEST_VERSION=`${GTEST_CONFIG} --version`], GTEST_VERSION=`${GTEST_CONFIG} --version`],
[AC_CONFIG_SUBDIRS([../googletest]) [
# GTEST_CONFIG needs to be executable both in a Makefile environment and # GTEST_CONFIG needs to be executable both in a Makefile environment and
# in a shell script environment, so resolve an absolute path for it here. # in a shell script environment, so resolve an absolute path for it here.
GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config" GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config"
......
If you are interested in understanding the internals of Google Mock,
building from source, or contributing ideas or modifications to the
project, then this document is for you.
# Introduction #
First, let's give you some background of the project.
## Licensing ##
All Google Mock source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php).
## The Google Mock Community ##
The Google Mock community exists primarily through the [discussion group](http://groups.google.com/group/googlemock), the
[issue tracker](https://github.com/google/googletest/issues) and, to a lesser extent, the [source control repository](../). You are definitely encouraged to contribute to the
discussion and you can also help us to keep the effectiveness of the
group high by following and promoting the guidelines listed here.
### Please Be Friendly ###
Showing courtesy and respect to others is a vital part of the Google
culture, and we strongly encourage everyone participating in Google
Mock development to join us in accepting nothing less. Of course,
being courteous is not the same as failing to constructively disagree
with each other, but it does mean that we should be respectful of each
other when enumerating the 42 technical reasons that a particular
proposal may not be the best choice. There's never a reason to be
antagonistic or dismissive toward anyone who is sincerely trying to
contribute to a discussion.
Sure, C++ testing is serious business and all that, but it's also
a lot of fun. Let's keep it that way. Let's strive to be one of the
friendliest communities in all of open source.
### Where to Discuss Google Mock ###
As always, discuss Google Mock in the official [Google C++ Mocking Framework discussion group](http://groups.google.com/group/googlemock). You don't have to actually submit
code in order to sign up. Your participation itself is a valuable
contribution.
# Working with the Code #
If you want to get your hands dirty with the code inside Google Mock,
this is the section for you.
## Checking Out the Source from Subversion ##
Checking out the Google Mock source is most useful if you plan to
tweak it yourself. You check out the source for Google Mock using a
[Subversion](http://subversion.tigris.org/) client as you would for any
other project hosted on Google Code. Please see the instruction on
the [source code access page](../) for how to do it.
## Compiling from Source ##
Once you check out the code, you can find instructions on how to
compile it in the [README](../README.md) file.
## Testing ##
A mocking framework is of no good if itself is not thoroughly tested.
Tests should be written for any new code, and changes should be
verified to not break existing tests before they are submitted for
review. To perform the tests, follow the instructions in [README](../README.md) and
verify that there are no failures.
# Contributing Code #
We are excited that Google Mock is now open source, and hope to get
great patches from the community. Before you fire up your favorite IDE
and begin hammering away at that new feature, though, please take the
time to read this section and understand the process. While it seems
rigorous, we want to keep a high standard of quality in the code
base.
## Contributor License Agreements ##
You must sign a Contributor License Agreement (CLA) before we can
accept any code. The CLA protects you and us.
* If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html).
* If you work for a company that wants to allow you to contribute your work to Google Mock, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html).
Follow either of the two links above to access the appropriate CLA and
instructions for how to sign and return it.
## Coding Style ##
To keep the source consistent, readable, diffable and easy to merge,
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](https://google.github.io/styleguide/cppguide.html).
## Submitting Patches ##
Please do submit code. Here's what you need to do:
1. Normally you should make your change against the SVN trunk instead of a branch or a tag, as the latter two are for release control and should be treated mostly as read-only.
1. Decide which code you want to submit. A submission should be a set of changes that addresses one issue in the [Google Mock issue tracker](https://github.com/google/googletest/issues). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one.
1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches.
1. Ensure that your code adheres to the [Google Mock source code style](#Coding_Style.md).
1. Ensure that there are unit tests for your code.
1. Sign a Contributor License Agreement.
1. Create a patch file using `svn diff`.
1. We use [Rietveld](http://codereview.appspot.com/) to do web-based code reviews. You can read about the tool [here](https://github.com/rietveld-codereview/rietveld/wiki). When you are ready, upload your patch via Rietveld and notify `googlemock@googlegroups.com` to review it. There are several ways to upload the patch. We recommend using the [upload\_gmock.py](../scripts/upload_gmock.py) script, which you can find in the `scripts/` folder in the SVN trunk.
## Google Mock Committers ##
The current members of the Google Mock engineering team are the only
committers at present. In the great tradition of eating one's own
dogfood, we will be requiring each new Google Mock engineering team
member to earn the right to become a committer by following the
procedures in this document, writing consistently great code, and
demonstrating repeatedly that he or she truly gets the zen of Google
Mock.
# Release Process #
We follow the typical release process for Subversion-based projects:
1. A release branch named `release-X.Y` is created.
1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable.
1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch.
1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time).
1. Go back to step 1 to create another release branch and so on.
---
This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project. Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/).
...@@ -11,5 +11,5 @@ the respective git branch/tag).** ...@@ -11,5 +11,5 @@ the respective git branch/tag).**
To contribute code to Google Mock, read: To contribute code to Google Mock, read:
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. * [CONTRIBUTING](../CONTRIBUTING.md) -- read this _before_ writing your first patch.
* [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files. * [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files.
...@@ -3615,6 +3615,10 @@ BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond( ...@@ -3615,6 +3615,10 @@ BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
return BoundSecondMatcher<Tuple2Matcher, Second>(tm, second); return BoundSecondMatcher<Tuple2Matcher, Second>(tm, second);
} }
// Joins a vector of strings as if they are fields of a tuple; returns
// the joined string. This function is exported for testing.
GTEST_API_ string JoinAsTuple(const Strings& fields);
// Returns the description for a matcher defined using the MATCHER*() // Returns the description for a matcher defined using the MATCHER*()
// macro where the user-supplied description string is "", if // macro where the user-supplied description string is "", if
// 'negation' is false; otherwise returns the description of the // 'negation' is false; otherwise returns the description of the
......
...@@ -508,7 +508,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked() ...@@ -508,7 +508,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
return expectations_met; return expectations_met;
} }
CallReaction intToCallReaction(int mock_behavior) { static CallReaction intToCallReaction(int mock_behavior) {
if (mock_behavior >= kAllow && mock_behavior <= kFail) { if (mock_behavior >= kAllow && mock_behavior <= kFail) {
return static_cast<internal::CallReaction>(mock_behavior); return static_cast<internal::CallReaction>(mock_behavior);
} }
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
# #
# Bazel Build for Google C++ Testing Framework(Google Test)-googlemock # Bazel Build for Google C++ Testing Framework(Google Test)-googlemock
licenses(["notice"])
""" gmock own tests """ """ gmock own tests """
cc_test( cc_test(
...@@ -43,7 +45,8 @@ cc_test( ...@@ -43,7 +45,8 @@ cc_test(
], ],
), ),
linkopts = select({ linkopts = select({
"//:win": [], "//:windows": [],
"//:windows_msvc": [],
"//conditions:default": [ "//conditions:default": [
"-pthread", "-pthread",
], ],
......
...@@ -44,15 +44,7 @@ ...@@ -44,15 +44,7 @@
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "gtest/gtest-spi.h" #include "gtest/gtest-spi.h"
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
#if GTEST_OS_CYGWIN #if GTEST_OS_CYGWIN
# include <sys/types.h> // For ssize_t. NOLINT # include <sys/types.h> // For ssize_t. NOLINT
......
...@@ -65,10 +65,6 @@ ...@@ -65,10 +65,6 @@
namespace testing { namespace testing {
namespace internal {
GTEST_API_ string JoinAsTuple(const Strings& fields);
} // namespace internal
namespace gmock_matchers_test { namespace gmock_matchers_test {
using std::greater; using std::greater;
......
...@@ -74,8 +74,8 @@ config_compiler_and_linker() # Defined in internal_utils.cmake. ...@@ -74,8 +74,8 @@ config_compiler_and_linker() # Defined in internal_utils.cmake.
# Where Google Test's .h files can be found. # Where Google Test's .h files can be found.
include_directories( include_directories(
${gtest_SOURCE_DIR}/include "${gtest_SOURCE_DIR}/include"
${gtest_SOURCE_DIR}) "${gtest_SOURCE_DIR}")
# Summary of tuple support for Microsoft Visual Studio: # Summary of tuple support for Microsoft Visual Studio:
# Compiler version(MS) version(cmake) Support # Compiler version(MS) version(cmake) Support
...@@ -105,8 +105,8 @@ target_link_libraries(gtest_main gtest) ...@@ -105,8 +105,8 @@ target_link_libraries(gtest_main gtest)
# to the targets for when we are part of a parent build (ie being pulled # to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build). # in via add_subdirectory() rather than being a standalone build).
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
target_include_directories(gtest INTERFACE "${gtest_SOURCE_DIR}/include") target_include_directories(gtest SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include")
target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include") target_include_directories(gtest_main SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include")
endif() endif()
######################################################################## ########################################################################
...@@ -114,11 +114,11 @@ endif() ...@@ -114,11 +114,11 @@ endif()
# Install rules # Install rules
if(INSTALL_GTEST) if(INSTALL_GTEST)
install(TARGETS gtest gtest_main install(TARGETS gtest gtest_main
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest install(DIRECTORY "${gtest_SOURCE_DIR}/include/gtest"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
# configure and install pkgconfig files # configure and install pkgconfig files
configure_file( configure_file(
......
...@@ -34,6 +34,7 @@ EXTRA_DIST += $(GTEST_SRC) ...@@ -34,6 +34,7 @@ EXTRA_DIST += $(GTEST_SRC)
# Sample files that we don't compile. # Sample files that we don't compile.
EXTRA_DIST += \ EXTRA_DIST += \
samples/prime_tables.h \ samples/prime_tables.h \
samples/sample1_unittest.cc \
samples/sample2_unittest.cc \ samples/sample2_unittest.cc \
samples/sample3_unittest.cc \ samples/sample3_unittest.cc \
samples/sample4_unittest.cc \ samples/sample4_unittest.cc \
...@@ -120,16 +121,16 @@ EXTRA_DIST += \ ...@@ -120,16 +121,16 @@ EXTRA_DIST += \
# MSVC project files # MSVC project files
EXTRA_DIST += \ EXTRA_DIST += \
msvc/gtest-md.sln \ msvc/2010/gtest-md.sln \
msvc/gtest-md.vcproj \ msvc/2010/gtest-md.vcxproj \
msvc/gtest.sln \ msvc/2010/gtest.sln \
msvc/gtest.vcproj \ msvc/2010/gtest.vcxproj \
msvc/gtest_main-md.vcproj \ msvc/2010/gtest_main-md.vcxproj \
msvc/gtest_main.vcproj \ msvc/2010/gtest_main.vcxproj \
msvc/gtest_prod_test-md.vcproj \ msvc/2010/gtest_prod_test-md.vcxproj \
msvc/gtest_prod_test.vcproj \ msvc/2010/gtest_prod_test.vcxproj \
msvc/gtest_unittest-md.vcproj \ msvc/2010/gtest_unittest-md.vcxproj \
msvc/gtest_unittest.vcproj msvc/2010/gtest_unittest.vcxproj
# xcode project files # xcode project files
EXTRA_DIST += \ EXTRA_DIST += \
...@@ -223,33 +224,61 @@ lib_libgtest_main_la_LIBADD = lib/libgtest.la ...@@ -223,33 +224,61 @@ lib_libgtest_main_la_LIBADD = lib/libgtest.la
# TESTS -- Programs run automatically by "make check" # TESTS -- Programs run automatically by "make check"
# check_PROGRAMS -- Programs built by "make check" but not necessarily run # check_PROGRAMS -- Programs built by "make check" but not necessarily run
noinst_LTLIBRARIES = samples/libsamples.la
samples_libsamples_la_SOURCES = \
samples/sample1.cc \
samples/sample1.h \
samples/sample2.cc \
samples/sample2.h \
samples/sample3-inl.h \
samples/sample4.cc \
samples/sample4.h
TESTS= TESTS=
TESTS_ENVIRONMENT = GTEST_SOURCE_DIR="$(srcdir)/test" \ TESTS_ENVIRONMENT = GTEST_SOURCE_DIR="$(srcdir)/test" \
GTEST_BUILD_DIR="$(top_builddir)/test" GTEST_BUILD_DIR="$(top_builddir)/test"
check_PROGRAMS= check_PROGRAMS=
# A simple sample on using gtest. # A simple sample on using gtest.
TESTS += samples/sample1_unittest TESTS += samples/sample1_unittest \
check_PROGRAMS += samples/sample1_unittest samples/sample2_unittest \
samples_sample1_unittest_SOURCES = samples/sample1_unittest.cc samples/sample3_unittest \
samples/sample4_unittest \
samples/sample5_unittest \
samples/sample6_unittest \
samples/sample7_unittest \
samples/sample8_unittest \
samples/sample9_unittest \
samples/sample10_unittest
check_PROGRAMS += samples/sample1_unittest \
samples/sample2_unittest \
samples/sample3_unittest \
samples/sample4_unittest \
samples/sample5_unittest \
samples/sample6_unittest \
samples/sample7_unittest \
samples/sample8_unittest \
samples/sample9_unittest \
samples/sample10_unittest
samples_sample1_unittest_SOURCES = samples/sample1_unittest.cc samples/sample1.cc
samples_sample1_unittest_LDADD = lib/libgtest_main.la \ samples_sample1_unittest_LDADD = lib/libgtest_main.la \
lib/libgtest.la \ lib/libgtest.la
samples/libsamples.la samples_sample2_unittest_SOURCES = samples/sample2_unittest.cc samples/sample2.cc
samples_sample2_unittest_LDADD = lib/libgtest_main.la \
lib/libgtest.la
samples_sample3_unittest_SOURCES = samples/sample3_unittest.cc
samples_sample3_unittest_LDADD = lib/libgtest_main.la \
lib/libgtest.la
samples_sample4_unittest_SOURCES = samples/sample4_unittest.cc samples/sample4.cc
samples_sample4_unittest_LDADD = lib/libgtest_main.la \
lib/libgtest.la
samples_sample5_unittest_SOURCES = samples/sample5_unittest.cc samples/sample1.cc
samples_sample5_unittest_LDADD = lib/libgtest_main.la \
lib/libgtest.la
samples_sample6_unittest_SOURCES = samples/sample6_unittest.cc
samples_sample6_unittest_LDADD = lib/libgtest_main.la \
lib/libgtest.la
samples_sample7_unittest_SOURCES = samples/sample7_unittest.cc
samples_sample7_unittest_LDADD = lib/libgtest_main.la \
lib/libgtest.la
samples_sample8_unittest_SOURCES = samples/sample8_unittest.cc
samples_sample8_unittest_LDADD = lib/libgtest_main.la \
lib/libgtest.la
# Another sample. It also verifies that libgtest works. # Also verify that libgtest works by itself.
TESTS += samples/sample10_unittest samples_sample9_unittest_SOURCES = samples/sample9_unittest.cc
check_PROGRAMS += samples/sample10_unittest samples_sample9_unittest_LDADD = lib/libgtest.la
samples_sample10_unittest_SOURCES = samples/sample10_unittest.cc samples_sample10_unittest_SOURCES = samples/sample10_unittest.cc
samples_sample10_unittest_LDADD = lib/libgtest.la samples_sample10_unittest_LDADD = lib/libgtest.la
......
...@@ -358,38 +358,3 @@ instead of ...@@ -358,38 +358,3 @@ instead of
TEST(SomeTest, DoesThis) { ... } TEST(SomeTest, DoesThis) { ... }
in order to define a test. in order to define a test.
## Developing Google Test ##
This section discusses how to make your own changes to Google Test.
### Testing Google Test Itself ###
To make sure your changes work as intended and don't break existing
functionality, you'll want to compile and run Google Test's own tests.
For that you can use CMake:
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON ${GTEST_DIR}
Make sure you have Python installed, as some of Google Test's tests
are written in Python. If the cmake command complains about not being
able to find Python (`Could NOT find PythonInterp (missing:
PYTHON_EXECUTABLE)`), try telling it explicitly where your Python
executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
Next, you can build Google Test and all of its own tests. On \*nix,
this is usually done by 'make'. To run the tests, do
make test
All tests should pass.
Normally you don't need to worry about regenerating the source files,
unless you need to modify them. In that case, you should modify the
corresponding .pump files instead and run the pump.py Python script to
regenerate them. You can find pump.py in the [scripts/](scripts/) directory.
Read the [Pump manual](docs/PumpManual.md) for how to use it.
If you are interested in understanding the internals of Google Test,
building from source, or contributing ideas or modifications to the
project, then this document is for you.
# Introduction #
First, let's give you some background of the project.
## Licensing ##
All Google Test source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php).
## The Google Test Community ##
The Google Test community exists primarily through the [discussion group](http://groups.google.com/group/googletestframework) and the GitHub repository.
You are definitely encouraged to contribute to the
discussion and you can also help us to keep the effectiveness of the
group high by following and promoting the guidelines listed here.
### Please Be Friendly ###
Showing courtesy and respect to others is a vital part of the Google
culture, and we strongly encourage everyone participating in Google
Test development to join us in accepting nothing less. Of course,
being courteous is not the same as failing to constructively disagree
with each other, but it does mean that we should be respectful of each
other when enumerating the 42 technical reasons that a particular
proposal may not be the best choice. There's never a reason to be
antagonistic or dismissive toward anyone who is sincerely trying to
contribute to a discussion.
Sure, C++ testing is serious business and all that, but it's also
a lot of fun. Let's keep it that way. Let's strive to be one of the
friendliest communities in all of open source.
As always, discuss Google Test in the official GoogleTest discussion group.
You don't have to actually submit code in order to sign up. Your participation
itself is a valuable contribution.
# Working with the Code #
If you want to get your hands dirty with the code inside Google Test,
this is the section for you.
## Compiling from Source ##
Once you check out the code, you can find instructions on how to
compile it in the [README](../README.md) file.
## Testing ##
A testing framework is of no good if itself is not thoroughly tested.
Tests should be written for any new code, and changes should be
verified to not break existing tests before they are submitted for
review. To perform the tests, follow the instructions in
[README](../README.md) and verify that there are no failures.
# Contributing Code #
We are excited that Google Test is now open source, and hope to get
great patches from the community. Before you fire up your favorite IDE
and begin hammering away at that new feature, though, please take the
time to read this section and understand the process. While it seems
rigorous, we want to keep a high standard of quality in the code
base.
## Contributor License Agreements ##
You must sign a Contributor License Agreement (CLA) before we can
accept any code. The CLA protects you and us.
* If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html).
* If you work for a company that wants to allow you to contribute your work to Google Test, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html).
Follow either of the two links above to access the appropriate CLA and
instructions for how to sign and return it.
## Coding Style ##
To keep the source consistent, readable, diffable and easy to merge,
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](https://google.github.io/styleguide/cppguide.html).
## Updating Generated Code ##
Some of Google Test's source files are generated by the Pump tool (a
Python script). If you need to update such files, please modify the
source (`foo.h.pump`) and re-generate the C++ file using Pump. You
can read the PumpManual for details.
## Submitting Patches ##
Please do submit code. Here's what you need to do:
1. A submission should be a set of changes that addresses one issue in the [issue tracker](https://github.com/google/googletest/issues). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one.
1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches.
1. Ensure that your code adheres to the [Google Test source code style](#Coding_Style.md).
1. Ensure that there are unit tests for your code.
1. Sign a Contributor License Agreement.
1. Create a Pull Request in the usual way.
If you are a Googler, it is preferable to first create an internal change and
have it reviewed and submitted, and then create an upstreaming pull
request here.
## Google Test Committers ##
The current members of the Google Test engineering team are the only
committers at present. In the great tradition of eating one's own
dogfood, we will be requiring each new Google Test engineering team
member to earn the right to become a committer by following the
procedures in this document, writing consistently great code, and
demonstrating repeatedly that he or she truly gets the zen of Google
Test.
# Release Process #
We follow a typical release process:
1. A release branch named `release-X.Y` is created.
1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable.
1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch.
1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time).
1. Go back to step 1 to create another release branch and so on.
---
This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project. Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/).
...@@ -12,5 +12,5 @@ the respective git branch/tag).** ...@@ -12,5 +12,5 @@ the respective git branch/tag).**
To contribute code to Google Test, read: To contribute code to Google Test, read:
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. * [CONTRIBUTING](../CONTRIBUTING.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.
...@@ -102,7 +102,7 @@ GTEST_API_ bool InDeathTestChild(); ...@@ -102,7 +102,7 @@ GTEST_API_ bool InDeathTestChild();
// On POSIX-compliant systems (*nix), we use the <regex.h> library, // On POSIX-compliant systems (*nix), we use the <regex.h> library,
// which uses the POSIX extended regex syntax. // which uses the POSIX extended regex syntax.
// //
// On other platforms (e.g. Windows), we only support a simple regex // On other platforms (e.g. Windows or Mac), we only support a simple regex
// syntax implemented as part of Google Test. This limited // syntax implemented as part of Google Test. This limited
// implementation should be enough most of the time when writing // implementation should be enough most of the time when writing
// death tests; though it lacks many features you can find in PCRE // death tests; though it lacks many features you can find in PCRE
...@@ -272,6 +272,54 @@ class GTEST_API_ KilledBySignal { ...@@ -272,6 +272,54 @@ class GTEST_API_ KilledBySignal {
# endif // NDEBUG for EXPECT_DEBUG_DEATH # endif // NDEBUG for EXPECT_DEBUG_DEATH
#endif // GTEST_HAS_DEATH_TEST #endif // GTEST_HAS_DEATH_TEST
// This macro is used for implementing macros such as
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
// death tests are not supported. Those macros must compile on such systems
// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
// systems that support death tests. This allows one to write such a macro
// on a system that does not support death tests and be sure that it will
// compile on a death-test supporting system. It is exposed publicly so that
// systems that have death-tests with stricter requirements than
// GTEST_HAS_DEATH_TEST can write their own equivalent of
// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED.
//
// Parameters:
// statement - A statement that a macro such as EXPECT_DEATH would test
// for program termination. This macro has to make sure this
// statement is compiled but not executed, to ensure that
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
// parameter iff EXPECT_DEATH compiles with it.
// regex - A regex that a macro such as EXPECT_DEATH would use to test
// the output of statement. This parameter has to be
// compiled but not evaluated by this macro, to ensure that
// this macro only accepts expressions that a macro such as
// EXPECT_DEATH would accept.
// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
// compile inside functions where ASSERT_DEATH doesn't
// compile.
//
// The branch that has an always false condition is used to ensure that
// statement and regex are compiled (and thus syntactically correct) but
// never executed. The unreachable code macro protects the terminator
// statement from generating an 'unreachable code' warning in case
// statement unconditionally returns or throws. The Message constructor at
// the end allows the syntax of streaming additional messages into the
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
GTEST_LOG_(WARNING) \
<< "Death tests are not supported on this platform.\n" \
<< "Statement '" #statement "' cannot be verified."; \
} else if (::testing::internal::AlwaysFalse()) { \
::testing::internal::RE::PartialMatch(".*", (regex)); \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
terminator; \
} else \
::testing::Message()
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
// death tests are supported; otherwise they just issue a warning. This is // death tests are supported; otherwise they just issue a warning. This is
...@@ -284,9 +332,9 @@ class GTEST_API_ KilledBySignal { ...@@ -284,9 +332,9 @@ class GTEST_API_ KilledBySignal {
ASSERT_DEATH(statement, regex) ASSERT_DEATH(statement, regex)
#else #else
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, ) GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return) GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
#endif #endif
} // namespace testing } // namespace testing
......
...@@ -196,7 +196,6 @@ class GTEST_API_ Message { ...@@ -196,7 +196,6 @@ class GTEST_API_ Message {
std::string GetString() const; std::string GetString() const;
private: private:
#if GTEST_OS_SYMBIAN #if GTEST_OS_SYMBIAN
// These are needed as the Nokia Symbian Compiler cannot decide between // These are needed as the Nokia Symbian Compiler cannot decide between
// const T& and const T* in a function template. The Nokia compiler _can_ // const T& and const T* in a function template. The Nokia compiler _can_
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
// //
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
// //
#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
...@@ -185,15 +186,10 @@ TEST_P(DerivedTest, DoesBlah) { ...@@ -185,15 +186,10 @@ TEST_P(DerivedTest, DoesBlah) {
# include <utility> # include <utility>
#endif #endif
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-param-util-generated.h" #include "gtest/internal/gtest-param-util-generated.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Functions producing parameter generators. // Functions producing parameter generators.
...@@ -273,7 +269,7 @@ internal::ParamGenerator<T> Range(T start, T end) { ...@@ -273,7 +269,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
// each with C-string values of "foo", "bar", and "baz": // each with C-string values of "foo", "bar", and "baz":
// //
// const char* strings[] = {"foo", "bar", "baz"}; // const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings)); // INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
// //
// This instantiates tests from test case StlStringTest // This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b": // each with STL strings with values "a" and "b":
...@@ -1412,33 +1408,33 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3, ...@@ -1412,33 +1408,33 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
// type testing::TestParamInfo<class ParamType>, and return std::string. // type testing::TestParamInfo<class ParamType>, and return std::string.
// //
// testing::PrintToStringParamName is a builtin test suffix generator that // testing::PrintToStringParamName is a builtin test suffix generator that
// returns the value of testing::PrintToString(GetParam()). It does not work // returns the value of testing::PrintToString(GetParam()).
// for std::string or C strings.
// //
// Note: test names must be non-empty, unique, and may only contain ASCII // Note: test names must be non-empty, unique, and may only contain ASCII
// alphanumeric characters or underscore. // alphanumeric characters or underscore. Because PrintToString adds quotes
// to std::string and C strings, it won't work for these types.
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ #define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
::testing::internal::ParamGenerator<test_case_name::ParamType> \ static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ gtest_##prefix##test_case_name##_EvalGenerator_() { \
::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ return generator; \
} \
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \ const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \ return ::testing::internal::GetParamNameGen<test_case_name::ParamType>( \
(__VA_ARGS__)(info); \ __VA_ARGS__)(info); \
} \ } \
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ ::testing::UnitTest::GetInstance() \
GetTestCasePatternHolder<test_case_name>(\ ->parameterized_test_registry() \
.GetTestCasePatternHolder<test_case_name>( \
#test_case_name, \ #test_case_name, \
::testing::internal::CodeLocation(\ ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
__FILE__, __LINE__))->AddTestCaseInstantiation(\ ->AddTestCaseInstantiation( \
#prefix, \ #prefix, &gtest_##prefix##test_case_name##_EvalGenerator_, \
&gtest_##prefix##test_case_name##_EvalGenerator_, \ &gtest_##prefix##test_case_name##_EvalGenerateName_, __FILE__, \
&gtest_##prefix##test_case_name##_EvalGenerateName_, \ __LINE__)
__FILE__, __LINE__)
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
...@@ -184,15 +184,10 @@ TEST_P(DerivedTest, DoesBlah) { ...@@ -184,15 +184,10 @@ TEST_P(DerivedTest, DoesBlah) {
# include <utility> # include <utility>
#endif #endif
// scripts/fuse_gtest.py depends on gtest's own header being #included
// *unconditionally*. Therefore these #includes cannot be moved
// inside #if GTEST_HAS_PARAM_TEST.
#include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-param-util-generated.h" #include "gtest/internal/gtest-param-util-generated.h"
#if GTEST_HAS_PARAM_TEST
namespace testing { namespace testing {
// Functions producing parameter generators. // Functions producing parameter generators.
...@@ -272,7 +267,7 @@ internal::ParamGenerator<T> Range(T start, T end) { ...@@ -272,7 +267,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
// each with C-string values of "foo", "bar", and "baz": // each with C-string values of "foo", "bar", and "baz":
// //
// const char* strings[] = {"foo", "bar", "baz"}; // const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings)); // INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
// //
// This instantiates tests from test case StlStringTest // This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b": // each with STL strings with values "a" and "b":
...@@ -485,14 +480,14 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( ...@@ -485,14 +480,14 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
// to std::string and C strings, it won't work for these types. // to std::string and C strings, it won't work for these types.
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
::testing::internal::ParamGenerator<test_case_name::ParamType> \ static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \ const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \ return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
(__VA_ARGS__)(info); \ (__VA_ARGS__)(info); \
} \ } \
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\ GetTestCasePatternHolder<test_case_name>(\
#test_case_name, \ #test_case_name, \
...@@ -505,6 +500,4 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( ...@@ -505,6 +500,4 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
} // namespace testing } // namespace testing
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
...@@ -427,13 +427,8 @@ void DefaultPrintTo(WrapPrinterType<kPrintFunctionPointer> /* dummy */, ...@@ -427,13 +427,8 @@ void DefaultPrintTo(WrapPrinterType<kPrintFunctionPointer> /* dummy */,
*os << "NULL"; *os << "NULL";
} else { } else {
// T is a function type, so '*os << p' doesn't do what we want // T is a function type, so '*os << p' doesn't do what we want
// (it just prints p as bool). We want to print p as a const // (it just prints p as bool). Cast p to const void* to print it.
// void*. However, we cannot cast it to const void* directly, *os << reinterpret_cast<const void*>(p);
// even using reinterpret_cast, as earlier versions of gcc
// (e.g. 3.4.5) cannot compile the cast when p is a function
// pointer. Casting to UInt64 first solves the problem.
*os << reinterpret_cast<const void*>(
reinterpret_cast<internal::UInt64>(p));
} }
} }
......
...@@ -243,7 +243,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes); ...@@ -243,7 +243,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
} \ } \
static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \ static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \
GTEST_ATTRIBUTE_UNUSED_ = \ GTEST_ATTRIBUTE_UNUSED_ = \
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames( \
__FILE__, __LINE__, #__VA_ARGS__) __FILE__, __LINE__, #__VA_ARGS__)
// The 'Types' template argument below must have spaces around it // The 'Types' template argument below must have spaces around it
......
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