aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-10-12 22:24:58 +0200
committerLars Knoll <lars.knoll@qt.io>2018-11-05 21:14:54 +0000
commit0fce92af2cab51d03f33230718ab5ae35149b9e1 (patch)
tree6367e64c4c2e6e2f3df02a2ccf6e2a1ae33cca0f /tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp
parent2cc77519ebf1b5e7249c1e2f6fec97816c068cd0 (diff)
Correctly read files with a \0 in them
At least one test case uses this, so let's make sure we read them correctly. Change-Id: I9f4ea7785b5a400cd6f0b210a6a98975bbbaf7ce Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp')
-rw-r--r--tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp b/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp
index a16f2414b0..cbe3be2e70 100644
--- a/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp
+++ b/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp
@@ -494,7 +494,7 @@ void Test262Runner::writeTestExpectations()
static bool executeTest(const QByteArray &data, bool runAsModule = false, const QString &testCasePath = QString(), const QByteArray &harnessForModules = QByteArray())
{
- QString testData = QString::fromUtf8(data);
+ QString testData = QString::fromUtf8(data.constData(), data.size());
QV4::ExecutionEngine vm;
@@ -514,7 +514,7 @@ static bool executeTest(const QByteArray &data, bool runAsModule = false, const
QFile f(url.toLocalFile());
if (f.open(QIODevice::ReadOnly)) {
QByteArray content = harnessForModules + f.readAll();
- module = vm.compileModule(url.toString(), QString::fromUtf8(content), QFileInfo(f).lastModified());
+ module = vm.compileModule(url.toString(), QString::fromUtf8(content.constData(), content.length()), QFileInfo(f).lastModified());
if (vm.hasException)
break;
vm.injectModule(module);