astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2017-07-21 09:17:25 +02:00
parent 255d0410a4
commit 12b7843937
2 changed files with 10 additions and 10 deletions

View File

@ -1203,12 +1203,12 @@ static std::string stringFromTokenRange(const Token* start, const Token* end)
{ {
std::ostringstream ret; std::ostringstream ret;
if (end) if (end)
end = end->next(); end = end->next();
for (const Token *tok = start; tok && tok != end; tok = tok->next()) { for (const Token *tok = start; tok && tok != end; tok = tok->next()) {
if (tok->isUnsigned()) if (tok->isUnsigned())
ret << "unsigned "; ret << "unsigned ";
if (tok->isLong()) if (tok->isLong())
ret << (tok->isLiteral() ? "L" : "long "); ret << (tok->isLiteral() ? "L" : "long ");
if (tok->originalName().empty()) { if (tok->originalName().empty()) {
ret << tok->str(); ret << tok->str();
} else } else

View File

@ -97,7 +97,7 @@ private:
TEST_CASE(canFindMatchingBracketsWithTooManyClosing); TEST_CASE(canFindMatchingBracketsWithTooManyClosing);
TEST_CASE(canFindMatchingBracketsWithTooManyOpening); TEST_CASE(canFindMatchingBracketsWithTooManyOpening);
TEST_CASE(expressionString); TEST_CASE(expressionString);
} }
void nextprevious() const { void nextprevious() const {
@ -948,15 +948,15 @@ private:
ASSERT(t == nullptr); ASSERT(t == nullptr);
} }
void expressionString() { void expressionString() {
givenACodeSampleToTokenize var1("void f() { *((unsigned long long *)x) = 0; }"); givenACodeSampleToTokenize var1("void f() { *((unsigned long long *)x) = 0; }");
const Token *tok1 = Token::findsimplematch(var1.tokens(), "*"); 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; }"); givenACodeSampleToTokenize var2("typedef unsigned long long u64; void f() { *((u64 *)x) = 0; }");
const Token *tok2 = Token::findsimplematch(var2.tokens(), "*"); 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) REGISTER_TEST(TestToken)