mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:07:58 +02:00
Merge pull request #709 from daleglass-overte/script-test-infinite-require
Script test infinite require
This commit is contained in:
commit
95b6e037ba
5 changed files with 35 additions and 0 deletions
|
@ -155,3 +155,31 @@ void ScriptEngineNetworkedTests::testRequire() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ScriptEngineNetworkedTests::testRequireInfinite() {
|
||||||
|
auto sm = makeManager(
|
||||||
|
"print(\"Starting\");"
|
||||||
|
"Script.require('./tests/require_inf_a.js');"
|
||||||
|
"print(\"Done\");"
|
||||||
|
"Script.stop(true);", "testRequireInf.js");
|
||||||
|
QString errors;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QVERIFY(!sm->isRunning());
|
||||||
|
QVERIFY(!sm->isStopped());
|
||||||
|
QVERIFY(!sm->isFinished());
|
||||||
|
|
||||||
|
connect(sm.get(), &ScriptManager::errorMessage, [&errors](const QString& message, const QString& engineName){
|
||||||
|
errors.append(message);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
qInfo() << "About to run script";
|
||||||
|
sm->run();
|
||||||
|
|
||||||
|
QVERIFY(!sm->isRunning());
|
||||||
|
QVERIFY(!sm->isStopped());
|
||||||
|
QVERIFY(sm->isFinished());
|
||||||
|
|
||||||
|
QVERIFY(errors.contains("Maximum call stack size exceeded"));
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ class ScriptEngineNetworkedTests : public QObject {
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
void testRequire();
|
void testRequire();
|
||||||
|
void testRequireInfinite();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
2
tests/script-engine/src/tests/require_inf_a.js
Normal file
2
tests/script-engine/src/tests/require_inf_a.js
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module.exports = { value: 1 };
|
||||||
|
var a = Script.require('./require_inf_b.js');
|
2
tests/script-engine/src/tests/require_inf_b.js
Normal file
2
tests/script-engine/src/tests/require_inf_b.js
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module.exports = { value: 1 };
|
||||||
|
var a = Script.require('./require_inf_c.js');
|
2
tests/script-engine/src/tests/require_inf_c.js
Normal file
2
tests/script-engine/src/tests/require_inf_c.js
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module.exports = { value: 1 };
|
||||||
|
var a = Script.require('./require_inf_a.js');
|
Loading…
Reference in a new issue