test: include test path in summary (#39141)

Ref: https://github.com/neovim/neovim/pull/38486#discussion_r3088483987
This commit is contained in:
zeertzjq
2026-04-17 21:20:36 +08:00
committed by GitHub
parent 2c67daee88
commit fefad0721a
7 changed files with 119 additions and 104 deletions

View File

@@ -126,13 +126,27 @@ end
--- @param pat string
--- @param actual string
--- @param plain boolean? (default: false)
--- @return boolean
function M.matches(pat, actual)
function M.matches(pat, actual, plain)
assert(pat and pat ~= '', 'pat must be a non-empty string')
if nil ~= string.match(actual, pat) then
assert(plain == nil or type(plain) == 'boolean', 'plain must be nil or boolean')
if nil ~= string.find(actual, pat, 1, plain) then
return true
end
error(string.format('Pattern does not match.\nPattern:\n%s\nActual:\n%s', pat, actual))
error(('Pattern does not match.\nPattern:\n%s\nActual:\n%s'):format(pat, actual))
end
--- @param pat string
--- @param actual string
--- @param plain boolean? (default: false)
--- @return boolean
function M.not_matches(pat, actual, plain)
assert(pat and pat ~= '', 'pat must be a non-empty string')
if nil == string.find(actual, pat, 1, plain) then
return true
end
error(('Pattern does match.\nPattern:\n%s\nActual:\n%s'):format(pat, actual))
end
--- Asserts that `pat` matches (or *not* if inverse=true) any text in the tail of `logfile`.