Option '-l' discards version sufix from file name

Like 'require', the command-line option '-l' discards an optional
version suffix (everything after an hyphen) from a file name when
creating the module name.
This commit is contained in:
Roberto Ierusalimschy
2023-05-15 13:46:38 -03:00
parent c197885cb0
commit 09f3c2372f
4 changed files with 26 additions and 11 deletions

View File

@@ -225,6 +225,13 @@ prepfile("print(str.upper'alo alo', m.max(10, 20))")
RUN("lua -l 'str=string' '-lm=math' -e 'print(m.sin(0))' %s > %s", prog, out)
checkout("0.0\nALO ALO\t20\n")
-- test module names with version sufix ("libs/lib2-v2")
RUN("env LUA_CPATH='./libs/?.so' lua -l lib2-v2 -e 'print(lib2.id())' > %s",
out)
checkout("true\n")
-- test 'arg' table
local a = [[
assert(#arg == 3 and arg[1] == 'a' and