Commit a9e9a2b2 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[trac613] avoid the obvious form of self assignment to silence cppcheck.

parent f54d8505
...@@ -288,9 +288,10 @@ TEST_F(NameTest, assignment) { ...@@ -288,9 +288,10 @@ TEST_F(NameTest, assignment) {
delete copy2; delete copy2;
EXPECT_EQ(copy3, example_name); EXPECT_EQ(copy3, example_name);
// Self assignment // Self assignment (via a reference to silence cppcheck)
copy = copy; Name& copyref(copy);
EXPECT_EQ(copy, example_name); copyref = copy;
EXPECT_EQ(example_name, copyref);
} }
TEST_F(NameTest, toText) { TEST_F(NameTest, toText) {
......
...@@ -223,9 +223,10 @@ TEST_F(Rdata_Unknown_Test, assignment) { ...@@ -223,9 +223,10 @@ TEST_F(Rdata_Unknown_Test, assignment) {
delete copy2; delete copy2;
EXPECT_EQ(0, copy3.compare(rdata_unknown)); EXPECT_EQ(0, copy3.compare(rdata_unknown));
// Self assignment // Self assignment (via a reference to silence cppcheck)
copy = copy; generic::Generic& copyref(copy);
EXPECT_EQ(0, copy.compare(rdata_unknown)); copyref = copy;
EXPECT_EQ(0, copyref.compare(rdata_unknown));
} }
TEST_F(Rdata_Unknown_Test, toText) { TEST_F(Rdata_Unknown_Test, toText) {
......
...@@ -100,9 +100,10 @@ TEST_F(TSIGKeyTest, assignment) { ...@@ -100,9 +100,10 @@ TEST_F(TSIGKeyTest, assignment) {
delete copy2; delete copy2;
compareTSIGKeys(original, copy3); compareTSIGKeys(original, copy3);
// self assignment // self assignment (via a reference to silence cppcheck)
copy = copy; TSIGKey& copyref(copy);
compareTSIGKeys(original, copy); copyref = copy;
compareTSIGKeys(original, copyref);
} }
class TSIGKeyRingTest : public ::testing::Test { class TSIGKeyRingTest : public ::testing::Test {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment