summaryrefslogtreecommitdiff
path: root/spec/path_spec.lua
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2025-02-03 21:29:42 +0100
committerMike Vink <mike@pionative.com>2025-02-03 21:29:42 +0100
commit5155816b7b925dec5d5feb1568b1d7ceb00938b9 (patch)
treedeca28ea15e79f6f804c3d90d2ba757881638af5 /spec/path_spec.lua
fetch tarballHEADmaster
Diffstat (limited to 'spec/path_spec.lua')
-rw-r--r--spec/path_spec.lua58
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/path_spec.lua b/spec/path_spec.lua
new file mode 100644
index 0000000..1ad6b3a
--- /dev/null
+++ b/spec/path_spec.lua
@@ -0,0 +1,58 @@
+local test_env = require("spec.util.test_env")
+local run = test_env.run
+
+describe("luarocks path #integration", function()
+ before_each(function()
+ test_env.setup_specs()
+ end)
+
+ it("runs", 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("with LUA_PATH_"..v, function()
+ local output = run.luarocks("path", {
+ ["LUA_PATH_"..v] = package.path,
+ })
+ assert.match("LUA_PATH_"..v.."=", output)
+ end)
+
+ it("with LUA_CPATH_"..v, function()
+ local output = run.luarocks("path", {
+ ["LUA_CPATH_"..v] = package.cpath,
+ })
+ assert.match("LUA_CPATH_"..v.."=", output)
+ end)
+
+ it("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("--bin", function()
+ assert.is_true(run.luarocks_bool("path --bin"))
+ end)
+
+ it("--lr-path", function()
+ assert.is_true(run.luarocks_bool("path --lr-path"))
+ end)
+
+ it("--lr-cpath", function()
+ assert.is_true(run.luarocks_bool("path --lr-cpath"))
+ end)
+
+ it("--tree", function()
+ assert.is_true(run.luarocks_bool("path --tree=lua_modules"))
+ end)
+end)