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
985a3036
Commit
985a3036
authored
Jun 08, 2010
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds tests for SkipPrefix().
parent
38e14659
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
gtest-internal.h
include/gtest/internal/gtest-internal.h
+1
-1
gtest_unittest.cc
test/gtest_unittest.cc
+27
-0
No files found.
include/gtest/internal/gtest-internal.h
View file @
985a3036
...
@@ -607,7 +607,7 @@ GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
...
@@ -607,7 +607,7 @@ GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
// If *pstr starts with the given prefix, modifies *pstr to be right
// If *pstr starts with the given prefix, modifies *pstr to be right
// past the prefix and returns true; otherwise leaves *pstr unchanged
// past the prefix and returns true; otherwise leaves *pstr unchanged
// and returns false. None of pstr, *pstr, and prefix can be NULL.
// and returns false. None of pstr, *pstr, and prefix can be NULL.
bool
SkipPrefix
(
const
char
*
prefix
,
const
char
**
pstr
);
GTEST_API_
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
...
...
test/gtest_unittest.cc
View file @
985a3036
...
@@ -178,6 +178,7 @@ using testing::internal::ShouldShard;
...
@@ -178,6 +178,7 @@ using testing::internal::ShouldShard;
using
testing
::
internal
::
ShouldUseColor
;
using
testing
::
internal
::
ShouldUseColor
;
using
testing
::
internal
::
Shuffle
;
using
testing
::
internal
::
Shuffle
;
using
testing
::
internal
::
ShuffleRange
;
using
testing
::
internal
::
ShuffleRange
;
using
testing
::
internal
::
SkipPrefix
;
using
testing
::
internal
::
StreamableToString
;
using
testing
::
internal
::
StreamableToString
;
using
testing
::
internal
::
String
;
using
testing
::
internal
::
String
;
using
testing
::
internal
::
TestEventListenersAccessor
;
using
testing
::
internal
::
TestEventListenersAccessor
;
...
@@ -7075,3 +7076,29 @@ TEST(NativeArrayTest, WorksForTwoDimensionalArray) {
...
@@ -7075,3 +7076,29 @@ TEST(NativeArrayTest, WorksForTwoDimensionalArray) {
ASSERT_EQ
(
2U
,
na
.
size
());
ASSERT_EQ
(
2U
,
na
.
size
());
EXPECT_EQ
(
a
,
na
.
begin
());
EXPECT_EQ
(
a
,
na
.
begin
());
}
}
// Tests SkipPrefix().
TEST
(
SkipPrefixTest
,
SkipsWhenPrefixMatches
)
{
const
char
*
const
str
=
"hello"
;
const
char
*
p
=
str
;
EXPECT_TRUE
(
SkipPrefix
(
""
,
&
p
));
EXPECT_EQ
(
str
,
p
);
p
=
str
;
EXPECT_TRUE
(
SkipPrefix
(
"hell"
,
&
p
));
EXPECT_EQ
(
str
+
4
,
p
);
}
TEST
(
SkipPrefixTest
,
DoesNotSkipWhenPrefixDoesNotMatch
)
{
const
char
*
const
str
=
"world"
;
const
char
*
p
=
str
;
EXPECT_FALSE
(
SkipPrefix
(
"W"
,
&
p
));
EXPECT_EQ
(
str
,
p
);
p
=
str
;
EXPECT_FALSE
(
SkipPrefix
(
"world!"
,
&
p
));
EXPECT_EQ
(
str
,
p
);
}
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