Skip to content

Commit

Permalink
The generated luapath script does not set the LUAZDF_PATH variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schulz committed Feb 10, 2019
1 parent 0e64eae commit a33a051
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions bin/lzt
Original file line number Diff line number Diff line change
Expand Up @@ -1677,9 +1677,8 @@ elseif cmd == "luapath" then
local lines = {}

local root = ztree.root
table.insert( lines, 'LUAZDF_PATH="'..root..'"' )
for _, m in ipairs( modules ) do
table.insert( lines, upper( m )..'="$LUAZDF_PATH/'..m..'/?/?.lua"' )
table.insert( lines, upper( m )..'="'..root..'/'..m..'/?/?.lua"' )
end
modules = map( modules, upper )
table.insert( lines, 'export LUA_PATH="$'..table.concat( modules, ";$" )..';;"' )
Expand Down
9 changes: 4 additions & 5 deletions test/luapath.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
@test "luapath" {
run ../bin/lzt --dir data/zdf luapath
[ "$status" -eq 0 ]
[ "${lines[0]}" = 'LUAZDF_PATH="data/zdf"' ]
[ "${lines[1]}" = 'LUAZDF_MOD1="$LUAZDF_PATH/mod1/?/?.lua"' ]
[ "${lines[2]}" = 'LUAZDF_MOD2="$LUAZDF_PATH/mod2/?/?.lua"' ]
[ "${lines[3]}" = 'LUAZDF_MOD3="$LUAZDF_PATH/mod3/?/?.lua"' ]
[ "${lines[4]}" = 'export LUA_PATH="$LUAZDF_MOD1;$LUAZDF_MOD2;$LUAZDF_MOD3;;"' ]
[ "${lines[0]}" = 'LUAZDF_MOD1="data/zdf/mod1/?/?.lua"' ]
[ "${lines[1]}" = 'LUAZDF_MOD2="data/zdf/mod2/?/?.lua"' ]
[ "${lines[2]}" = 'LUAZDF_MOD3="data/zdf/mod3/?/?.lua"' ]
[ "${lines[3]}" = 'export LUA_PATH="$LUAZDF_MOD1;$LUAZDF_MOD2;$LUAZDF_MOD3;;"' ]
}

@test "luapath xyz error" {
Expand Down

0 comments on commit a33a051

Please sign in to comment.