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
59f90a33
Commit
59f90a33
authored
Oct 23, 2018
by
durandal
Committed by
Gennadiy Civil
Oct 24, 2018
Browse files
Googletest export
Honor GTEST_SKIP() in SetUp(). PiperOrigin-RevId: 218387359
parent
3bb00b7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
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.
googletest/src/gtest.cc
View file @
59f90a33
...
...
@@ -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
();
...
...
googletest/test/gtest_skip_test.cc
View file @
59f90a33
...
...
@@ -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
);
}
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