Fixed #950 (Bug in cppcheck tokenize.cpp)
This commit is contained in:
parent
050e8400b0
commit
c337b4eb33
|
@ -4609,6 +4609,8 @@ void Tokenizer::simplifyComparisonOrder()
|
|||
{
|
||||
if (Token::Match(tok, "[;(] %any% >|>= %any% [);]"))
|
||||
{
|
||||
if (!tok->next()->isName() && !tok->next()->isNumber())
|
||||
continue;
|
||||
const std::string op1(tok->strAt(1));
|
||||
tok->next()->str(tok->strAt(3));
|
||||
tok->tokAt(3)->str(op1);
|
||||
|
|
|
@ -39,6 +39,8 @@ private:
|
|||
|
||||
void run()
|
||||
{
|
||||
TEST_CASE(tokenize1);
|
||||
|
||||
TEST_CASE(minus);
|
||||
|
||||
TEST_CASE(longtok);
|
||||
|
@ -210,6 +212,13 @@ private:
|
|||
}
|
||||
|
||||
|
||||
void tokenize1()
|
||||
{
|
||||
const std::string code("void f ( )\n"
|
||||
"{ if ( p . y ( ) > yof ) { } }");
|
||||
ASSERT_EQUALS(code, tokenizeAndStringify(code.c_str()));
|
||||
}
|
||||
|
||||
void minus()
|
||||
{
|
||||
ASSERT_EQUALS("i = -12", tokenizeAndStringify("i = -12"));
|
||||
|
|
Loading…
Reference in New Issue