aboutsummaryrefslogtreecommitdiff
path: root/spec/remove_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/remove_spec.lua')
-rw-r--r--spec/remove_spec.lua85
1 files changed, 85 insertions, 0 deletions
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua
new file mode 100644
index 00000000..7bf1bb10
--- /dev/null
+++ b/spec/remove_spec.lua
@@ -0,0 +1,85 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4local testing_paths = test_env.testing_paths
5
6test_env.unload_luarocks()
7
8local extra_rocks = {
9 "/abelhas-1.0-1.rockspec",
10 "/lualogging-1.3.0-1.src.rock",
11 "/luasocket-3.0rc1-1.src.rock",
12 "/luasocket-3.0rc1-1.rockspec"
13}
14
15describe("LuaRocks remove tests #blackbox #b_remove", function()
16
17 before_each(function()
18 test_env.setup_specs(extra_rocks)
19 end)
20
21 describe("LuaRocks remove basic tests", function()
22 it("LuaRocks remove with no flags/arguments", function()
23 assert.is_false(run.luarocks_bool("remove"))
24 end)
25
26 it("LuaRocks remove invalid rock", function()
27 assert.is_false(run.luarocks_bool("remove invalid.rock"))
28 end)
29
30 it("LuaRocks remove missing rock", function()
31 assert.is_false(run.luarocks_bool("remove missing_rock"))
32 end)
33
34 it("LuaRocks remove invalid argument", function()
35 assert.is_false(run.luarocks_bool("remove luacov --deps-mode"))
36 end)
37
38 it("LuaRocks remove builded abelhas", function()
39 assert.is_true(run.luarocks_bool("build abelhas 1.0"))
40 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
41 assert.is_true(run.luarocks_bool("remove abelhas 1.0"))
42 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
43 end)
44 end)
45
46 describe("LuaRocks remove more complex tests", function()
47 before_each(function()
48 assert.is.truthy(test_env.need_rock("luasocket"))
49 end)
50
51 it("LuaRocks remove fail, break dependencies", function()
52 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
53 assert.is_true(run.luarocks_bool("build lualogging"))
54
55 assert.is_false(run.luarocks_bool("remove luasocket"))
56 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
57 end)
58
59 it("LuaRocks remove force", function()
60 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
61 assert.is_true(run.luarocks_bool("build lualogging"))
62
63 local output = run.luarocks("remove --force luasocket")
64 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
65 assert.is.truthy(output:find("Checking stability of dependencies"))
66 end)
67
68 it("LuaRocks remove force fast", function()
69 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
70 assert.is_true(run.luarocks_bool("build lualogging"))
71
72 local output = run.luarocks("remove --force-fast luasocket")
73 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
74 assert.is.falsy(output:find("Checking stability of dependencies"))
75 end)
76 end)
77
78 it("LuaRocks-admin remove #ssh", function()
79 assert.is_true(run.luarocks_admin_bool("--server=testing remove luasocket-3.0rc1-1.src.rock"))
80 end)
81
82 it("LuaRocks-admin remove missing", function()
83 assert.is_false(run.luarocks_admin_bool("--server=testing remove"))
84 end)
85end)