diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2026-01-30 16:47:33 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2026-01-30 16:47:33 -0300 |
| commit | c6b484823806e08e1756b1a6066a3ace6f080fae (patch) | |
| tree | 5524308cc0db8cc84878caa8a44236bcfe9dde4a /testes | |
| parent | efbc29754544dd820bfdc81edf17d7dcfad31d05 (diff) | |
| download | lua-c6b484823806e08e1756b1a6066a3ace6f080fae.tar.gz lua-c6b484823806e08e1756b1a6066a3ace6f080fae.tar.bz2 lua-c6b484823806e08e1756b1a6066a3ace6f080fae.zip | |
The name of the readline library can be changed from its default value
through environment variable LUA_READLINELIB.
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/main.lua | 23 |
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 | ||
| 79 | RUN('lua -v') | 79 | RUN('lua -v') |
| 80 | 80 | ||
| 81 | RUN('lua -v > %s', out) | ||
| 82 | local release = string.match(getoutput(), "Lua (%d+%.%d+%.%d+)") | ||
| 83 | |||
| 81 | print(string.format("(temporary program file used in these tests: %s)", prog)) | 84 | print(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 |
| 168 | NoRun('LUA_INIT:1: msg', 'env LUA_INIT="error(\'msg\')" lua') | 171 | NoRun('LUA_INIT:1: msg', 'env LUA_INIT="error(\'msg\')" lua') |
| 169 | 172 | ||
| 170 | -- test option '-E' | 173 | |
| 174 | print("testing option '-E'") | ||
| 175 | |||
| 171 | local defaultpath, defaultCpath | 176 | local defaultpath, defaultCpath |
| 172 | 177 | ||
| 173 | do | 178 | do |
| @@ -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) | ||
| 201 | if 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")) | ||
| 213 | end | ||
| 214 | |||
| 215 | |||
| 195 | -- test replacement of ';;' to default path | 216 | -- test replacement of ';;' to default path |
| 196 | local function convert (p) | 217 | local function convert (p) |
| 197 | prepfile("print(package.path)") | 218 | prepfile("print(package.path)") |
