Skip to content
Snippets Groups Projects
Commit 18f67d95 authored by Milian Wolff's avatar Milian Wolff
Browse files

add unit test showing that multibyte chars in comments also break our parser

CCBUG: 274430
parent 0631a23f
No related branches found
No related tags found
No related merge requests found
......@@ -871,6 +871,22 @@ void TestParser::testMultiByteCStrings()
QVERIFY(pos == KDevelop::CursorInRevision(0, 32));
}
void TestParser::testMultiByteComments()
{
// 0 1 2 3 4
// 01234567890123456789012345678901234567890123456789
QByteArray code = "int a = 1;/* ä */int b = 0;";
TranslationUnitAST* ast = parse(code);
dumper.dump(ast, lastSession->token_stream);
QVERIFY(control.problems().isEmpty());
AST* b = lastSession->topAstNode()->declarations->toBack()->element;
Token token = lastSession->token_stream->token(b->start_token);
rpp::Anchor pos = lastSession->positionAt(token.position);
// should start just after the comment
QEXPECT_FAIL("", "the wide ä-char takes two indizes in a QByteArray, which breaks our lexer", Abort);
QVERIFY(pos == KDevelop::CursorInRevision(0, 17));
}
TranslationUnitAST* TestParser::parse(const QByteArray& unit)
{
control = Control(); // Clear the problems
......
......@@ -85,6 +85,7 @@ private slots:
void inlineTemplate();
void testMultiByteCStrings();
void testMultiByteComments();
//BEGIN C++2011 support
void testRangeBasedFor();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment