Skip to content

Commit 871b7e6

Browse files
committed
Add test
1 parent 6295044 commit 871b7e6

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/testother.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9886,6 +9886,19 @@ class TestOther : public TestFixture {
98869886
" if (s.empty()) {}\n"
98879887
"}\n");
98889888
ASSERT_EQUALS("[test.cpp:6:16]: (performance, inconclusive) Use const reference for 's' to avoid unnecessary data copying. [redundantCopyLocalConst]\n", errout_str());
9889+
9890+
check("void f1(const std::string& s) {\n"
9891+
" std::string s1 = s;\n"
9892+
" (void)s1;\n"
9893+
"}\n"
9894+
"void f2() {\n"
9895+
" const std::string s;\n"
9896+
" std::string s1 = s;\n"
9897+
" (void)s1;\n"
9898+
"}\n");
9899+
ASSERT_EQUALS("[test.cpp:2:17]: (performance, inconclusive) Use const reference for 's1' to avoid unnecessary data copying. [redundantCopyLocalConst]\n"
9900+
"[test.cpp:7:17]: (performance, inconclusive) Use const reference for 's1' to avoid unnecessary data copying. [redundantCopyLocalConst]\n",
9901+
errout_str());
98899902
}
98909903

98919904
void checkNegativeShift() {

0 commit comments

Comments
 (0)