aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2012-12-18 14:54:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-07 16:06:56 +0100
commita65824f353300dedc8440c36a29d0fb6a2cb9662 (patch)
tree86a578d838e3b2e3a99c9ac8f867d83f709075e5 /tests/auto
parent63064c7ed7a23c1749ed7f58d55b680190dc01c4 (diff)
Fix: disallow incomplete hex numbers "0x" and "0X".
See also ECMA 5.1, 7.8.3, rule HexIntegerLiteral. Change-Id: I356dc7cfbc88890bb7f35c8bc4219a37633177f8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qmlmin/tst_qmlmin.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp6
4 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
index be93a79034..3cda6c0885 100644
--- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp
+++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
@@ -124,6 +124,8 @@ 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/numberParsing_error.1.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml";
}
QStringList tst_qmlmin::findFiles(const QDir &d)
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml
new file mode 100644
index 0000000000..61233cbd5b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 0x;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml
new file mode 100644
index 0000000000..45195452ca
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 0X;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 852c0ef4b5..370db68024 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -7346,6 +7346,12 @@ void tst_qqmlecmascript::numberParsing()
QObject *object = component.create();
QVERIFY(object != 0);
}
+ for (int i = 1; i < 3; ++i) {
+ QString file("numberParsing_error.%1.qml");
+ file = file.arg(i);
+ QQmlComponent component(&engine, testFileUrl(file));
+ QVERIFY(!component.errors().isEmpty());
+ }
}
void tst_qqmlecmascript::stringParsing()