summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-06-01 21:05:31 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-01 21:42:38 +0200
commitb2969c97fd808e229ff57949dbb9c683f3830b71 (patch)
treef923eff172847907b7a37301f68e9c2850155d84 /tests
parent44062ea8e2499f8d2061c7e5be8fb754f2ba4310 (diff)
downloadqtscript-b2969c97fd808e229ff57949dbb9c683f3830b71.tar.gz
Fix crash when converting invalid JSValue to string
JSC::JSValue::toString() expects that the input is valid. Task-number: QTBUG-21896 Change-Id: I3199fcba94be5426cb3d193b57d16176daae83a0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index bd2b736..23ab8ef 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -247,6 +247,7 @@ private slots:
void dateRoundtripQtJSQt();
void dateConversionJSQt();
void dateConversionQtJS();
+ void stringListFromArrayWithEmptyElement();
};
tst_QScriptEngine::tst_QScriptEngine()
@@ -6133,5 +6134,13 @@ void tst_QScriptEngine::scriptValueFromQMetaObject()
}
}
+// QTBUG-21896
+void tst_QScriptEngine::stringListFromArrayWithEmptyElement()
+{
+ QScriptEngine eng;
+ QCOMPARE(qscriptvalue_cast<QStringList>(eng.evaluate("[,'hello']")),
+ QStringList() << "" << "hello");
+}
+
QTEST_MAIN(tst_QScriptEngine)
#include "tst_qscriptengine.moc"