mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +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
|
return value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local test_focused = false
|
||||||
|
|
||||||
local function TEST(name: string, fn: () -> ())
|
local function TEST(name: string, fn: () -> ())
|
||||||
|
|
||||||
test = {
|
test = {
|
||||||
|
@ -238,6 +240,10 @@ local function TEST(name: string, fn: () -> ())
|
||||||
|
|
||||||
local t = test
|
local t = test
|
||||||
|
|
||||||
|
if check_for_focused and not test_focused then
|
||||||
|
test.focus = true
|
||||||
|
test_focused = true
|
||||||
|
end
|
||||||
table.insert(tests, t)
|
table.insert(tests, t)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -245,15 +251,10 @@ local function FOCUS()
|
||||||
assert(test, "no active test")
|
assert(test, "no active test")
|
||||||
|
|
||||||
check_for_focused = true
|
check_for_focused = true
|
||||||
if test.case then
|
test_focused = false
|
||||||
test.case.focus = true
|
|
||||||
else
|
|
||||||
test.focus = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function FINISH(): number
|
local function FINISH(): number
|
||||||
local success = true
|
|
||||||
local total_cases = 0
|
local total_cases = 0
|
||||||
local passed_cases = 0
|
local passed_cases = 0
|
||||||
local passed_focus_cases = 0
|
local passed_focus_cases = 0
|
||||||
|
|
Loading…
Reference in a new issue