summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptengine
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-29 13:49:32 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-29 13:49:32 (GMT)
commit9ef6bd60ed918e5a20505653695729fa5c5e2468 (patch)
tree4f11a93390c1e0e74740633f4c899f995278e438 /tests/auto/qscriptengine
parenta9fc43df40ac3883592e59657828dbf3f439839c (diff)
downloadQt-9ef6bd60ed918e5a20505653695729fa5c5e2468.zip
Qt-9ef6bd60ed918e5a20505653695729fa5c5e2468.tar.gz
Qt-9ef6bd60ed918e5a20505653695729fa5c5e2468.tar.bz2
change __defineSetter__() autotest to match JSC behavior
It's a non-standard extension, so we can live with the fact that JSC semantics are not the same as SpiderMonkey's.
Diffstat (limited to 'tests/auto/qscriptengine')
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index e857db1..a30f714 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -3152,28 +3152,33 @@ void tst_QScriptEngine::getterSetterThisObject()
eng.evaluate("__defineSetter__('x', function() { return this; });");
{
QScriptValue ret = eng.evaluate("x = 'foo'");
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(ret.equals(eng.globalObject()));
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
}
{
QScriptValue ret = eng.evaluate("(function() { return x = 'foo'; })()");
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(ret.equals(eng.globalObject()));
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
}
{
QScriptValue ret = eng.evaluate("with (this) x = 'foo'");
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(ret.equals(eng.globalObject()));
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
}
{
QScriptValue ret = eng.evaluate("with ({}) x = 'foo'");
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(ret.equals(eng.globalObject()));
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
}
{
QScriptValue ret = eng.evaluate("(function() { with ({}) return x = 'foo'; })()");
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(ret.equals(eng.globalObject()));
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
}
}
@@ -3189,12 +3194,10 @@ void tst_QScriptEngine::getterSetterThisObject()
eng.evaluate("q = {}; with (o) with (q) x").equals(eng.evaluate("o"));
// write
eng.evaluate("o.__defineSetter__('x', function() { return this; });");
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(eng.evaluate("(o.x = 'foo') === o").toBoolean());
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(eng.evaluate("with (o) x = 'foo'").equals(eng.evaluate("o")));
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(eng.evaluate("with (o) with (q) x = 'foo'").equals(eng.evaluate("o")));
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(eng.evaluate("(o.x = 'foo') === 'foo'").toBoolean());
+ QVERIFY(eng.evaluate("with (o) x = 'foo'").equals("foo"));
+ QVERIFY(eng.evaluate("with (o) with (q) x = 'foo'").equals("foo"));
}
// getter+setter in prototype chain
@@ -3210,12 +3213,10 @@ void tst_QScriptEngine::getterSetterThisObject()
eng.evaluate("with (q) with (o) x").equals(eng.evaluate("o"));
// write
eng.evaluate("o.__defineSetter__('x', function() { return this; });");
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(eng.evaluate("(o.x = 'foo') === o").toBoolean());
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(eng.evaluate("with (o) x = 'foo'").equals(eng.evaluate("o")));
- QEXPECT_FAIL("", "JSC is wrong?", Continue);
- QVERIFY(eng.evaluate("with (o) with (q) x = 'foo'").equals(eng.evaluate("o")));
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(eng.evaluate("(o.x = 'foo') === 'foo'").toBoolean());
+ QVERIFY(eng.evaluate("with (o) x = 'foo'").equals("foo"));
+ QVERIFY(eng.evaluate("with (o) with (q) x = 'foo'").equals("foo"));
}
// getter+setter in activation