diff --git a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp index 12b79167e4d..6310b1e9660 100644 --- a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp +++ b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp @@ -75,20 +75,23 @@ struct Include Client::IncludeType type; unsigned line; }; -QDebug &operator<<(QDebug& d, const Include &i) { + +QDebug &operator<<(QDebug& d, const Include &i) +{ d << '[' << i.fileName - << ',' << (i.type == Client::IncludeGlobal ? "Global" : (i.type == Client::IncludeLocal ? "Local" : "Unknown")) + << ',' << (i.type == Client::IncludeGlobal ? "Global" + : (i.type == Client::IncludeLocal ? "Local" : "Unknown")) << ',' << i.line << ']'; return d; } -class MockClient: public Client +class MockClient : public Client { public: struct Block { - Block(): start(0), end(0) {} - Block(unsigned start): start(start), end(0) {} + Block() : start(0), end(0) {} + Block(unsigned start) : start(start), end(0) {} unsigned start; unsigned end; @@ -123,8 +126,7 @@ public: m_expandedMacrosOffset.append(offset); } - virtual void stopExpandingMacro(unsigned /*offset*/, - const Macro &/*macro*/) {} + virtual void stopExpandingMacro(unsigned /*offset*/, const Macro &/*macro*/) {} virtual void startSkippingBlocks(unsigned offset) { m_skippedBlocks.append(Block(offset)); } @@ -163,7 +165,7 @@ public: } QString resolveLocally(const QString ¤tFileName, - const QString &includedFileName) const + const QString &includedFileName) const { QDir dir; if (currentFileName.isEmpty()) @@ -266,9 +268,13 @@ namespace QTest { } QT_END_NAMESPACE -QDebug &operator<<(QDebug& d, const MockClient::Block &b) { d << '[' << b.start << ',' << b.end << ']'; return d; } +QDebug &operator<<(QDebug& d, const MockClient::Block &b) +{ + d << '[' << b.start << ',' << b.end << ']'; + return d; +} -class tst_Preprocessor: public QObject +class tst_Preprocessor : public QObject { Q_OBJECT @@ -318,15 +324,18 @@ QString tst_Preprocessor::simplified(QByteArray buf) { QString out; QList lines = buf.split('\n'); - foreach (QByteArray line, lines) + foreach (const QByteArray &line, lines) { if (!line.startsWith('#')) { out.append(' '); out.append(line); } + } out = out.simplified(); - for (int i=1; i("errorfile"); QTest::newRow("do nothing") << "noPP.1.cpp" << "noPP.1.cpp" << ""; - QTest::newRow("identifier-expansion 1") << "identifier-expansion.1.cpp" << "identifier-expansion.1.out.cpp" << ""; - QTest::newRow("identifier-expansion 2") << "identifier-expansion.2.cpp" << "identifier-expansion.2.out.cpp" << ""; - QTest::newRow("identifier-expansion 3") << "identifier-expansion.3.cpp" << "identifier-expansion.3.out.cpp" << ""; - QTest::newRow("identifier-expansion 4") << "identifier-expansion.4.cpp" << "identifier-expansion.4.out.cpp" << ""; - QTest::newRow("identifier-expansion 5") << "identifier-expansion.5.cpp" << "identifier-expansion.5.out.cpp" << ""; + QTest::newRow("identifier-expansion 1") + << "identifier-expansion.1.cpp" << "identifier-expansion.1.out.cpp" << ""; + QTest::newRow("identifier-expansion 2") + << "identifier-expansion.2.cpp" << "identifier-expansion.2.out.cpp" << ""; + QTest::newRow("identifier-expansion 3") + << "identifier-expansion.3.cpp" << "identifier-expansion.3.out.cpp" << ""; + QTest::newRow("identifier-expansion 4") + << "identifier-expansion.4.cpp" << "identifier-expansion.4.out.cpp" << ""; + QTest::newRow("identifier-expansion 5") + << "identifier-expansion.5.cpp" << "identifier-expansion.5.out.cpp" << ""; QTest::newRow("reserved 1") << "reserved.1.cpp" << "reserved.1.out.cpp" << ""; QTest::newRow("recursive 1") << "recursive.1.cpp" << "recursive.1.out.cpp" << ""; QTest::newRow("macro_pounder_fn") << "macro_pounder_fn.c" << "" << "";