add TSamLast command for reexecuting last running tests

This commit is contained in:
2025-12-25 14:30:34 +01:00
parent 51ec535eac
commit cbc3e201ae
8 changed files with 260 additions and 4 deletions

View File

@@ -67,11 +67,16 @@ local function find_t_runs(lines, func)
return subtests
end
local function escape_go_regex(s)
s = s or ""
return (s:gsub("([\\.^$|()%%[%]{}*+?%-])", "\\\\%1"))
end
local function build_run_pattern(spec)
local name = spec.test_path or ""
local escaped = name:gsub("(%W)", "%%%1")
local escaped = escape_go_regex(name)
if spec.scope == "function" then
return "^" .. escaped .. "$|^" .. escaped .. "/"
return "^" .. escaped .. "($|/)"
else
return "^" .. escaped .. "$"
end