Skip to content

Commit 56525cb

Browse files
committed
testinternal: add testcase for TP warning for "previous()->next()"
1 parent ece4789 commit 56525cb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/testinternal.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ class TestInternal : public TestFixture {
309309
" return tok->next()->next()->str();\n"
310310
"}");
311311
ASSERT_EQUALS("[test.cpp:2]: (style) Call to 'Token::next()' followed by 'Token::str()' can be simplified.\n", errout.str());
312+
313+
check("void f() {\n"
314+
" return tok->previous()->next()->str();\n"
315+
"}");
316+
ASSERT_EQUALS("[test.cpp:2]: (style) Call to 'Token::previous()' followed by 'Token::next()' can be simplified.\n", errout.str());
317+
312318
}
313319

314320
void internalError() {

0 commit comments

Comments
 (0)