Details
- new error message for "attempt to assign to const variable" - note in the manual about compatibility options - comments - small changes in 'read_line' and 'pushstr'
This commit is contained in:
@@ -215,7 +215,7 @@ do -- testing constants
|
||||
checkload(prog, "unknown attribute 'XXX'")
|
||||
|
||||
checkload([[local <const> xxx = 20; xxx = 10]],
|
||||
":1: assignment to const variable 'xxx'")
|
||||
":1: attempt to assign to const variable 'xxx'")
|
||||
|
||||
checkload([[
|
||||
local xx;
|
||||
@@ -225,12 +225,12 @@ do -- testing constants
|
||||
local abc = xx + yyy + xxx;
|
||||
return function () return function () xxx = yyy end end
|
||||
end
|
||||
]], ":6: assignment to const variable 'xxx'")
|
||||
]], ":6: attempt to assign to const variable 'xxx'")
|
||||
|
||||
checkload([[
|
||||
local <toclose> x = nil
|
||||
x = io.open()
|
||||
]], ":2: assignment to const variable 'x'")
|
||||
]], ":2: attempt to assign to const variable 'x'")
|
||||
end
|
||||
|
||||
f = [[
|
||||
|
||||
@@ -452,7 +452,6 @@ do
|
||||
end)
|
||||
assert(co() == 100)
|
||||
local st, msg = pcall(co)
|
||||
print(msg)
|
||||
-- should get last error raised
|
||||
assert(not st and string.find(msg, "%w+%.%w+:%d+: XXX"))
|
||||
end
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
print('testing strings and string library')
|
||||
|
||||
local maxi, mini = math.maxinteger, math.mininteger
|
||||
local <const> maxi = math.maxinteger
|
||||
local <const> mini = math.mininteger
|
||||
|
||||
|
||||
local function checkerror (msg, f, ...)
|
||||
|
||||
Reference in New Issue
Block a user