Showing the changes to tests/script-engine/src/ScriptEngineTests.cpp (1 of 2 files). Show all
Unified · Split
| @@ -30,11 +30,6 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | QTEST_MAIN(ScriptEngineTests) |
| 32 | 32 | |
| 33 | − | |
| 34 | − | |
| 35 | − | |
| 36 | − | |
| 37 | − | |
| 38 | 33 | void ScriptEngineTests::initTestCase() { |
| 39 | 34 | // AudioClient starts networking, but for the purposes of the tests here we don't care, |
| 40 | 35 | // so just got to use some port. |
| @@ -102,6 +97,8 @@ ScriptManagerPointer ScriptEngineTests::makeManager(const QString &scriptSource, · 61 unmodified lines | ||
| 102 | 97 | |
| 103 | 98 | void ScriptEngineTests::testTrivial() { |
| 104 | 99 | auto sm = makeManager("print(\"script works!\"); Script.stop(true);", "testTrivial.js"); |
| 100 | + auto scopeGuard = sm->engine()->getScopeGuard(); | |
| 101 | + | |
| 105 | 102 | QString printed; |
| 106 | 103 | |
| 107 | 104 | QVERIFY(!sm->isRunning()); |
| @@ -125,6 +122,8 @@ void ScriptEngineTests::testTrivial() { · 17 unmodified lines | ||
| 125 | 122 | |
| 126 | 123 | void ScriptEngineTests::testSyntaxError() { |
| 127 | 124 | auto sm = makeManager("this is not good syntax", "testSyntaxError.js"); |
| 125 | + auto scopeGuard = sm->engine()->getScopeGuard(); | |
| 126 | + | |
| 128 | 127 | bool exceptionHappened = false; |
| 129 | 128 | |
| 130 | 129 | connect(sm.get(), &ScriptManager::unhandledException, [&exceptionHappened](std::shared_ptr<ScriptException> exception){ |
| @@ -146,6 +145,7 @@ void ScriptEngineTests::testSyntaxError() { · 15 unmodified lines | ||
| 146 | 145 | |
| 147 | 146 | void ScriptEngineTests::testRuntimeError() { |
| 148 | 147 | auto sm = makeManager("nonexisting();", "testRuntimeError.js"); |
| 148 | + auto scopeGuard = sm->engine()->getScopeGuard(); | |
| 149 | 149 | bool exceptionHappened = false; |
| 150 | 150 | |
| 151 | 151 | connect(sm.get(), &ScriptManager::unhandledException, [&exceptionHappened](std::shared_ptr<ScriptException> exception){ |
| @@ -167,6 +167,7 @@ void ScriptEngineTests::testRuntimeError() { · 15 unmodified lines | ||
| 167 | 167 | |
| 168 | 168 | void ScriptEngineTests::testJSThrow() { |
| 169 | 169 | auto sm = makeManager("throw(42);", "testThrow.js"); |
| 170 | + auto scopeGuard = sm->engine()->getScopeGuard(); | |
| 170 | 171 | sm->run(); |
| 171 | 172 | |
| 172 | 173 | std::shared_ptr<ScriptException> ex = sm->getUncaughtException(); |
| @@ -266,6 +267,7 @@ void ScriptEngineTests::testSignal() { · 93 unmodified lines | ||
| 266 | 267 | |
| 267 | 268 | QStringList printed; |
| 268 | 269 | auto sm = makeManager(script, "testSignal.js"); |
| 270 | + auto scopeGuard = sm->engine()->getScopeGuard(); | |
| 269 | 271 | |
| 270 | 272 | connect(sm.get(), &ScriptManager::printedMessage, [&printed](const QString& message, const QString& engineName){ |
| 271 | 273 | printed.append(message); |
| @@ -291,6 +293,7 @@ void ScriptEngineTests::testSignalWithException() { · 19 unmodified lines | ||
| 291 | 293 | int exceptionCount = 0; |
| 292 | 294 | |
| 293 | 295 | auto sm = makeManager(script, "testSignalWithException.js"); |
| 296 | + auto scopeGuard = sm->engine()->getScopeGuard(); | |
| 294 | 297 | |
| 295 | 298 | connect(sm.get(), &ScriptManager::printedMessage, [&printed](const QString& message, const QString& engineName){ |
| 296 | 299 | printed.append(message); |
| @@ -324,6 +327,7 @@ void ScriptEngineTests::testQuat() { · 27 unmodified lines | ||
| 324 | 327 | }; |
| 325 | 328 | |
| 326 | 329 | auto sm = makeManager(script, "testQuat.js"); |
| 330 | + auto scopeGuard = sm->engine()->getScopeGuard(); | |
| 327 | 331 | |
| 328 | 332 | connect(sm.get(), &ScriptManager::printedMessage, [&printCount, answers](const QString& message, const QString& engineName){ |
| 329 | 333 | QCOMPARE(message, answers[printCount++]); |