diff --git a/test/testtoken.cpp b/test/testtoken.cpp index 95b7f4add..93a4f4f26 100644 --- a/test/testtoken.cpp +++ b/test/testtoken.cpp @@ -34,6 +34,7 @@ private: void run() { TEST_CASE(nextprevious); TEST_CASE(multiCompare); + TEST_CASE(multiCompare2); // #3294 - false negative multi compare between "=" and "==" TEST_CASE(getStrLength); TEST_CASE(strValue); @@ -103,6 +104,13 @@ private: ASSERT_EQUALS(-1, Token::multiCompare("%op%|two", "x")); } + void multiCompare2() { // #3294 + // Original pattern that failed: [[,(=<>+-*|&^] %num% [+-*/] %num% ]|,|)|;|=|%op% + givenACodeSampleToTokenize toks("a == 1"); + // FIXME: Result should be true + ASSERT_EQUALS(false, Token::Match(toks.tokens(), "a =|%op%")); + } + void getStrLength() { Token tok(0);