diff options
| author | Mike Vink <mike@pionative.com> | 2025-02-03 21:29:42 +0100 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2025-02-03 21:29:42 +0100 |
| commit | 5155816b7b925dec5d5feb1568b1d7ceb00938b9 (patch) | |
| tree | deca28ea15e79f6f804c3d90d2ba757881638af5 /spec/which_spec.lua | |
Diffstat (limited to 'spec/which_spec.lua')
| -rw-r--r-- | spec/which_spec.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/which_spec.lua b/spec/which_spec.lua new file mode 100644 index 0000000..5712511 --- /dev/null +++ b/spec/which_spec.lua @@ -0,0 +1,39 @@ +local test_env = require("spec.util.test_env") +local run = test_env.run +local P = test_env.P + +local extra_rocks = { + "/say-1.2-1.src.rock", +} + +describe("luarocks which #integration", function() + + lazy_setup(function() + test_env.setup_specs(extra_rocks) + end) + + it("fails on missing arguments", function() + local output = run.luarocks("which") + assert.match("missing argument 'modname'", output, 1, true) + end) + + it("finds modules found in package.path", function() + assert.is_true(run.luarocks_bool("install say 1.2")) + local output = run.luarocks("which say") + assert.match(P"say/init.lua", output, 1, true) + assert.match("provided by say 1.2-1", output, 1, true) + end) + + it("finds modules found in package.path", function() + run.luarocks("install ") + local output = run.luarocks("which luarocks.loader") + assert.match("luarocks/loader.lua", output, 1, true) + assert.match("not installed as a rock", output, 1, true) + end) + + it("report modules not found", function() + local output = run.luarocks("which asdfgaoeui") + assert.match("Module 'asdfgaoeui' not found", output, 1, true) + end) + +end) |
