aboutsummaryrefslogtreecommitdiff
path: root/testes/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/main.lua')
-rw-r--r--testes/main.lua23
1 files changed, 22 insertions, 1 deletions
diff --git a/testes/main.lua b/testes/main.lua
index dc48dc48..98d36951 100644
--- a/testes/main.lua
+++ b/testes/main.lua
@@ -78,6 +78,9 @@ end
78 78
79RUN('lua -v') 79RUN('lua -v')
80 80
81RUN('lua -v > %s', out)
82local release = string.match(getoutput(), "Lua (%d+%.%d+%.%d+)")
83
81print(string.format("(temporary program file used in these tests: %s)", prog)) 84print(string.format("(temporary program file used in these tests: %s)", prog))
82 85
83-- running stdin as a file 86-- running stdin as a file
@@ -167,7 +170,9 @@ checkout("10\n11\n")
167-- test errors in LUA_INIT 170-- test errors in LUA_INIT
168NoRun('LUA_INIT:1: msg', 'env LUA_INIT="error(\'msg\')" lua') 171NoRun('LUA_INIT:1: msg', 'env LUA_INIT="error(\'msg\')" lua')
169 172
170-- test option '-E' 173
174print("testing option '-E'")
175
171local defaultpath, defaultCpath 176local defaultpath, defaultCpath
172 177
173do 178do
@@ -192,6 +197,22 @@ assert(not string.find(defaultpath, "xxx") and
192 string.find(defaultCpath, "lua")) 197 string.find(defaultCpath, "lua"))
193 198
194 199
200-- (LUA_READLINELIB was introduced in 5.5.1)
201if release >= "5.5.1" then
202 print"testing readline library name"
203 -- should generate a warning when trying to load inexistent library "xuxu"
204 local env = [[LUA_READLINELIB=xuxu LUA_INIT="warn('@allow')"]]
205 local code = 'echo " " | env %s lua %s -W -i >%s 2>&1'
206 RUN(code, env, "", out) -- run code with no extra options
207 assert(string.find(getoutput(),
208 "warning: unable to load readline library 'xuxu'"))
209
210 RUN(code, env, "-E", out) -- run again with option -E
211 -- no warning when LUA_READLINELIB is to be ignored
212 assert(not string.find(getoutput(), "warning"))
213end
214
215
195-- test replacement of ';;' to default path 216-- test replacement of ';;' to default path
196local function convert (p) 217local function convert (p)
197 prepfile("print(package.path)") 218 prepfile("print(package.path)")