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
891b3716
Commit
891b3716
authored
Dec 01, 2009
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exposes SkipPrefix s.t. it can be used by gmock (by Vlad Losev).
parent
2e075a7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
gtest-internal.h
include/gtest/internal/gtest-internal.h
+5
-0
gtest.cc
src/gtest.cc
+12
-12
No files found.
include/gtest/internal/gtest-internal.h
View file @
891b3716
...
@@ -604,6 +604,11 @@ TestInfo* MakeAndRegisterTestInfo(
...
@@ -604,6 +604,11 @@ TestInfo* MakeAndRegisterTestInfo(
TearDownTestCaseFunc
tear_down_tc
,
TearDownTestCaseFunc
tear_down_tc
,
TestFactoryBase
*
factory
);
TestFactoryBase
*
factory
);
// If *pstr starts with the given prefix, modifies *pstr to be right
// past the prefix and returns true; otherwise leaves *pstr unchanged
// and returns false. None of pstr, *pstr, and prefix can be NULL.
bool
SkipPrefix
(
const
char
*
prefix
,
const
char
**
pstr
);
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// State of the definition of a type-parameterized test case.
// State of the definition of a type-parameterized test case.
...
...
src/gtest.cc
View file @
891b3716
...
@@ -4355,6 +4355,18 @@ bool AlwaysTrue() {
...
@@ -4355,6 +4355,18 @@ bool AlwaysTrue() {
return
true
;
return
true
;
}
}
// If *pstr starts with the given prefix, modifies *pstr to be right
// past the prefix and returns true; otherwise leaves *pstr unchanged
// and returns false. None of pstr, *pstr, and prefix can be NULL.
bool
SkipPrefix
(
const
char
*
prefix
,
const
char
**
pstr
)
{
const
size_t
prefix_len
=
strlen
(
prefix
);
if
(
strncmp
(
*
pstr
,
prefix
,
prefix_len
)
==
0
)
{
*
pstr
+=
prefix_len
;
return
true
;
}
return
false
;
}
// Parses a string as a command line flag. The string should have
// Parses a string as a command line flag. The string should have
// the format "--flag=value". When def_optional is true, the "=value"
// the format "--flag=value". When def_optional is true, the "=value"
// part can be omitted.
// part can be omitted.
...
@@ -4444,18 +4456,6 @@ bool ParseStringFlag(const char* str, const char* flag, String* value) {
...
@@ -4444,18 +4456,6 @@ bool ParseStringFlag(const char* str, const char* flag, String* value) {
return
true
;
return
true
;
}
}
// Determines whether a string pointed by *str has the prefix parameter as
// its prefix and advances it to point past the prefix if it does.
static
bool
SkipPrefix
(
const
char
*
prefix
,
const
char
**
str
)
{
const
size_t
prefix_len
=
strlen
(
prefix
);
if
(
strncmp
(
*
str
,
prefix
,
prefix_len
)
!=
0
)
return
false
;
*
str
+=
prefix_len
;
return
true
;
}
// Determines whether a string has a prefix that Google Test uses for its
// Determines whether a string has a prefix that Google Test uses for its
// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.
// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.
// If Google Test detects that a command line flag has its prefix but is not
// If Google Test detects that a command line flag has its prefix but is not
...
...
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