Skip to content

Commit efb246a

Browse files
committed
[doc] Add documentation about runner
1 parent 90e4f68 commit efb246a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Diff for: gui/gui.lua

+5
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ local function start_test(item)
143143
run_tests_in_seperate_process()
144144
end
145145

146+
-- test_started event is published by the runner process for each started test
146147
on_event("test_started", function(e)
147148
if e._from != runner_pid then
148149
-- discard events from old runners
@@ -159,6 +160,7 @@ on_event("test_started", function(e)
159160
sfx(1)
160161
end)
161162

163+
-- test_finished event is published by the runner process for each started test
162164
on_event("test_finished", function(e)
163165
if e._from != runner_pid then
164166
-- discard events from old runners
@@ -236,6 +238,8 @@ on_event("test_finished", function(e)
236238
-- update text for all parents
237239
end)
238240

241+
-- print event is published by the runner process for each print command
242+
-- executed by test
239243
on_event("print", function(e)
240244
if e._from != runner_pid then
241245
-- discard events from old runners
@@ -245,6 +249,7 @@ on_event("print", function(e)
245249
printed_lines:print(e.test.id, e.text)
246250
end)
247251

252+
-- done event is published by the runner process when all test have finished
248253
on_event("done", function(e)
249254
if e._from != runner_pid then
250255
-- discard events from old runners

Diff for: runner.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
-- (c) 2024 Jacek Olszak
22
-- This code is licensed under MIT license (see LICENSE for details)
33

4-
-- runner is a seperate application spawn by gui in a dedicated process.
5-
-- Therefore tests which are run does not block game loop.
4+
-- runner is a seperate application spawn by gui/cli in a dedicated process.
5+
-- runner runs user tests. Once done, runner exits.
6+
-- runner is needed because running tests from inside GUI will block the game
7+
-- loop or will have a potential side effects (like drawing in the window)
8+
9+
-- runner send messages with events to communicate with the parent process.
610

711
include "api.lua"
812

0 commit comments

Comments
 (0)