Commit 8828a2fa authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Nikolai Kosjar

C++: add test for TranslationUnit::getPosition bug

This test is marked as failing, because the bug is still there. To be
fixed when we re-use the generated token stream of the preprocessor as
input for the parser.

Task-number: QTCREATORBUG-9799
Change-Id: I454a9939aa188a6ff934a11699232f39c828bc7b
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 6a179c04
......@@ -94,6 +94,10 @@ public:
private slots:
void initTestCase();
// line/column positions
void line_and_column_1();
// declarations
void gcc_attributes_1();
void gcc_attributes_2();
......@@ -1609,5 +1613,19 @@ void tst_AST::initTestCase()
control.setDiagnosticClient(&diag);
}
void tst_AST::line_and_column_1()
{
QSharedPointer<TranslationUnit> unit(parseDeclaration("\n"
"int i;\n",
false, true));
unsigned line, column = 0;
QVERIFY(unit->ast());
QVERIFY(unit->tokenAt(1).is(T_INT));
unit->getTokenPosition(1, &line, &column);
QEXPECT_FAIL("", "See QTCREATORBUG-9799.", Continue);
QCOMPARE(line, 2U);
QCOMPARE(column, 1U);
}
QTEST_APPLESS_MAIN(tst_AST)
#include "tst_ast.moc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment