lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Maybe try adding `local print = print` around line 47? Quickly glancing at the code, print is the only global not made into a local this way. Aside from that, you could try changing the print on line 722 to an error, though that might have other consequences.

On May 11, 2016 6:32:23 PM EDT, Dan Christian <danchristian65@gmail.com> wrote:
I'm running into an odd syntax error when running lunitx under luajit 2.0.

$ luajit test_libcrypt.lua --help
luajit: /usr/local/share/lua/5.1/lunit.lua:737: attempt to call global
'print' (a nil value)
stack traceback:
/usr/local/share/lua/5.1/lunit.lua:737: in function 'main'
test_libcrypt.lua:44: in main chunk

I can run tests just fine. Other command line switches seem to get
parsed. It's only the help that's broken. I have a specific reason
to avoid the sh wrapper script. I using this on an embedded system
with limited shell support.

LuaJIT reports as 5.1, so I'm assuming it's related to the 5.1 module support.

Here is the code:
#!/usr/bin/env luajit
require('lunit')
if _VERSION >= 'Lua 5.2' then
_ENV = lunit.module('test_libcrypt','seeall')
else
module("test_libcrypt", lunit.testcase, package.seeall) -- markthis as a test case
end

function test_LibCrypt()
end

if arg[0]:match("[._%w]*$") == 'test_libcrypt.lua' then
lunit.main(arg)
end

I don't see a way to report a bug at github.com/dcurrie/lunit

Anybody know how to fix this?

Thanks
Dan