test: fix confusing behavior of eq() with context (#40375)

(cherry picked from commit ceaf2baa60)
This commit is contained in:
zeertzjq
2026-06-23 18:30:23 +08:00
committed by github-actions[bot]
parent 3dd3a6ceab
commit 6707ad275d

View File

@@ -21,11 +21,10 @@ end
--- @param condition boolean
--- @param value any
--- @param context any
--- @param fallback string
local function assert_value(condition, value, context, fallback)
--- @param message string
local function assert_value(condition, value, context, message)
if not condition then
local message = context ~= nil and tostring(context) or fallback
error(message, 0)
error((context ~= nil and tostring(context) .. ': ' or '') .. message, 0)
end
return value
end