mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-26 07:34:35 +00:00
Merge pull request #65 from TurtleP/turtlep/one_of_bugfix
Fix assert:one_of for non-string values
This commit is contained in:
commit
ea20cbbf21
@ -90,9 +90,14 @@ function assert:one_of(a, t, msg, stack_level)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local values = {}
|
||||||
|
for index = 1, #t do
|
||||||
|
values[index] = tostring(t[index])
|
||||||
|
end
|
||||||
|
|
||||||
error(("assertion failed: %s not one of %s %s"):format(
|
error(("assertion failed: %s not one of %s %s"):format(
|
||||||
tostring(a),
|
tostring(a),
|
||||||
table.concat(t, ", "),
|
table.concat(values, ", "),
|
||||||
_extra(msg)
|
_extra(msg)
|
||||||
), 2 + (stack_level or 0))
|
), 2 + (stack_level or 0))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user