diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-05-28 15:46:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-05-28 15:46:49 -0300 |
commit | b293ae0577bebaca7169cb4f041b800641d5e2c4 (patch) | |
tree | bda609d72277433bda3537ac50ed8fecf9a73898 /testes | |
parent | d9f40e3f6fb61650240c47d548bee69b24b07859 (diff) | |
download | lua-b293ae0577bebaca7169cb4f041b800641d5e2c4.tar.gz lua-b293ae0577bebaca7169cb4f041b800641d5e2c4.tar.bz2 lua-b293ae0577bebaca7169cb4f041b800641d5e2c4.zip |
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'
Diffstat (limited to 'testes')
-rw-r--r-- | testes/constructs.lua | 6 | ||||
-rw-r--r-- | testes/locals.lua | 1 | ||||
-rw-r--r-- | testes/strings.lua | 3 |
3 files changed, 5 insertions, 5 deletions
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 | |||
215 | checkload(prog, "unknown attribute 'XXX'") | 215 | checkload(prog, "unknown attribute 'XXX'") |
216 | 216 | ||
217 | checkload([[local <const> xxx = 20; xxx = 10]], | 217 | checkload([[local <const> xxx = 20; xxx = 10]], |
218 | ":1: assignment to const variable 'xxx'") | 218 | ":1: attempt to assign to const variable 'xxx'") |
219 | 219 | ||
220 | checkload([[ | 220 | checkload([[ |
221 | local xx; | 221 | local xx; |
@@ -225,12 +225,12 @@ do -- testing constants | |||
225 | local abc = xx + yyy + xxx; | 225 | local abc = xx + yyy + xxx; |
226 | return function () return function () xxx = yyy end end | 226 | return function () return function () xxx = yyy end end |
227 | end | 227 | end |
228 | ]], ":6: assignment to const variable 'xxx'") | 228 | ]], ":6: attempt to assign to const variable 'xxx'") |
229 | 229 | ||
230 | checkload([[ | 230 | checkload([[ |
231 | local <toclose> x = nil | 231 | local <toclose> x = nil |
232 | x = io.open() | 232 | x = io.open() |
233 | ]], ":2: assignment to const variable 'x'") | 233 | ]], ":2: attempt to assign to const variable 'x'") |
234 | end | 234 | end |
235 | 235 | ||
236 | f = [[ | 236 | 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 | |||
452 | end) | 452 | end) |
453 | assert(co() == 100) | 453 | assert(co() == 100) |
454 | local st, msg = pcall(co) | 454 | local st, msg = pcall(co) |
455 | print(msg) | ||
456 | -- should get last error raised | 455 | -- should get last error raised |
457 | assert(not st and string.find(msg, "%w+%.%w+:%d+: XXX")) | 456 | assert(not st and string.find(msg, "%w+%.%w+:%d+: XXX")) |
458 | end | 457 | 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 @@ | |||
3 | 3 | ||
4 | print('testing strings and string library') | 4 | print('testing strings and string library') |
5 | 5 | ||
6 | local maxi, mini = math.maxinteger, math.mininteger | 6 | local <const> maxi = math.maxinteger |
7 | local <const> mini = math.mininteger | ||
7 | 8 | ||
8 | 9 | ||
9 | local function checkerror (msg, f, ...) | 10 | local function checkerror (msg, f, ...) |