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
7225dd17
Commit
7225dd17
authored
Jan 07, 2011
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppresses self-assignment warnings.
parent
915129ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
48 deletions
+51
-48
gtest-linked_ptr_test.cc
test/gtest-linked_ptr_test.cc
+2
-1
gtest_nc_test.py
test/gtest_nc_test.py
+47
-46
gtest_unittest.cc
test/gtest_unittest.cc
+2
-1
No files found.
test/gtest-linked_ptr_test.cc
View file @
7225dd17
...
@@ -77,7 +77,8 @@ class LinkedPtrTest : public testing::Test {
...
@@ -77,7 +77,8 @@ class LinkedPtrTest : public testing::Test {
TEST_F
(
LinkedPtrTest
,
GeneralTest
)
{
TEST_F
(
LinkedPtrTest
,
GeneralTest
)
{
{
{
linked_ptr
<
A
>
a0
,
a1
,
a2
;
linked_ptr
<
A
>
a0
,
a1
,
a2
;
a0
=
a0
;
// Use explicit function call notation here to suppress self-assign warning.
a0
.
operator
=
(
a0
);
a1
=
a2
;
a1
=
a2
;
ASSERT_EQ
(
a0
.
get
(),
static_cast
<
A
*>
(
NULL
));
ASSERT_EQ
(
a0
.
get
(),
static_cast
<
A
*>
(
NULL
));
ASSERT_EQ
(
a1
.
get
(),
static_cast
<
A
*>
(
NULL
));
ASSERT_EQ
(
a1
.
get
(),
static_cast
<
A
*>
(
NULL
));
...
...
test/gtest_nc_test.py
View file @
7225dd17
...
@@ -46,68 +46,69 @@ if not IS_LINUX:
...
@@ -46,68 +46,69 @@ if not IS_LINUX:
class
GTestNCTest
(
unittest
.
TestCase
):
class
GTestNCTest
(
unittest
.
TestCase
):
"""Negative compilation test for Google Test."""
"""Negative compilation test for Google Test."""
def
testCompilerError
(
self
):
# The class body is intentionally empty. The actual test*() methods
"""Verifies that erroneous code leads to expected compiler
# will be defined at run time by a call to
messages."""
# DefineNegativeCompilationTests() later.
pass
# Defines a list of test specs, where each element is a tuple
# Defines a list of test specs, where each element is a tuple
# (test name, list of regexes for matching the compiler errors).
# (test name, list of regexes for matching the compiler errors).
test_specs
=
[
TEST_SPECS
=
[
(
'CANNOT_IGNORE_RUN_ALL_TESTS_RESULT'
,
(
'CANNOT_IGNORE_RUN_ALL_TESTS_RESULT'
,
[
r'ignoring return value'
]),
[
r'ignoring return value'
]),
(
'USER_CANNOT_INCLUDE_GTEST_INTERNAL_INL_H'
,
(
'USER_CANNOT_INCLUDE_GTEST_INTERNAL_INL_H'
,
[
r'must not be included except by Google Test itself'
]),
[
r'must not be included except by Google Test itself'
]),
(
'CATCHES_DECLARING_SETUP_IN_TEST_FIXTURE_WITH_TYPO'
,
(
'CATCHES_DECLARING_SETUP_IN_TEST_FIXTURE_WITH_TYPO'
,
[
r'Setup_should_be_spelled_SetUp'
]),
[
r'Setup_should_be_spelled_SetUp'
]),
(
'CATCHES_CALLING_SETUP_IN_TEST_WITH_TYPO'
,
(
'CATCHES_CALLING_SETUP_IN_TEST_WITH_TYPO'
,
[
r'Setup_should_be_spelled_SetUp'
]),
[
r'Setup_should_be_spelled_SetUp'
]),
(
'CATCHES_DECLARING_SETUP_IN_ENVIRONMENT_WITH_TYPO'
,
(
'CATCHES_DECLARING_SETUP_IN_ENVIRONMENT_WITH_TYPO'
,
[
r'Setup_should_be_spelled_SetUp'
]),
[
r'Setup_should_be_spelled_SetUp'
]),
(
'CATCHES_CALLING_SETUP_IN_ENVIRONMENT_WITH_TYPO'
,
(
'CATCHES_CALLING_SETUP_IN_ENVIRONMENT_WITH_TYPO'
,
[
r'Setup_should_be_spelled_SetUp'
]),
[
r'Setup_should_be_spelled_SetUp'
]),
(
'CATCHES_WRONG_CASE_IN_TYPED_TEST_P'
,
(
'CATCHES_WRONG_CASE_IN_TYPED_TEST_P'
,
[
r'BarTest.*was not declared'
,
# GCC
[
r'BarTest.*was not declared'
,
# GCC
r'undeclared identifier .*BarTest'
,
# Clang
r'undeclared identifier .*BarTest'
,
# Clang
]),
]),
(
'CATCHES_WRONG_CASE_IN_REGISTER_TYPED_TEST_CASE_P'
,
(
'CATCHES_WRONG_CASE_IN_REGISTER_TYPED_TEST_CASE_P'
,
[
r'BarTest.*was not declared'
,
# GCC
[
r'BarTest.*was not declared'
,
# GCC
r'undeclared identifier .*BarTest'
,
# Clang
r'undeclared identifier .*BarTest'
,
# Clang
]),
]),
(
'CATCHES_WRONG_CASE_IN_INSTANTIATE_TYPED_TEST_CASE_P'
,
(
'CATCHES_WRONG_CASE_IN_INSTANTIATE_TYPED_TEST_CASE_P'
,
[
r'BarTest.*not declared'
,
# GCC
[
r'BarTest.*not declared'
,
# GCC
r'undeclared identifier .*BarTest'
,
# Clang
r'undeclared identifier .*BarTest'
,
# Clang
]),
]),
(
'CATCHES_INSTANTIATE_TYPED_TESET_CASE_P_WITH_SAME_NAME_PREFIX'
,
(
'CATCHES_INSTANTIATE_TYPED_TESET_CASE_P_WITH_SAME_NAME_PREFIX'
,
[
r'redefinition of.*My.*FooTest'
]),
[
r'redefinition of.*My.*FooTest'
]),
(
'STATIC_ASSERT_TYPE_EQ_IS_NOT_A_TYPE'
,
(
'STATIC_ASSERT_TYPE_EQ_IS_NOT_A_TYPE'
,
[
r'StaticAssertTypeEq.* does not name a type'
,
# GCC
[
r'StaticAssertTypeEq.* does not name a type'
,
# GCC
r'requires a type.*\n.*StaticAssertTypeEq'
,
# Clang
r'requires a type.*\n.*StaticAssertTypeEq'
,
# Clang
]),
]),
(
'STATIC_ASSERT_TYPE_EQ_WORKS_IN_NAMESPACE'
,
(
'STATIC_ASSERT_TYPE_EQ_WORKS_IN_NAMESPACE'
,
[
r'StaticAssertTypeEq.*int.*const int'
]),
[
r'StaticAssertTypeEq.*int.*const int'
]),
(
'STATIC_ASSERT_TYPE_EQ_WORKS_IN_CLASS'
,
(
'STATIC_ASSERT_TYPE_EQ_WORKS_IN_CLASS'
,
[
r'StaticAssertTypeEq.*int.*bool'
]),
[
r'StaticAssertTypeEq.*int.*bool'
]),
(
'STATIC_ASSERT_TYPE_EQ_WORKS_IN_FUNCTION'
,
(
'STATIC_ASSERT_TYPE_EQ_WORKS_IN_FUNCTION'
,
[
r'StaticAssertTypeEq.*const int.*int'
]),
[
r'StaticAssertTypeEq.*const int.*int'
]),
(
'SANITY'
,
(
'SANITY'
,
None
)
None
)
]
]
# TODO(wan@google.com): verify that the test specs are satisfied.
# TODO(wan@google.com): verify that the test specs are satisfied.
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
test/gtest_unittest.cc
View file @
7225dd17
...
@@ -1150,7 +1150,8 @@ TEST(StringTest, CanBeAssignedNonEmpty) {
...
@@ -1150,7 +1150,8 @@ TEST(StringTest, CanBeAssignedNonEmpty) {
TEST
(
StringTest
,
CanBeAssignedSelf
)
{
TEST
(
StringTest
,
CanBeAssignedSelf
)
{
String
dest
(
"hello"
);
String
dest
(
"hello"
);
dest
=
dest
;
// Use explicit function call notation here to suppress self-assign warning.
dest
.
operator
=
(
dest
);
EXPECT_STREQ
(
"hello"
,
dest
.
c_str
());
EXPECT_STREQ
(
"hello"
,
dest
.
c_str
());
}
}
...
...
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