From 98a0bd9a97190be8ba10f14a3d67e42de827b04a Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 5 Jan 2018 15:38:37 -0200 Subject: path: use versioned LUA_xPATH_5_x variables `luarocks path` now exports versioned variables `LUA_PATH_5_x` and `LUA_CPATH_5_x` instead of `LUA_PATH` and `LUA_CPATH` when those are in use in your system. Fixes #760. --- spec/path_spec.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'spec') diff --git a/spec/path_spec.lua b/spec/path_spec.lua index 22f07591..536233b1 100644 --- a/spec/path_spec.lua +++ b/spec/path_spec.lua @@ -8,6 +8,40 @@ describe("LuaRocks path tests #blackbox #b_path", function() test_env.setup_specs() end) + it("LuaRocks path", function() + local output = run.luarocks("path") + assert.match("LUA_PATH=", output) + assert.match("LUA_CPATH=", output) + end) + + if _VERSION:match("[23]") then + local v = _VERSION:gsub("Lua (%d+)%.(%d+)", "%1_%2") + + it("LuaRocks path with LUA_PATH_"..v, function() + local output = run.luarocks("path", { + ["LUA_PATH_"..v] = package.path, + }) + assert.match("LUA_PATH_"..v.."=", output) + end) + + it("LuaRocks path with LUA_CPATH_"..v, function() + local output = run.luarocks("path", { + ["LUA_CPATH_"..v] = package.cpath, + }) + assert.match("LUA_CPATH_"..v.."=", output) + end) + + it("LuaRocks path with LUA_PATH_"..v.." and LUA_CPATH_"..v, function() + local output = run.luarocks("path", { + ["LUA_PATH_"..v] = package.path, + ["LUA_CPATH_"..v] = package.cpath, + }) + assert.match("LUA_PATH_"..v.."=", output) + assert.match("LUA_CPATH_"..v.."=", output) + end) + + end + it("LuaRocks path bin", function() assert.is_true(run.luarocks_bool("path --bin")) end) -- cgit v1.2.3-55-g6feb