summaryrefslogtreecommitdiff
path: root/tests/auto/cplusplus/findusages/tst_findusages.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2014-05-05 11:43:24 -0400
committerNikolai Kosjar <nikolai.kosjar@digia.com>2014-05-23 14:24:23 +0200
commitbea8fc8e6a9dc71110a90affc34361e96714631f (patch)
tree43a686e82f73f71b1f05d81eb655d2afb3db36c1 /tests/auto/cplusplus/findusages/tst_findusages.cpp
parentcadc4b42bacf959258f7d4b19e93d02c02b63449 (diff)
downloadqt-creator-bea8fc8e6a9dc71110a90affc34361e96714631f.tar.gz
Cpp{Tools,Editor}: Expect UTF-8 encoded literals
Change-Id: I9843c4163aad3fa3f1bfa33060c76328fc2dc25a Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'tests/auto/cplusplus/findusages/tst_findusages.cpp')
-rw-r--r--tests/auto/cplusplus/findusages/tst_findusages.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/cplusplus/findusages/tst_findusages.cpp b/tests/auto/cplusplus/findusages/tst_findusages.cpp
index a19351d480..9c55679e09 100644
--- a/tests/auto/cplusplus/findusages/tst_findusages.cpp
+++ b/tests/auto/cplusplus/findusages/tst_findusages.cpp
@@ -111,6 +111,8 @@ private Q_SLOTS:
void templatedFunction_QTCREATORBUG9749();
void usingInDifferentNamespace_QTCREATORBUG7978();
+
+ void unicodeIdentifier();
};
void tst_FindUsages::dump(const QList<Usage> &usages) const
@@ -951,5 +953,42 @@ void tst_FindUsages::usingInDifferentNamespace_QTCREATORBUG7978()
QCOMPARE(findUsages.usages().size(), 3);
}
+void tst_FindUsages::unicodeIdentifier()
+{
+ //
+ // The following "non-latin1" code points are used:
+ //
+ // U+00FC - 2 code units in UTF8, 1 in UTF16 - LATIN SMALL LETTER U WITH DIAERESIS
+ // U+4E8C - 3 code units in UTF8, 1 in UTF16 - CJK UNIFIED IDEOGRAPH-4E8C
+ // U+10302 - 4 code units in UTF8, 2 in UTF16 - OLD ITALIC LETTER KE
+ //
+
+ const QByteArray src = "\n"
+ "int var\u00FC\u4E8C\U00010302;\n"
+ "void f() { var\u00FC\u4E8C\U00010302 = 1; }\n";
+ ;
+
+ Document::Ptr doc = Document::create("u");
+ doc->setUtf8Source(src);
+ doc->parse();
+ doc->check();
+
+ QVERIFY(doc->diagnosticMessages().isEmpty());
+ QCOMPARE(doc->globalSymbolCount(), 2U);
+
+ Snapshot snapshot;
+ snapshot.insert(doc);
+
+ Declaration *declaration = doc->globalSymbolAt(0)->asDeclaration();
+ QVERIFY(declaration);
+
+ FindUsages findUsages(src, doc, snapshot);
+ findUsages(declaration);
+ const QList<Usage> usages = findUsages.usages();
+ QCOMPARE(usages.size(), 2);
+ QCOMPARE(usages.at(0).len, 7);
+ QCOMPARE(usages.at(1).len, 7);
+}
+
QTEST_APPLESS_MAIN(tst_FindUsages)
#include "tst_findusages.moc"