diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-04-10 12:58:14 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-04-10 12:58:14 -0300 |
| commit | 8ba4523cccf59093543cec988b07957193d55692 (patch) | |
| tree | 761eb3efbdbe54372d8d5486c2469c337be1f8a8 /testes | |
| parent | 979ad95eb114d8d43f928b184f051ac0cfacedf7 (diff) | |
| download | lua-8ba4523cccf59093543cec988b07957193d55692.tar.gz lua-8ba4523cccf59093543cec988b07957193d55692.tar.bz2 lua-8ba4523cccf59093543cec988b07957193d55692.zip | |
'print' does not call 'tostring' to format its arguments
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/calls.lua | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/testes/calls.lua b/testes/calls.lua index 941493b1..56a12ae6 100644 --- a/testes/calls.lua +++ b/testes/calls.lua | |||
| @@ -21,21 +21,6 @@ assert(type(f) == 'function') | |||
| 21 | assert(not pcall(type)) | 21 | assert(not pcall(type)) |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | do -- test error in 'print' too... | ||
| 25 | local tostring = _ENV.tostring | ||
| 26 | |||
| 27 | _ENV.tostring = nil | ||
| 28 | local st, msg = pcall(print, 1) | ||
| 29 | assert(st == false and string.find(msg, "attempt to call a nil value")) | ||
| 30 | |||
| 31 | _ENV.tostring = function () return {} end | ||
| 32 | local st, msg = pcall(print, 1) | ||
| 33 | assert(st == false and string.find(msg, "must return a string")) | ||
| 34 | |||
| 35 | _ENV.tostring = tostring | ||
| 36 | end | ||
| 37 | |||
| 38 | |||
| 39 | -- testing local-function recursion | 24 | -- testing local-function recursion |
| 40 | fact = false | 25 | fact = false |
| 41 | do | 26 | do |
