1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-22 09:27:39 +00:00

Various VM tests

These are largely copied across from Cobalt's test suite, with some
minor tweaks. It actually exposed one bug in Cobalt, which is pretty
nice.

One interesting thing from the coroutine tests, is that Lua 5.4 (and
one assumes 5.2/5.3) doesn't allow yielding from within the error
handler of xpcall - I rather thought it might.

This doesn't add any of the PUC Lua tests yet - I got a little
distracted.

Also:
 - Allow skipping "keyword" tests, in the style of busted. This is
   implemented on the Java side for now.
 - Fix a bug with os.date("%I", _) not being 2 characters wide.
This commit is contained in:
Jonathan Coates
2021-04-27 22:24:28 +01:00
parent 92b45b1868
commit 3cb25b3525
9 changed files with 409 additions and 10 deletions

View File

@@ -612,6 +612,9 @@ local function do_run(test)
elseif test.action then
local state = push_state()
-- Flush the event queue and ensure we're running with 0 timeout.
os.queueEvent("start_test") os.pullEvent("start_test")
local ok
ok, err = try(test.action)
status = ok and "pass" or (err.fail and "fail" or "error")