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