summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-09 04:51:40 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-09 04:51:40 (GMT)
commit0dc2fe6685323a8aa6bc0e79f908aa9f2dafe6f2 (patch)
tree206907243d6ec4fe27c7d4170eaed4b3582d76e5 /tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
parentd131a9f99ebd5d753d2eedfafe0b276410168bc8 (diff)
downloadQt-0dc2fe6685323a8aa6bc0e79f908aa9f2dafe6f2.zip
Qt-0dc2fe6685323a8aa6bc0e79f908aa9f2dafe6f2.tar.gz
Qt-0dc2fe6685323a8aa6bc0e79f908aa9f2dafe6f2.tar.bz2
Output file/line for script errors
Diffstat (limited to 'tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp')
-rw-r--r--tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
index dde3bb7..673be35 100644
--- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
+++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
@@ -61,6 +61,7 @@ private slots:
void objectToString();
void selfDeletingBinding();
void extendedObjectPropertyLookup();
+ void scriptErrors();
private:
QmlEngine engine;
@@ -724,6 +725,25 @@ void tst_qmlecmascript::extendedObjectPropertyLookup()
QVERIFY(object != 0);
}
+/*
+Test file/lineNumbers for binding/Script errors.
+*/
+void tst_qmlecmascript::scriptErrors()
+{
+ QmlComponent component(&engine, TEST_FILE("scriptErrors.qml"));
+ QString url = component.url().toString();
+
+ QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\"";
+ QString warning2 = url + ":7: TypeError: Result of expression 'a' [undefined] is not an object.";
+ QString warning3 = url + ":5: Error: Invalid write to global property \"a\"";
+
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
QTEST_MAIN(tst_qmlecmascript)
#include "tst_qmlecmascript.moc"