Allow focus to capture a single Test

This commit is contained in:
Ukendio 2025-04-22 04:22:55 +02:00
parent ca19d15d04
commit 9c915e131b

View file

@ -226,6 +226,8 @@ local function CHECK<T>(value: T, stack: number?): T?
return value
end
local test_focused = false
local function TEST(name: string, fn: () -> ())
test = {
@ -238,6 +240,10 @@ local function TEST(name: string, fn: () -> ())
local t = test
if check_for_focused and not test_focused then
test.focus = true
test_focused = true
end
table.insert(tests, t)
end
@ -245,15 +251,10 @@ local function FOCUS()
assert(test, "no active test")
check_for_focused = true
if test.case then
test.case.focus = true
else
test.focus = true
end
test_focused = false
end
local function FINISH(): number
local success = true
local total_cases = 0
local passed_cases = 0
local passed_focus_cases = 0