From e4f418f07c7349f5ff844fbdc9a3b37b488113a5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 27 Sep 2024 10:00:35 -0300 Subject: Local declaration in the REPL generates a warning --- testes/main.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'testes') diff --git a/testes/main.lua b/testes/main.lua index 7b0f4ee0..1aa7b217 100644 --- a/testes/main.lua +++ b/testes/main.lua @@ -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") -- cgit v1.2.3-55-g6feb