Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
6de39826
Unverified
Commit
6de39826
authored
Aug 22, 2018
by
Jacob Schloss
Committed by
GitHub
Aug 22, 2018
Browse files
Merge branch 'master' into issue_1735
parents
6e798016
1d9a1912
Changes
182
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
120 additions
and
73 deletions
+120
-73
googlemock/test/gmock-more-actions_test.cc
googlemock/test/gmock-more-actions_test.cc
+1
-2
googlemock/test/gmock-nice-strict_test.cc
googlemock/test/gmock-nice-strict_test.cc
+1
-2
googlemock/test/gmock-port_test.cc
googlemock/test/gmock-port_test.cc
+1
-2
googlemock/test/gmock-spec-builders_test.cc
googlemock/test/gmock-spec-builders_test.cc
+2
-3
googlemock/test/gmock_all_test.cc
googlemock/test/gmock_all_test.cc
+1
-2
googlemock/test/gmock_ex_test.cc
googlemock/test/gmock_ex_test.cc
+1
-2
googlemock/test/gmock_leak_test.py
googlemock/test/gmock_leak_test.py
+0
-2
googlemock/test/gmock_leak_test_.cc
googlemock/test/gmock_leak_test_.cc
+1
-2
googlemock/test/gmock_link2_test.cc
googlemock/test/gmock_link2_test.cc
+1
-2
googlemock/test/gmock_link_test.cc
googlemock/test/gmock_link_test.cc
+1
-2
googlemock/test/gmock_link_test.h
googlemock/test/gmock_link_test.h
+1
-2
googlemock/test/gmock_output_test.py
googlemock/test/gmock_output_test.py
+0
-2
googlemock/test/gmock_output_test_.cc
googlemock/test/gmock_output_test_.cc
+1
-2
googlemock/test/gmock_stress_test.cc
googlemock/test/gmock_stress_test.cc
+1
-2
googlemock/test/gmock_test.cc
googlemock/test/gmock_test.cc
+1
-2
googlemock/test/gmock_test_utils.py
googlemock/test/gmock_test_utils.py
+0
-2
googletest/CMakeLists.txt
googletest/CMakeLists.txt
+49
-30
googletest/cmake/Config.cmake.in
googletest/cmake/Config.cmake.in
+9
-0
googletest/cmake/internal_utils.cmake
googletest/cmake/internal_utils.cmake
+39
-1
googletest/docs/advanced.md
googletest/docs/advanced.md
+9
-9
No files found.
googlemock/test/gmock-more-actions_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
//
...
...
googlemock/test/gmock-nice-strict_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
#include "gmock/gmock-generated-nice-strict.h"
...
...
googlemock/test/gmock-port_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: vladl@google.com (Vlad Losev)
// Google Mock - a framework for writing C++ mock classes.
//
...
...
googlemock/test/gmock-spec-builders_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
//
...
...
@@ -1176,7 +1175,7 @@ TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) {
TEST
(
UndefinedReturnValueTest
,
ReturnValueIsMandatoryWhenNotDefaultConstructible
)
{
MockA
a
;
//
TODO(wan@google.com)
: We should really verify the output message,
//
FIXME
: We should really verify the output message,
// but we cannot yet due to that EXPECT_DEATH only captures stderr
// while Google Mock logs to stdout.
#if GTEST_HAS_EXCEPTIONS
...
...
googlemock/test/gmock_all_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
//
// Tests for Google C++ Mocking Framework (Google Mock)
//
...
...
googlemock/test/gmock_ex_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
// Tests Google Mock's functionality that depends on exceptions.
...
...
googlemock/test/gmock_leak_test.py
View file @
6de39826
...
...
@@ -31,8 +31,6 @@
"""Tests that leaked mock objects can be caught be Google Mock."""
__author__
=
'wan@google.com (Zhanyong Wan)'
import
gmock_test_utils
PROGRAM_PATH
=
gmock_test_utils
.
GetTestExecutablePath
(
'gmock_leak_test_'
)
...
...
googlemock/test/gmock_leak_test_.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
//
...
...
googlemock/test/gmock_link2_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
// Google Mock - a framework for writing C++ mock classes.
//
...
...
googlemock/test/gmock_link_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
// Google Mock - a framework for writing C++ mock classes.
//
...
...
googlemock/test/gmock_link_test.h
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: vladl@google.com (Vlad Losev)
// Google Mock - a framework for writing C++ mock classes.
//
...
...
googlemock/test/gmock_output_test.py
View file @
6de39826
...
...
@@ -39,8 +39,6 @@ gmock_output_test.py
"""
__author__
=
'wan@google.com (Zhanyong Wan)'
import
os
import
re
import
sys
...
...
googlemock/test/gmock_output_test_.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
// Tests Google Mock's output in various scenarios. This ensures that
// Google Mock's messages are readable and useful.
...
...
googlemock/test/gmock_stress_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
// Tests that Google Mock constructs can be used in a large number of
// threads concurrently.
...
...
googlemock/test/gmock_test.cc
View file @
6de39826
...
...
@@ -26,8 +26,7 @@
// 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: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
//
...
...
googlemock/test/gmock_test_utils.py
View file @
6de39826
...
...
@@ -29,8 +29,6 @@
"""Unit test utilities for Google C++ Mocking Framework."""
__author__
=
'wan@google.com (Zhanyong Wan)'
import
os
import
sys
...
...
googletest/CMakeLists.txt
View file @
6de39826
...
...
@@ -5,10 +5,6 @@
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option
(
BUILD_SHARED_LIBS
"Build shared libraries (DLLs)."
OFF
)
# When other libraries are using a shared version of runtime libraries,
# Google Test also has to use one.
option
(
...
...
@@ -48,7 +44,7 @@ if (CMAKE_VERSION VERSION_LESS 3.0)
project
(
gtest CXX C
)
else
()
cmake_policy
(
SET CMP0048 NEW
)
project
(
gtest VERSION
1.9.0
LANGUAGES CXX C
)
project
(
gtest VERSION
${
GOOGLETEST_VERSION
}
LANGUAGES CXX C
)
endif
()
cmake_minimum_required
(
VERSION 2.6.4
)
...
...
@@ -60,6 +56,25 @@ if (COMMAND set_up_hermetic_build)
set_up_hermetic_build
()
endif
()
# These commands only run if this is the main project
if
(
CMAKE_PROJECT_NAME STREQUAL
"gtest"
OR CMAKE_PROJECT_NAME STREQUAL
"googletest-distribution"
)
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option
(
BUILD_SHARED_LIBS
"Build shared libraries (DLLs)."
OFF
)
else
()
mark_as_advanced
(
gtest_force_shared_crt
gtest_build_tests
gtest_build_samples
gtest_disable_pthreads
gtest_hide_internal_symbols
)
endif
()
if
(
gtest_hide_internal_symbols
)
set
(
CMAKE_CXX_VISIBILITY_PRESET hidden
)
set
(
CMAKE_VISIBILITY_INLINES_HIDDEN 1
)
...
...
@@ -70,10 +85,30 @@ include(cmake/internal_utils.cmake)
config_compiler_and_linker
()
# Defined in internal_utils.cmake.
# Create the CMake package file descriptors.
if
(
INSTALL_GTEST
)
include
(
CMakePackageConfigHelpers
)
set
(
cmake_package_name GTest
)
set
(
targets_export_name
${
cmake_package_name
}
Targets CACHE INTERNAL
""
)
set
(
generated_dir
"
${
CMAKE_CURRENT_BINARY_DIR
}
/generated"
CACHE INTERNAL
""
)
set
(
cmake_files_install_dir
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/
${
cmake_package_name
}
"
)
set
(
version_file
"
${
generated_dir
}
/
${
cmake_package_name
}
ConfigVersion.cmake"
)
write_basic_package_version_file
(
${
version_file
}
COMPATIBILITY AnyNewerVersion
)
install
(
EXPORT
${
targets_export_name
}
NAMESPACE
${
cmake_package_name
}
::
DESTINATION
${
cmake_files_install_dir
}
)
set
(
config_file
"
${
generated_dir
}
/
${
cmake_package_name
}
Config.cmake"
)
configure_package_config_file
(
"
${
gtest_SOURCE_DIR
}
/cmake/Config.cmake.in"
"
${
config_file
}
"
INSTALL_DESTINATION
${
cmake_files_install_dir
}
)
install
(
FILES
${
version_file
}
${
config_file
}
DESTINATION
${
cmake_files_install_dir
}
)
endif
()
# Where Google Test's .h files can be found.
include_dir
ectories
(
set
(
gtest_build_
include_dir
s
"
${
gtest_SOURCE_DIR
}
/include"
"
${
gtest_SOURCE_DIR
}
"
)
include_directories
(
${
gtest_build_include_dirs
}
)
# Summary of tuple support for Microsoft Visual Studio:
# Compiler version(MS) version(cmake) Support
...
...
@@ -97,39 +132,23 @@ endif()
# aggressive about warnings.
cxx_library
(
gtest
"
${
cxx_strict
}
"
src/gtest-all.cc
)
cxx_library
(
gtest_main
"
${
cxx_strict
}
"
src/gtest_main.cc
)
target_link_libraries
(
gtest_main gtest
)
# If the CMake version supports it, attach header directory information
# 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).
if
(
DEFINED CMAKE_VERSION AND NOT
"
${
CMAKE_VERSION
}
"
VERSION_LESS
"2.8.11"
)
target_include_directories
(
gtest SYSTEM INTERFACE
"
${
gtest_SOURCE_DIR
}
/include"
)
target_include_directories
(
gtest_main SYSTEM INTERFACE
"
${
gtest_SOURCE_DIR
}
/include"
)
target_include_directories
(
gtest SYSTEM INTERFACE
"$<BUILD_INTERFACE:
${
gtest_build_include_dirs
}
>"
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
target_include_directories
(
gtest_main SYSTEM INTERFACE
"$<BUILD_INTERFACE:
${
gtest_build_include_dirs
}
>"
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
endif
()
target_link_libraries
(
gtest_main PUBLIC gtest
)
########################################################################
#
# Install rules
if
(
INSTALL_GTEST
)
install
(
TARGETS gtest gtest_main
RUNTIME DESTINATION
"
${
CMAKE_INSTALL_BINDIR
}
"
ARCHIVE DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
LIBRARY DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
)
install
(
DIRECTORY
"
${
gtest_SOURCE_DIR
}
/include/gtest"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
"
)
# configure and install pkgconfig files
configure_file
(
cmake/gtest.pc.in
"
${
CMAKE_BINARY_DIR
}
/gtest.pc"
@ONLY
)
configure_file
(
cmake/gtest_main.pc.in
"
${
CMAKE_BINARY_DIR
}
/gtest_main.pc"
@ONLY
)
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/gtest.pc"
"
${
CMAKE_BINARY_DIR
}
/gtest_main.pc"
DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/pkgconfig"
)
endif
()
install_project
(
gtest gtest_main
)
########################################################################
#
...
...
googletest/cmake/Config.cmake.in
0 → 100644
View file @
6de39826
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
if (@GTEST_HAS_PTHREAD@)
set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@)
find_dependency(Threads)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
check_required_components("@project_name@")
googletest/cmake/internal_utils.cmake
View file @
6de39826
...
...
@@ -38,6 +38,11 @@ macro(fix_default_compiler_settings_)
# We prefer more strict warning checking for building Google Test.
# Replaces /W3 with /W4 in defaults.
string
(
REPLACE
"/W3"
"/W4"
${
flag_var
}
"
${${
flag_var
}}
"
)
# Prevent D9025 warning for targets that have exception handling
# turned off (/EHs-c- flag). Where required, exceptions are explicitly
# re-enabled using the cxx_exception_flags variable.
string
(
REPLACE
"/EHsc"
""
${
flag_var
}
"
${${
flag_var
}}
"
)
endforeach
()
endif
()
endmacro
()
...
...
@@ -166,9 +171,18 @@ function(cxx_library_with_type name type cxx_flags)
set_target_properties
(
${
name
}
PROPERTIES
COMPILE_DEFINITIONS
"GTEST_CREATE_SHARED_LIBRARY=1"
)
if
(
NOT
"
${
CMAKE_VERSION
}
"
VERSION_LESS
"2.8.11"
)
target_compile_definitions
(
${
name
}
INTERFACE
$<INSTALL_INTERFACE:GTEST_LINKED_AS_SHARED_LIBRARY=1>
)
endif
()
endif
()
if
(
DEFINED GTEST_HAS_PTHREAD
)
target_link_libraries
(
${
name
}
${
CMAKE_THREAD_LIBS_INIT
}
)
if
(
"
${
CMAKE_VERSION
}
"
VERSION_LESS
"3.1.0"
)
set
(
threads_spec
${
CMAKE_THREAD_LIBS_INIT
}
)
else
()
set
(
threads_spec Threads::Threads
)
endif
()
target_link_libraries
(
${
name
}
PUBLIC
${
threads_spec
}
)
endif
()
endfunction
()
...
...
@@ -278,3 +292,27 @@ function(py_test name)
endif
(
${
CMAKE_MAJOR_VERSION
}
.
${
CMAKE_MINOR_VERSION
}
GREATER 3.1
)
endif
(
PYTHONINTERP_FOUND
)
endfunction
()
# install_project(targets...)
#
# Installs the specified targets and configures the associated pkgconfig files.
function
(
install_project
)
if
(
INSTALL_GTEST
)
install
(
DIRECTORY
"
${
PROJECT_SOURCE_DIR
}
/include/"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
"
)
# Install the project targets.
install
(
TARGETS
${
ARGN
}
EXPORT
${
targets_export_name
}
RUNTIME DESTINATION
"
${
CMAKE_INSTALL_BINDIR
}
"
ARCHIVE DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
LIBRARY DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
)
# Configure and install pkgconfig files.
foreach
(
t
${
ARGN
}
)
set
(
configured_pc
"
${
generated_dir
}
/
${
t
}
.pc"
)
configure_file
(
"
${
PROJECT_SOURCE_DIR
}
/cmake/
${
t
}
.pc.in"
"
${
configured_pc
}
"
@ONLY
)
install
(
FILES
"
${
configured_pc
}
"
DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/pkgconfig"
)
endforeach
()
endif
()
endfunction
()
googletest/docs/advanced.md
View file @
6de39826
...
...
@@ -572,7 +572,7 @@ namespace foo {
class
Bar
{
// We want googletest to be able to print instances of this.
...
// Create a free inline friend function.
friend
::
std
::
ostream
&
operator
<<
(
::
std
::
ostream
&
os
,
const
Bar
&
bar
)
{
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Bar
&
bar
)
{
return
os
<<
bar
.
DebugString
();
// whatever needed to print bar to os
}
};
...
...
@@ -580,7 +580,7 @@ class Bar { // We want googletest to be able to print instances of this.
// If you can't declare the function in the class it's important that the
// << operator is defined in the SAME namespace that defines Bar. C++'s look-up
// rules rely on that.
::
std
::
ostream
&
operator
<<
(
::
std
::
ostream
&
os
,
const
Bar
&
bar
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Bar
&
bar
)
{
return
os
<<
bar
.
DebugString
();
// whatever needed to print bar to os
}
...
...
@@ -601,7 +601,7 @@ namespace foo {
class
Bar
{
...
friend
void
PrintTo
(
const
Bar
&
bar
,
::
std
::
ostream
*
os
)
{
friend
void
PrintTo
(
const
Bar
&
bar
,
std
::
ostream
*
os
)
{
*
os
<<
bar
.
DebugString
();
// whatever needed to print bar to os
}
};
...
...
@@ -609,7 +609,7 @@ class Bar {
// If you can't declare the function in the class it's important that PrintTo()
// is defined in the SAME namespace that defines Bar. C++'s look-up rules rely
// on that.
void
PrintTo
(
const
Bar
&
bar
,
::
std
::
ostream
*
os
)
{
void
PrintTo
(
const
Bar
&
bar
,
std
::
ostream
*
os
)
{
*
os
<<
bar
.
DebugString
();
// whatever needed to print bar to os
}
...
...
@@ -649,7 +649,7 @@ _death tests_. More generally, any test that checks that a program terminates
Note that if a piece of code throws an exception, we don't consider it "death"
for the purpose of death tests, as the caller of the code could catch the
exception and avoid the crash. If you want to verify exceptions thrown by your
code, see
[
Exception Assertions
](
#
E
xception
A
ssertions
)
.
code, see
[
Exception Assertions
](
#
e
xception
-a
ssertions
)
.
If you want to test
`EXPECT_*()/ASSERT_*()`
failures in your test code, see
Catching Failures
...
...
@@ -1147,7 +1147,7 @@ test has at least one failure of either kind.
In your test code, you can call
`RecordProperty("key", value)`
to log additional
information, where
`value`
can be either a string or an
`int`
. The
*last*
value
recorded for a key will be emitted to the
[
XML output
](
#
XmlR
eport
)
if you
recorded for a key will be emitted to the
[
XML output
](
#
generating-an-xml-r
eport
)
if you
specify one. For example, the test
```
c++
...
...
@@ -1424,7 +1424,7 @@ will have these names:
*
`InstantiationName/FooTest.HasBlahBlah/1`
for
`"miny"`
*
`InstantiationName/FooTest.HasBlahBlah/2`
for
`"moe"`
You can use these names in
[
`--gtest_filter`
](
#
TestFilter
)
.
You can use these names in
[
`--gtest_filter`
](
#
running-a-subset-of-the-tests
)
.
This statement will instantiate all tests from
`FooTest`
again, each with
parameter values
`"cat"`
and
`"dog"`
:
...
...
@@ -1674,7 +1674,7 @@ To test them, we use the following special techniques:
*
Both static functions and definitions/declarations in an unnamed namespace
are only visible within the same translation unit. To test them, you can
`#include`
the entire
`.cc`
file being tested in your
`*_test.cc`
file.
(
#
including
`.cc`
files is not a good way to reuse code - you should not do
(including
`.cc`
files is not a good way to reuse code - you should not do
this in production code!)
However, a better approach is to move the private code into the
...
...
@@ -2120,7 +2120,7 @@ $ foo_test --gtest_repeat=1000 --gtest_filter=FooBar.*
Repeat the tests whose name matches the filter 1000 times.
```
If your test program contains
[
global set-up/tear-down
](
#
G
lobal
SetUp
)
code, it
If your test program contains
[
global set-up/tear-down
](
#
g
lobal
-set-up-and-tear-down
)
code, it
will be repeated in each iteration as well, as the flakiness may be in it. You
can also specify the repeat count by setting the
`GTEST_REPEAT`
environment
variable.
...
...
Prev
1
2
3
4
5
6
7
…
10
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment