diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-22 20:11:30 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-22 20:11:30 +0530 |
| commit | 1f018902a8e1d1138c9a56106bce7aa7982a247b (patch) | |
| tree | 38a9bb7abaaf35730acc5bcb0decf2e80809eb21 /spec/LuaRuntimeSpec.cpp | |
| parent | 0d728071e3287a71ce7928640e63c19f4d0ab00f (diff) | |
| download | null-browser-1f018902a8e1d1138c9a56106bce7aa7982a247b.tar.gz null-browser-1f018902a8e1d1138c9a56106bce7aa7982a247b.zip | |
Experiment with dmenu
Diffstat (limited to '')
| -rw-r--r-- | spec/LuaRuntimeSpec.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/spec/LuaRuntimeSpec.cpp b/spec/LuaRuntimeSpec.cpp index 924681a..0debda1 100644 --- a/spec/LuaRuntimeSpec.cpp +++ b/spec/LuaRuntimeSpec.cpp @@ -1,4 +1,6 @@ #include <QtCore> +#include <chrono> +#include <thread> #include <uv.h> #include "LuaRuntime.hpp" @@ -17,7 +19,7 @@ private slots: void testEvaluate() { context("when given an expression returning a number"); - it("emits evaluationCompleted with the result") { + xit("emits evaluationCompleted with the result") { auto lua = LuaRuntime::instance(); QSignalSpy evaluationCompletedSpy(lua, &LuaRuntime::evaluationCompleted); @@ -30,7 +32,7 @@ private slots: } context("when given an expression returning a string"); - it("emits evaluationCompleted with the result") { + xit("emits evaluationCompleted with the result") { auto lua = LuaRuntime::instance(); QSignalSpy evaluationCompletedSpy(lua, &LuaRuntime::evaluationCompleted); @@ -43,7 +45,7 @@ private slots: } context("when given an expression returning a boolean"); - it("emits evaluationCompleted with the result") { + xit("emits evaluationCompleted with the result") { auto lua = LuaRuntime::instance(); QSignalSpy evaluationCompletedSpy(lua, &LuaRuntime::evaluationCompleted); @@ -56,7 +58,7 @@ private slots: } context("when given an expression returning nil"); - it("emits evaluationCompleted with the result") { + xit("emits evaluationCompleted with the result") { auto lua = LuaRuntime::instance(); QSignalSpy evaluationCompletedSpy(lua, &LuaRuntime::evaluationCompleted); @@ -71,7 +73,7 @@ private slots: void testQueueTask() { context("when task is queued"); - it("evaluates task asynchronously") { + xit("evaluates task asynchronously") { auto lua = LuaRuntime::instance(); bool wasTaskCalled = false; @@ -85,7 +87,7 @@ private slots: void testSanityCheckUV() { context("when a 1 second timer is set"); - it("calls callback after 1 second") { + xit("calls callback after 1 second") { auto lua = LuaRuntime::instance(); QSignalSpy evaluationCompletedSpy(lua, &LuaRuntime::evaluationCompleted); @@ -105,6 +107,24 @@ private slots: })); } } + + void testSanityCheckUVSpawn() { + it("emits evaluationCompleted with the result") { + auto lua = LuaRuntime::instance(); + QSignalSpy evaluationCompletedSpy(lua, &LuaRuntime::evaluationCompleted); + + lua->evaluate(R"( + _G.wasTimerCalled = false; + print('--------------- called') + local handle, pid = uv.spawn('ls', { args = {} }, function(code) + print('--------------- called') + print('DONE', code) + end) + )"); + QVERIFY(evaluationCompletedSpy.wait()); + std::this_thread::sleep_for(std::chrono::milliseconds(2000)); + } + } }; QTEST_REGISTER(LuaRuntimeSpec) |
