Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
0928adbf
Commit
0928adbf
authored
Jul 14, 2015
by
kosak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the selection of the flag saver implementation into gtest-port.h and
custom/gtest-port.h.
parent
80167de7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
gtest.h
include/gtest/gtest.h
+1
-2
gtest-port.h
include/gtest/internal/gtest-port.h
+2
-0
gtest.cc
src/gtest.cc
+5
-4
No files found.
include/gtest/gtest.h
View file @
0928adbf
...
@@ -452,8 +452,7 @@ class GTEST_API_ Test {
...
@@ -452,8 +452,7 @@ class GTEST_API_ Test {
// internal method to avoid clashing with names used in user TESTs.
// internal method to avoid clashing with names used in user TESTs.
void
DeleteSelf_
()
{
delete
this
;
}
void
DeleteSelf_
()
{
delete
this
;
}
// Uses a GTestFlagSaver to save and restore all Google Test flags.
const
internal
::
scoped_ptr
<
GTEST_FLAG_SAVER_
>
gtest_flag_saver_
;
const
internal
::
GTestFlagSaver
*
const
gtest_flag_saver_
;
// Often a user misspells SetUp() as Setup() and spends a long time
// Often a user misspells SetUp() as Setup() and spends a long time
// wondering why it is never called by Google Test. The declaration of
// wondering why it is never called by Google Test. The declaration of
...
...
include/gtest/internal/gtest-port.h
View file @
0928adbf
...
@@ -2418,6 +2418,8 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
...
@@ -2418,6 +2418,8 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
#endif // !defined(GTEST_FLAG)
#endif // !defined(GTEST_FLAG)
#if !defined(GTEST_DECLARE_bool_)
#if !defined(GTEST_DECLARE_bool_)
# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
// Macros for declaring flags.
// Macros for declaring flags.
# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
# define GTEST_DECLARE_int32_(name) \
# define GTEST_DECLARE_int32_(name) \
...
...
src/gtest.cc
View file @
0928adbf
...
@@ -2179,14 +2179,15 @@ int TestResult::test_property_count() const {
...
@@ -2179,14 +2179,15 @@ int TestResult::test_property_count() const {
// Creates a Test object.
// Creates a Test object.
// The c'tor saves the
values of all Google Test
flags.
// The c'tor saves the
states of all
flags.
Test
::
Test
()
Test
::
Test
()
:
gtest_flag_saver_
(
new
internal
::
GTestFlagSaver
)
{
:
gtest_flag_saver_
(
new
GTEST_FLAG_SAVER_
)
{
}
}
// The d'tor restores the values of all Google Test flags.
// The d'tor restores the states of all flags. The actual work is
// done by the d'tor of the gtest_flag_saver_ field, and thus not
// visible here.
Test
::~
Test
()
{
Test
::~
Test
()
{
delete
gtest_flag_saver_
;
}
}
// Sets up the test fixture.
// Sets up the test fixture.
...
...
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