Fix test verification

This commit is contained in:
Dale Glass 2023-11-06 18:50:29 +01:00
parent 91f59a96ab
commit 0c5726ce07

View file

@ -161,16 +161,16 @@ void ScriptEngineNetworkedTests::testRequireInfinite() {
"Script.require('./tests/require_inf_a.js');"
"print(\"Done\");"
"Script.stop(true);", "testRequireInf.js");
QStringList printed;
QStringList expected {"Starting", "Value from A: 6", "Value from B: 6", "Done"};
QString errors;
QVERIFY(!sm->isRunning());
QVERIFY(!sm->isStopped());
QVERIFY(!sm->isFinished());
connect(sm.get(), &ScriptManager::printedMessage, [&printed](const QString& message, const QString& engineName){
printed.append(message);
connect(sm.get(), &ScriptManager::errorMessage, [&errors](const QString& message, const QString& engineName){
errors.append(message);
});
@ -181,9 +181,5 @@ void ScriptEngineNetworkedTests::testRequireInfinite() {
QVERIFY(!sm->isStopped());
QVERIFY(sm->isFinished());
QVERIFY(printed.length() == expected.length());
for(int i=0;i<printed.length();i++) {
QString nomatch = QString("Result '%1' didn't match expected '%2'").arg(printed[i]).arg(expected[i]);
QVERIFY2(printed[i] == expected[i], qPrintable(nomatch));
}
QVERIFY(errors.contains("Maximum call stack size exceeded"));
}