testinternal: add testcase for TP warning for "previous()->next()"

This commit is contained in:
Matthias Krüger 2016-08-25 16:09:06 +02:00
parent ece478979b
commit 56525cba60
1 changed files with 6 additions and 0 deletions

View File

@ -309,6 +309,12 @@ private:
" return tok->next()->next()->str();\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (style) Call to 'Token::next()' followed by 'Token::str()' can be simplified.\n", errout.str());
check("void f() {\n"
" return tok->previous()->next()->str();\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (style) Call to 'Token::previous()' followed by 'Token::next()' can be simplified.\n", errout.str());
}
void internalError() {