mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 06:04: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
|
||||
|
||||
local values = {}
|
||||
for index = 1, #t do
|
||||
values[index] = tostring(t[index])
|
||||
end
|
||||
|
||||
error(("assertion failed: %s not one of %s %s"):format(
|
||||
tostring(a),
|
||||
table.concat(t, ", "),
|
||||
table.concat(values, ", "),
|
||||
_extra(msg)
|
||||
), 2 + (stack_level or 0))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user