Cast in 'rl_readline_name'

In Mac OS, 'rl_readline_name' is declared as 'char*', instead of
'const char*', so we cannot assign to it a string literal such as "lua".
This commit is contained in:
Roberto I
2026-10-16 11:16:12 -03:00
parent 15b2a78106
commit 8cb93bada5
2 changed files with 7 additions and 4 deletions
+5 -3
View File
@@ -199,14 +199,16 @@ assert(not string.find(defaultpath, "xxx") and
-- (LUA_READLINELIB was introduced in 5.5.1)
if release >= "5.5.1" then
-- OBS: this test is not valid when Lua is compiled with LUA_USE_READLINE
print"testing readline library name"
-- should generate a warning when trying to load inexistent library "xuxu"
local env = [[LUA_READLINELIB=xuxu LUA_INIT="warn('@allow')"]]
local code = 'echo " " | env %s lua %s -W -i >%s 2>&1'
RUN(code, env, "", out) -- run code with no extra options
assert(string.find(getoutput(),
"warning: unable to load readline library 'xuxu'"))
if(not string.find(getoutput(),
"warning: unable to load readline library 'xuxu'")) then
error("Is Lua compiled with option LUA_USE_READLINE?")
end
RUN(code, env, "-E", out) -- run again with option -E
-- no warning when LUA_READLINELIB is to be ignored
assert(not string.find(getoutput(), "warning"))