aboutsummaryrefslogtreecommitdiff
path: root/spec/list_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/list_spec.lua')
-rw-r--r--spec/list_spec.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/list_spec.lua b/spec/list_spec.lua
new file mode 100644
index 00000000..545483df
--- /dev/null
+++ b/spec/list_spec.lua
@@ -0,0 +1,41 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3
4test_env.unload_luarocks()
5local list = require("luarocks.list")
6
7local extra_rocks = {
8 "/say-1.0-1.src.rock",
9 "/say-1.2-1.src.rock"
10}
11
12expose("LuaRocks list tests #blackbox #b_list", function()
13
14 before_each(function()
15 test_env.setup_specs(extra_rocks)
16 run = test_env.run
17 testing_paths = test_env.testing_paths
18 end)
19
20 it("LuaRocks list with no flags/arguments", function()
21 local output = run.luarocks("list")
22 assert.is.truthy(output:find("luacov"))
23 end)
24
25 it("LuaRocks list porcelain", function()
26 local output = run.luarocks("list --porcelain")
27 local path = testing_paths.testing_sys_tree:gsub("-", "--") -- !not sure! why this is good
28 assert.is.truthy(output:find("luacov\t0.11.0--1\tinstalled\t" .. path .. "/lib/luarocks/rocks" ))
29 end)
30
31 it("LuaRocks install outdated and list it", function()
32 assert.is_true(run.luarocks_bool("install say 1.0-1"))
33 local output = run.luarocks("list --outdated")
34 assert.is.truthy(output:find("say"))
35 end)
36
37 it("LuaRocks list invalid tree", function()
38 local output = run.luarocks("--tree=/some/invalid/tree list")
39 assert.are.same(output, "Installed rocks:----------------")
40 end)
41end)