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
299d098d
Commit
299d098d
authored
Oct 24, 2018
by
Jerry Turcios
Browse files
Merge branch 'master' of
https://github.com/google/googletest
parents
2801b238
8ec8ce1c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
11 deletions
+37
-11
CMakeLists.txt
CMakeLists.txt
+8
-1
googletest/README.md
googletest/README.md
+6
-6
googletest/src/gtest.cc
googletest/src/gtest.cc
+6
-4
googletest/test/gtest_skip_test.cc
googletest/test/gtest_skip_test.cc
+17
-0
No files found.
CMakeLists.txt
View file @
299d098d
cmake_minimum_required
(
VERSION 2.8.8
)
cmake_minimum_required
(
VERSION 2.8.8
)
add_definitions
(
-std=c++11
)
if
(
CMAKE_VERSION VERSION_LESS
"3.1"
)
add_definitions
(
-std=c++11
)
else
()
set
(
CMAKE_CXX_STANDARD 11
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CXX_EXTENSIONS OFF
)
endif
()
if
(
POLICY CMP0048
)
if
(
POLICY CMP0048
)
cmake_policy
(
SET CMP0048 NEW
)
cmake_policy
(
SET CMP0048 NEW
)
...
...
googletest/README.md
View file @
299d098d
...
@@ -124,8 +124,8 @@ include(ExternalProject)
...
@@ -124,8 +124,8 @@ include(ExternalProject)
ExternalProject_Add
(
googletest
ExternalProject_Add
(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
GIT_TAG master
SOURCE_DIR
"
${
CMAKE_BINARY_DIR
}
/googletest-src"
SOURCE_DIR
"
${
CMAKE_
CURRENT_
BINARY_DIR
}
/googletest-src"
BINARY_DIR
"
${
CMAKE_BINARY_DIR
}
/googletest-build"
BINARY_DIR
"
${
CMAKE_
CURRENT_
BINARY_DIR
}
/googletest-build"
CONFIGURE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
INSTALL_COMMAND
""
...
@@ -140,13 +140,13 @@ Existing build's `CMakeLists.txt`:
...
@@ -140,13 +140,13 @@ Existing build's `CMakeLists.txt`:
configure_file
(
CMakeLists.txt.in googletest-download/CMakeLists.txt
)
configure_file
(
CMakeLists.txt.in googletest-download/CMakeLists.txt
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-G
"
${
CMAKE_GENERATOR
}
"
.
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-G
"
${
CMAKE_GENERATOR
}
"
.
RESULT_VARIABLE result
RESULT_VARIABLE result
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
/googletest-download
)
WORKING_DIRECTORY
${
CMAKE_
CURRENT_
BINARY_DIR
}
/googletest-download
)
if
(
result
)
if
(
result
)
message
(
FATAL_ERROR
"CMake step for googletest failed:
${
result
}
"
)
message
(
FATAL_ERROR
"CMake step for googletest failed:
${
result
}
"
)
endif
()
endif
()
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
--build .
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
--build .
RESULT_VARIABLE result
RESULT_VARIABLE result
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
/googletest-download
)
WORKING_DIRECTORY
${
CMAKE_
CURRENT_
BINARY_DIR
}
/googletest-download
)
if
(
result
)
if
(
result
)
message
(
FATAL_ERROR
"Build step for googletest failed:
${
result
}
"
)
message
(
FATAL_ERROR
"Build step for googletest failed:
${
result
}
"
)
endif
()
endif
()
...
@@ -157,8 +157,8 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
...
@@ -157,8 +157,8 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Add googletest directly to our build. This defines
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
# the gtest and gtest_main targets.
add_subdirectory
(
${
CMAKE_BINARY_DIR
}
/googletest-src
add_subdirectory
(
${
CMAKE_
CURRENT_
BINARY_DIR
}
/googletest-src
${
CMAKE_BINARY_DIR
}
/googletest-build
${
CMAKE_
CURRENT_
BINARY_DIR
}
/googletest-build
EXCLUDE_FROM_ALL
)
EXCLUDE_FROM_ALL
)
# The gtest/gtest_main targets carry header search path
# The gtest/gtest_main targets carry header search path
...
...
googletest/src/gtest.cc
View file @
299d098d
...
@@ -2520,8 +2520,9 @@ void Test::Run() {
...
@@ -2520,8 +2520,9 @@ void Test::Run() {
internal
::
UnitTestImpl
*
const
impl
=
internal
::
GetUnitTestImpl
();
internal
::
UnitTestImpl
*
const
impl
=
internal
::
GetUnitTestImpl
();
impl
->
os_stack_trace_getter
()
->
UponLeavingGTest
();
impl
->
os_stack_trace_getter
()
->
UponLeavingGTest
();
internal
::
HandleExceptionsInMethodIfSupported
(
this
,
&
Test
::
SetUp
,
"SetUp()"
);
internal
::
HandleExceptionsInMethodIfSupported
(
this
,
&
Test
::
SetUp
,
"SetUp()"
);
// We will run the test only if SetUp() was successful.
// We will run the test only if SetUp() was successful and didn't call
if
(
!
HasFatalFailure
())
{
// GTEST_SKIP().
if
(
!
HasFatalFailure
()
&&
!
IsSkipped
())
{
impl
->
os_stack_trace_getter
()
->
UponLeavingGTest
();
impl
->
os_stack_trace_getter
()
->
UponLeavingGTest
();
internal
::
HandleExceptionsInMethodIfSupported
(
internal
::
HandleExceptionsInMethodIfSupported
(
this
,
&
Test
::
TestBody
,
"the test body"
);
this
,
&
Test
::
TestBody
,
"the test body"
);
...
@@ -2698,9 +2699,10 @@ void TestInfo::Run() {
...
@@ -2698,9 +2699,10 @@ void TestInfo::Run() {
factory_
,
&
internal
::
TestFactoryBase
::
CreateTest
,
factory_
,
&
internal
::
TestFactoryBase
::
CreateTest
,
"the test fixture's constructor"
);
"the test fixture's constructor"
);
// Runs the test if the constructor didn't generate a fatal failure.
// Runs the test if the constructor didn't generate a fatal failure or invoke
// GTEST_SKIP().
// Note that the object will not be null
// Note that the object will not be null
if
(
!
Test
::
HasFatalFailure
())
{
if
(
!
Test
::
HasFatalFailure
()
&&
!
Test
::
IsSkipped
()
)
{
// This doesn't throw as all user code that can throw are wrapped into
// This doesn't throw as all user code that can throw are wrapped into
// exception handling code.
// exception handling code.
test
->
Run
();
test
->
Run
();
...
...
googletest/test/gtest_skip_test.cc
View file @
299d098d
...
@@ -32,7 +32,24 @@
...
@@ -32,7 +32,24 @@
#include "gtest/gtest.h"
#include "gtest/gtest.h"
using
::
testing
::
Test
;
TEST
(
SkipTest
,
DoesSkip
)
{
TEST
(
SkipTest
,
DoesSkip
)
{
GTEST_SKIP
();
GTEST_SKIP
();
EXPECT_EQ
(
0
,
1
);
EXPECT_EQ
(
0
,
1
);
}
}
class
Fixture
:
public
Test
{
protected:
void
SetUp
()
override
{
GTEST_SKIP
()
<<
"skipping all tests for this fixture"
;
}
};
TEST_F
(
Fixture
,
SkipsOneTest
)
{
EXPECT_EQ
(
5
,
7
);
}
TEST_F
(
Fixture
,
SkipsAnotherTest
)
{
EXPECT_EQ
(
99
,
100
);
}
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