'print' does not call 'tostring' to format its arguments

This commit is contained in:
Roberto Ierusalimschy committed 2019-04-10 12:58:14 -03:00
1 parent 979ad95eb1
commit 8ba4523ccc
3 files changed
+16 -28

No files matched your search

-15
View File
@@ -21,21 +21,6 @@ assert(type(f) == 'function')
assert(not pcall(type))
do -- test error in 'print' too...
local tostring = _ENV.tostring
_ENV.tostring = nil
local st, msg = pcall(print, 1)
assert(st == false and string.find(msg, "attempt to call a nil value"))
_ENV.tostring = function () return {} end
local st, msg = pcall(print, 1)
assert(st == false and string.find(msg, "must return a string"))
_ENV.tostring = tostring
end
-- testing local-function recursion
fact = false
do