From b293ae0577bebaca7169cb4f041b800641d5e2c4 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 28 May 2019 15:46:49 -0300 Subject: 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' --- testes/constructs.lua | 6 +++--- testes/locals.lua | 1 - testes/strings.lua | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'testes') diff --git a/testes/constructs.lua b/testes/constructs.lua index b91e0979..fe4db2cb 100644 --- a/testes/constructs.lua +++ b/testes/constructs.lua @@ -215,7 +215,7 @@ do -- testing constants checkload(prog, "unknown attribute 'XXX'") checkload([[local 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 x = nil x = io.open() - ]], ":2: assignment to const variable 'x'") + ]], ":2: attempt to assign to const variable 'x'") end f = [[ diff --git a/testes/locals.lua b/testes/locals.lua index c176f506..e59ab95a 100644 --- a/testes/locals.lua +++ b/testes/locals.lua @@ -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 diff --git a/testes/strings.lua b/testes/strings.lua index 3e32f2c4..1b2b570e 100644 --- a/testes/strings.lua +++ b/testes/strings.lua @@ -3,7 +3,8 @@ print('testing strings and string library') -local maxi, mini = math.maxinteger, math.mininteger +local maxi = math.maxinteger +local mini = math.mininteger local function checkerror (msg, f, ...) -- cgit v1.2.3-55-g6feb