diff options
Diffstat (limited to 'tests/auto/qscriptenginedebugger')
-rw-r--r-- | tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp index ac64750..d2f7598 100644 --- a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp +++ b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp @@ -111,15 +111,29 @@ void tst_QScriptEngineDebugger::attachAndDetach() { { QScriptEngineDebugger debugger; + QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState); debugger.attachTo(0); QScriptEngine engine; debugger.attachTo(&engine); + QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState); } { QScriptEngineDebugger debugger; QScriptEngine engine; + QScriptValue oldPrint = engine.globalObject().property("print"); + QVERIFY(oldPrint.isFunction()); + QVERIFY(!engine.globalObject().property("__FILE__").isValid()); + QVERIFY(!engine.globalObject().property("__LINE__").isValid()); + debugger.attachTo(&engine); + QVERIFY(engine.globalObject().property("__FILE__").isUndefined()); + QVERIFY(engine.globalObject().property("__LINE__").isNumber()); + QVERIFY(!engine.globalObject().property("print").strictlyEquals(oldPrint)); + debugger.detach(); + QVERIFY(engine.globalObject().property("print").strictlyEquals(oldPrint)); + QVERIFY(!engine.globalObject().property("__FILE__").isValid()); + QVERIFY(!engine.globalObject().property("__LINE__").isValid()); } { QScriptEngineDebugger debugger; @@ -147,6 +161,14 @@ void tst_QScriptEngineDebugger::attachAndDetach() debugger2.attachTo(&engine); } #endif + { + QScriptEngine *engine = new QScriptEngine; + QScriptEngineDebugger debugger; + debugger.attachTo(engine); + delete engine; + QScriptEngine engine2; + debugger.attachTo(&engine2); + } } void tst_QScriptEngineDebugger::action() @@ -457,7 +479,7 @@ void tst_QScriptEngineDebugger::consoleCommands() outputEdit->clear(); executeConsoleCommand(inputEdit, outputEdit, ".backtrace"); - QCOMPARE(outputEdit->toPlainText(), QString::fromLatin1("qsdb> .backtrace\n#0 <global>()@:-1")); + QCOMPARE(outputEdit->toPlainText(), QString::fromLatin1("qsdb> .backtrace\n#0 <global>() at -1")); outputEdit->clear(); executeConsoleCommand(inputEdit, outputEdit, ".down"); @@ -469,7 +491,7 @@ void tst_QScriptEngineDebugger::consoleCommands() outputEdit->clear(); executeConsoleCommand(inputEdit, outputEdit, ".frame"); - QCOMPARE(outputEdit->toPlainText(), QString::fromLatin1("qsdb> .frame\n#0 <global>()@:-1")); + QCOMPARE(outputEdit->toPlainText(), QString::fromLatin1("qsdb> .frame\n#0 <global>() at -1")); outputEdit->clear(); executeConsoleCommand(inputEdit, outputEdit, ".break foo.qs:789"); |