summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptcontext
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qscriptcontext')
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index a85c0bd..a09d314 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -50,6 +50,10 @@
Q_DECLARE_METATYPE(QScriptValueList)
+QT_BEGIN_NAMESPACE
+extern bool qt_script_isJITEnabled();
+QT_END_NAMESPACE
+
class tst_QScriptContext : public QObject
{
Q_OBJECT
@@ -598,11 +602,10 @@ void tst_QScriptContext::backtrace_data()
expected << "<native>('hey') at -1"
<< "<eval>() at 3"
-#ifdef ENABLE_JIT
- << "foo(arg1 = 'hello', arg2 = 456) at testfile:2"
-#else //### interpreter unfortunately does store information about line number for eval()
- << "foo(arg1 = 'hello', arg2 = 456) at testfile:-1"
-#endif
+ << QString::fromLatin1("foo(arg1 = 'hello', arg2 = 456) at testfile:%0")
+ // interpreter unfortunately doesn't provide line number for eval()
+ .arg(qt_script_isJITEnabled() ? 2 : -1);
+ expected
<< "<global>() at testfile:4";
QTest::newRow("eval") << source << expected;
@@ -661,11 +664,10 @@ void tst_QScriptContext::backtrace_data()
expected << "<native>('hey') at -1"
<< "<eval>() at 3"
-#ifdef ENABLE_JIT
- << "plop('hello', 456) at testfile:3"
-#else //### interpreter unfortunately does store information about line number for eval()
- << "plop('hello', 456) at testfile:-1"
-#endif
+ << QString::fromLatin1("plop('hello', 456) at testfile:%0")
+ // interpreter unfortunately doesn't provide line number for eval()
+ .arg(qt_script_isJITEnabled() ? 3 : -1);
+ expected
<< "<global>() at testfile:5";
QTest::newRow("eval in member") << source << expected;
@@ -1009,6 +1011,8 @@ void tst_QScriptContext::calledAsConstructor()
eng.evaluate("test();");
QVERIFY(!fun3.property("calledAsConstructor").toBool());
eng.evaluate("new test();");
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "calledAsConstructor is not correctly set for JS functions when JIT is enabled", Continue);
QVERIFY(fun3.property("calledAsConstructor").toBool());
}