mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 09:00:02 +00:00
Allow focus to capture a single Test
This commit is contained in:
parent
ca19d15d04
commit
9c915e131b
1 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue