Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KDevelop
Manage
Activity
Members
Labels
Plan
Issues
53
Issue boards
Milestones
Wiki
Bugzilla
Code
Merge requests
63
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KDevelop
KDevelop
Commits
18f67d95
Commit
18f67d95
authored
13 years ago
by
Milian Wolff
Browse files
Options
Downloads
Patches
Plain Diff
add unit test showing that multibyte chars in comments also break our parser
CCBUG: 274430
parent
0631a23f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
languages/cpp/parser/tests/test_parser.cpp
+16
-0
16 additions, 0 deletions
languages/cpp/parser/tests/test_parser.cpp
languages/cpp/parser/tests/test_parser.h
+1
-0
1 addition, 0 deletions
languages/cpp/parser/tests/test_parser.h
with
17 additions
and
0 deletions
languages/cpp/parser/tests/test_parser.cpp
+
16
−
0
View file @
18f67d95
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
languages/cpp/parser/tests/test_parser.h
+
1
−
0
View file @
18f67d95
...
...
@@ -85,6 +85,7 @@ private slots:
void
inlineTemplate
();
void
testMultiByteCStrings
();
void
testMultiByteComments
();
//BEGIN C++2011 support
void
testRangeBasedFor
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment