summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue/testgen
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qscriptvalue/testgen')
-rw-r--r--tests/auto/qscriptvalue/testgen/data.txt43
-rwxr-xr-xtests/auto/qscriptvalue/testgen/gen.py3
-rw-r--r--tests/auto/qscriptvalue/testgen/testgenerator.cpp8
3 files changed, 51 insertions, 3 deletions
diff --git a/tests/auto/qscriptvalue/testgen/data.txt b/tests/auto/qscriptvalue/testgen/data.txt
index a041c9b..73677ec 100644
--- a/tests/auto/qscriptvalue/testgen/data.txt
+++ b/tests/auto/qscriptvalue/testgen/data.txt
@@ -34,6 +34,7 @@ QScriptValue(QString())
QScriptValue(QString("0"))
QScriptValue(QString("123"))
QScriptValue(QString("12.4"))
+#QScriptValue(QString::fromUtf8("ąśćżźółńę"))
#Unbound values (bound to a null engine)
QScriptValue(0, QScriptValue::UndefinedValue)
@@ -64,6 +65,7 @@ QScriptValue(0, QString())
QScriptValue(0, QString("0"))
QScriptValue(0, QString("123"))
QScriptValue(0, QString("12.3"))
+#QScriptValue(0, QString::fromUtf8("ąśćżźółńę"))
#Bound values
QScriptValue(engine, QScriptValue::UndefinedValue)
@@ -114,7 +116,46 @@ engine->evaluate("/foo/")
engine->evaluate("new Object()")
engine->evaluate("new Array()")
engine->evaluate("new Error()")
+engine->evaluate("a = new Object(); a.foo = 22; a.foo")
+engine->evaluate("Undefined")
+engine->evaluate("Null")
+engine->evaluate("True")
+engine->evaluate("False")
+
+engine->evaluate("undefined")
+engine->evaluate("null")
+engine->evaluate("true")
+engine->evaluate("false")
+engine->evaluate("122")
+engine->evaluate("124")
+engine->evaluate("0")
+engine->evaluate("0.0")
+engine->evaluate("123.0")
+engine->evaluate("6.37e-8")
+engine->evaluate("-6.37e-8")
+engine->evaluate("0x43211234")
+engine->evaluate("0x10000")
+engine->evaluate("0x10001")
+engine->evaluate("NaN")
+engine->evaluate("Infinity")
+engine->evaluate("-Infinity")
+engine->evaluate("'ciao'")
+engine->evaluate("''")
+engine->evaluate("'0'")
+engine->evaluate("'123'")
+engine->evaluate("'12.4'")
+#engine->evaluate(QString::fromUtf8("'ąśćżźółńę'"))
#other
engine->nullValue()
-engine->undefinedValue() \ No newline at end of file
+engine->undefinedValue()
+engine->newObject()
+engine->newArray()
+engine->newArray(10)
+engine->newDate(QDateTime())
+engine->newQMetaObject(&QObject::staticMetaObject)
+engine->newVariant(QVariant())
+engine->newVariant(QVariant(123))
+engine->newVariant(QVariant(false))
+engine->newQObject(0)
+engine->newQObject(engine) \ No newline at end of file
diff --git a/tests/auto/qscriptvalue/testgen/gen.py b/tests/auto/qscriptvalue/testgen/gen.py
index b3c81b9..6e48f46 100755
--- a/tests/auto/qscriptvalue/testgen/gen.py
+++ b/tests/auto/qscriptvalue/testgen/gen.py
@@ -70,8 +70,7 @@ class Options():
return getattr(self._o, attr)
-mainTempl = Template("""/*
-/****************************************************************************
+mainTempl = Template("""/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
diff --git a/tests/auto/qscriptvalue/testgen/testgenerator.cpp b/tests/auto/qscriptvalue/testgen/testgenerator.cpp
index d852ea5..4376c42 100644
--- a/tests/auto/qscriptvalue/testgen/testgenerator.cpp
+++ b/tests/auto/qscriptvalue/testgen/testgenerator.cpp
@@ -119,6 +119,7 @@ static QString generateIsXXXDef(const QString& name, const QList<QString>& list)
"{\n"\
" QFETCH(bool, expected);\n"\
" QCOMPARE(value.%1(), expected);\n"\
+ " QCOMPARE(value.%1(), expected);\n"\
"}\n"\
"\n"\
"DEFINE_TEST_FUNCTION(%1)\n"\
@@ -166,6 +167,7 @@ static QString generateToXXXDef(const QString& name, const QList<QPair<QString,
"{\n"\
" QFETCH(%2, expected);\n"\
" QCOMPARE(value.%1(), expected);\n"\
+ " QCOMPARE(value.%1(), expected);\n"\
"}\n"\
"\n"\
"DEFINE_TEST_FUNCTION(%1)\n";
@@ -213,9 +215,11 @@ QString generateToXXXDef<qsreal>(const QString& name, const QList<QPair<QString,
"%666"
" if (qIsInf(expected)) {\n"\
" QVERIFY(qIsInf(value.%1()));\n"\
+ " QVERIFY(qIsInf(value.%1()));\n"\
" return;\n"\
" }\n"\
" QCOMPARE(value.%1(), expected);\n"\
+ " QCOMPARE(value.%1(), expected);\n"\
"}\n"\
"\n"\
"DEFINE_TEST_FUNCTION(%1)\n";
@@ -269,6 +273,7 @@ static QString generateCastDef(const QList<QPair<QString, T> >& list)
"{\n"\
" QFETCH(%2, expected);\n"\
" QCOMPARE(qscriptvalue_cast<%2>(value), expected);\n"\
+ " QCOMPARE(qscriptvalue_cast<%2>(value), expected);\n"\
"}\n"\
"\n"\
"DEFINE_TEST_FUNCTION(qscriptvalue_cast%2)\n";
@@ -313,13 +318,16 @@ QString generateCastDef<qsreal>(const QList<QPair<QString, qsreal> >& list)
" QFETCH(%2, expected);\n"\
" if (qIsNaN(expected)) {\n"
" QVERIFY(qIsNaN(qscriptvalue_cast<%2>(value)));\n"
+ " QVERIFY(qIsNaN(qscriptvalue_cast<%2>(value)));\n"
" return;\n"
" }\n"\
" if (qIsInf(expected)) {\n"
" QVERIFY(qIsInf(qscriptvalue_cast<%2>(value)));\n"
+ " QVERIFY(qIsInf(qscriptvalue_cast<%2>(value)));\n"
" return;\n"
" }\n"
" QCOMPARE(qscriptvalue_cast<%2>(value), expected);\n"\
+ " QCOMPARE(qscriptvalue_cast<%2>(value), expected);\n"\
"}\n"\
"\n"\
"DEFINE_TEST_FUNCTION(qscriptvalue_cast%2)\n";