diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-19 14:11:03 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-19 14:11:03 (GMT) |
commit | bbf514474b2664779229b919b54b4c541157c1d3 (patch) | |
tree | 02922d67e88527a4d774ab3b44435e9bf2518003 /tests/auto/qscriptengine | |
parent | a4525b078d80dc0c35ac7b9bd56ec51a089cd490 (diff) | |
download | Qt-bbf514474b2664779229b919b54b4c541157c1d3.zip Qt-bbf514474b2664779229b919b54b4c541157c1d3.tar.gz Qt-bbf514474b2664779229b919b54b4c541157c1d3.tar.bz2 |
add more detailed tests for QRegExp <--> JS RegExp conversion
Diffstat (limited to 'tests/auto/qscriptengine')
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index b1e2599..994a244 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1958,9 +1958,27 @@ void tst_QScriptEngine::valueConversion() QRegExp in = QRegExp("foo"); QScriptValue val = qScriptValueFromValue(&eng, in); QVERIFY(val.isRegExp()); - QEXPECT_FAIL("", "RegExp <--> ScriptValue RegExp conversion is buggy", Continue); + QRegExp out = val.toRegExp(); + QEXPECT_FAIL("", "JSC-based back-end doesn't preserve QRegExp::patternSyntax (always uses RegExp2)", Continue); + QCOMPARE(out.patternSyntax(), in.patternSyntax()); + QCOMPARE(out.pattern(), in.pattern()); + QCOMPARE(out.caseSensitivity(), in.caseSensitivity()); + QCOMPARE(out.isMinimal(), in.isMinimal()); + } + { + QRegExp in = QRegExp("foo", Qt::CaseSensitive, QRegExp::RegExp2); + QScriptValue val = qScriptValueFromValue(&eng, in); + QVERIFY(val.isRegExp()); QCOMPARE(val.toRegExp(), in); } + { + QRegExp in = QRegExp("foo"); + in.setMinimal(true); + QScriptValue val = qScriptValueFromValue(&eng, in); + QVERIFY(val.isRegExp()); + QEXPECT_FAIL("", "JSC-based back-end doesn't preserve QRegExp::minimal (always false)", Continue); + QCOMPARE(val.toRegExp().isMinimal(), in.isMinimal()); + } } static QScriptValue __import__(QScriptContext *ctx, QScriptEngine *eng) |