From 9c915e131b9123de45000c1e7602aca1dd1aa690 Mon Sep 17 00:00:00 2001 From: Ukendio Date: Tue, 22 Apr 2025 04:22:55 +0200 Subject: [PATCH] Allow focus to capture a single Test --- tools/testkit.luau | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/testkit.luau b/tools/testkit.luau index 223eb0c..cb92c49 100644 --- a/tools/testkit.luau +++ b/tools/testkit.luau @@ -226,6 +226,8 @@ local function CHECK(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