parent
255d0410a4
commit
12b7843937
|
@ -1203,12 +1203,12 @@ static std::string stringFromTokenRange(const Token* start, const Token* end)
|
|||
{
|
||||
std::ostringstream ret;
|
||||
if (end)
|
||||
end = end->next();
|
||||
end = end->next();
|
||||
for (const Token *tok = start; tok && tok != end; tok = tok->next()) {
|
||||
if (tok->isUnsigned())
|
||||
ret << "unsigned ";
|
||||
if (tok->isLong())
|
||||
ret << (tok->isLiteral() ? "L" : "long ");
|
||||
if (tok->isUnsigned())
|
||||
ret << "unsigned ";
|
||||
if (tok->isLong())
|
||||
ret << (tok->isLiteral() ? "L" : "long ");
|
||||
if (tok->originalName().empty()) {
|
||||
ret << tok->str();
|
||||
} else
|
||||
|
|
|
@ -97,7 +97,7 @@ private:
|
|||
TEST_CASE(canFindMatchingBracketsWithTooManyClosing);
|
||||
TEST_CASE(canFindMatchingBracketsWithTooManyOpening);
|
||||
|
||||
TEST_CASE(expressionString);
|
||||
TEST_CASE(expressionString);
|
||||
}
|
||||
|
||||
void nextprevious() const {
|
||||
|
@ -948,15 +948,15 @@ private:
|
|||
ASSERT(t == nullptr);
|
||||
}
|
||||
|
||||
void expressionString() {
|
||||
void expressionString() {
|
||||
givenACodeSampleToTokenize var1("void f() { *((unsigned long long *)x) = 0; }");
|
||||
const Token *tok1 = Token::findsimplematch(var1.tokens(), "*");
|
||||
ASSERT_EQUALS("*((unsigned long long*)x)", tok1->expressionString());
|
||||
ASSERT_EQUALS("*((unsigned long long*)x)", tok1->expressionString());
|
||||
|
||||
givenACodeSampleToTokenize var2("typedef unsigned long long u64; void f() { *((u64 *)x) = 0; }");
|
||||
const Token *tok2 = Token::findsimplematch(var2.tokens(), "*");
|
||||
ASSERT_EQUALS("*((unsigned long long*)x)", tok2->expressionString());
|
||||
}
|
||||
ASSERT_EQUALS("*((unsigned long long*)x)", tok2->expressionString());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestToken)
|
||||
|
|
Loading…
Reference in New Issue