diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2012-12-18 15:11:27 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-08 13:01:25 +0100 |
commit | 58985b94679f38bcea15210dbe5dc6e95168ee2b (patch) | |
tree | 5ec86017a6ccd957de792f253aee38cd5ba8097e /tests/auto | |
parent | fd4c5b6e1c4ef488e827a1610fd62e1105373a13 (diff) |
Fix unicode escape sequence validation in strings.
Give an error message when the sequence does not conform to the grammar.
Note that both \u and \x (without any numbers following it) are not
valid escape sequences in ECMA5.1.
Change-Id: I14348984c680b0ce86e05faad5630afc1e98cd02
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto')
4 files changed, 11 insertions, 3 deletions
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js index 92a04942c7..4a3173db6c 100644 --- a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js +++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js @@ -155,10 +155,8 @@ new TestCase( SECTION, "\\o", "o", "\o" ); new TestCase( SECTION, "\\p", "p", "\p" ); new TestCase( SECTION, "\\q", "q", "\q" ); new TestCase( SECTION, "\\s", "s", "\s" ); -new TestCase( SECTION, "\\u", "u", "\u" ); new TestCase( SECTION, "\\w", "w", "\w" ); -new TestCase( SECTION, "\\x", "x", "\x" ); new TestCase( SECTION, "\\y", "y", "\y" ); new TestCase( SECTION, "\\z", "z", "\z" ); diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp index 3cda6c0885..3fb51512d9 100644 --- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp +++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp @@ -124,6 +124,7 @@ void tst_qmlmin::initTestCase() invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml"; } diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml new file mode 100644 index 0000000000..563e01a995 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = "\u000G"; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index fb6efcaf5d..baee10055b 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -7364,7 +7364,7 @@ void tst_qqmlecmascript::numberParsing() void tst_qqmlecmascript::stringParsing() { - for (int i = 1; i < 5; ++i) { + for (int i = 1; i < 6; ++i) { QString file("stringParsing_error.%1.qml"); file = file.arg(i); QQmlComponent component(&engine, testFileUrl(file)); |