Local declaration in the REPL generates a warning

This commit is contained in:
Roberto Ierusalimschy
2024-09-27 10:00:35 -03:00
parent 20d42ccaae
commit e4f418f07c
2 changed files with 25 additions and 2 deletions

View File

@@ -263,6 +263,15 @@ assert(string.find(getoutput(), "error calling 'print'"))
RUN('echo "io.stderr:write(1000)\ncont" | lua -e "require\'debug\'.debug()" 2> %s', out)
checkout("lua_debug> 1000lua_debug> ")
do -- test warning for locals
RUN('echo " local x" | lua -i > %s 2>&1', out)
assert(string.find(getoutput(), "warning: "))
RUN('echo "local1 = 10\nlocal1 + 3" | lua -i > %s 2>&1', out)
local t = getoutput()
assert(not string.find(t, "warning"))
assert(string.find(t, "13"))
end
print("testing warnings")