Merge branch 'master' of https://github.com/google/googletest
This commit is contained in:
commit
299d098daa
@ -1,5 +1,12 @@
|
||||
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)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
|
@ -124,8 +124,8 @@ include(ExternalProject)
|
||||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
|
||||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
|
||||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
@ -140,13 +140,13 @@ Existing build's `CMakeLists.txt`:
|
||||
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
|
||||
if(result)
|
||||
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
|
||||
endif()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
|
||||
if(result)
|
||||
message(FATAL_ERROR "Build step for googletest failed: ${result}")
|
||||
endif()
|
||||
@ -157,8 +157,8 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
||||
# Add googletest directly to our build. This defines
|
||||
# the gtest and gtest_main targets.
|
||||
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
|
||||
${CMAKE_BINARY_DIR}/googletest-build
|
||||
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
|
||||
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
# The gtest/gtest_main targets carry header search path
|
||||
|
@ -2520,8 +2520,9 @@ void Test::Run() {
|
||||
internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
|
||||
impl->os_stack_trace_getter()->UponLeavingGTest();
|
||||
internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()");
|
||||
// We will run the test only if SetUp() was successful.
|
||||
if (!HasFatalFailure()) {
|
||||
// We will run the test only if SetUp() was successful and didn't call
|
||||
// GTEST_SKIP().
|
||||
if (!HasFatalFailure() && !IsSkipped()) {
|
||||
impl->os_stack_trace_getter()->UponLeavingGTest();
|
||||
internal::HandleExceptionsInMethodIfSupported(
|
||||
this, &Test::TestBody, "the test body");
|
||||
@ -2698,9 +2699,10 @@ void TestInfo::Run() {
|
||||
factory_, &internal::TestFactoryBase::CreateTest,
|
||||
"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
|
||||
if (!Test::HasFatalFailure()) {
|
||||
if (!Test::HasFatalFailure() && !Test::IsSkipped()) {
|
||||
// This doesn't throw as all user code that can throw are wrapped into
|
||||
// exception handling code.
|
||||
test->Run();
|
||||
|
@ -32,7 +32,24 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using ::testing::Test;
|
||||
|
||||
TEST(SkipTest, DoesSkip) {
|
||||
GTEST_SKIP();
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user