Commit 1be25a8e authored by François Perrad's avatar François Perrad
Browse files

refactor with _retrieve_progname

parent 6c2aa879
......@@ -2,6 +2,7 @@ codes = true
max_line_length = 132
read_globals = {
-- test_assertion (subset of Test.Assertion)
'_retrieve_progname',
'plan',
'done_testing',
'skip_all',
......
......@@ -41,7 +41,7 @@ elseif ravi then
banner = '^Ravi %d%.%d%.%d'
end
local lua = arg[-3] or arg[-1]
local lua = _retrieve_progname()
local luac = jit and lua or (lua .. 'c')
if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
......
......@@ -38,7 +38,7 @@ if ravi then
skip_all("ravi")
end
local lua = arg[-3] or arg[-1]
local lua = _retrieve_progname()
local luac = lua .. 'c'
if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
......
......@@ -48,7 +48,7 @@ local has_warn = _VERSION >= 'Lua 5.4'
local has_xpcall52 = _VERSION >= 'Lua 5.2' or jit
local has_xpcall53 = _VERSION >= 'Lua 5.3' or jit
local lua = arg[-3] or arg[-1]
local lua = _retrieve_progname()
plan'no_plan'
......
......@@ -40,7 +40,7 @@ local has_read53 = _VERSION >= 'Lua 5.3' or luajit21
local has_meta53 = _VERSION >= 'Lua 5.3'
local has_meta54 = _VERSION >= 'Lua 5.4'
local lua = arg[-3] or arg[-1]
local lua = _retrieve_progname()
plan'no_plan'
......
......@@ -34,7 +34,7 @@ require'test_assertion'
local profile = require'profile'
local luajit20 = jit and (jit.version_num < 20100 and not jit.version:match'^RaptorJIT')
local has_execute51 = _VERSION == 'Lua 5.1' and (not profile.luajit_compat52 or ujit)
local lua = arg[-3] or arg[-1]
local lua = _retrieve_progname()
plan'no_plan'
......
......@@ -26,7 +26,7 @@ Tests Lua Basic & IO Libraries with stdin
require'test_assertion'
local lua = arg[-3] or arg[-1]
local lua = _retrieve_progname()
if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
skip_all "io.popen not supported"
......
......@@ -31,7 +31,7 @@ if not jit or ujit then
skip_all("only with LuaJIT")
end
local lua = arg[-3] or arg[-1]
local lua = _retrieve_progname()
if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
skip_all("io.popen not supported")
......
......@@ -9,6 +9,14 @@
]]
function _retrieve_progname ()
local i = 0
while arg[i] do
i = i - 1
end
return arg[i + 1]
end
if pcall(require, 'Test.Assertion') then
diag 'Test.Assertion loaded'
return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment