aboutsummaryrefslogtreecommitdiff
path: root/spec/remove_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-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..a94673a8
--- /dev/null
+++ b/spec/remove_spec.lua
@@ -0,0 +1,85 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3
4test_env.unload_luarocks()
5local remove = require("luarocks.remove")
6
7local extra_rocks = {
8 "/abelhas-1.0-1.rockspec",
9 "/lualogging-1.3.0-1.src.rock",
10 "/luasocket-3.0rc1-1.src.rock",
11 "/luasocket-3.0rc1-1.rockspec"
12}
13
14expose("LuaRocks remove tests #blackbox #b_remove", function()
15
16 before_each(function()
17 test_env.setup_specs(extra_rocks)
18 testing_paths = test_env.testing_paths
19 run = test_env.run
20 end)
21
22 describe("LuaRocks remove basic tests", function()
23 it("LuaRocks remove with no flags/arguments", function()
24 assert.is_false(run.luarocks_bool("remove"))
25 end)
26
27 it("LuaRocks remove invalid rock", function()
28 assert.is_false(run.luarocks_bool("remove invalid.rock"))
29 end)
30
31 it("LuaRocks remove missing rock", function()
32 assert.is_false(run.luarocks_bool("remove missing_rock"))
33 end)
34
35 it("LuaRocks remove invalid argument", function()
36 assert.is_false(run.luarocks_bool("remove luacov --deps-mode"))
37 end)
38
39 it("LuaRocks remove builded abelhas", function()
40 assert.is_true(run.luarocks_bool("build abelhas 1.0"))
41 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
42 assert.is_true(run.luarocks_bool("remove abelhas 1.0"))
43 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
44 end)
45 end)
46
47 describe("LuaRocks remove more complex tests", function()
48 it("LuaRocks remove fail, break dependencies", function()
49 assert.is_true(test_env.need_luasocket())
50 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
51 assert.is_true(run.luarocks_bool("build lualogging"))
52
53 assert.is_false(run.luarocks_bool("remove luasocket"))
54 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
55 end)
56
57 it("LuaRocks remove force", function()
58 assert.is_true(test_env.need_luasocket())
59 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
60 assert.is_true(run.luarocks_bool("build lualogging"))
61
62 local output = run.luarocks("remove --force luasocket")
63 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
64 assert.is.truthy(output:find("Checking stability of dependencies"))
65 end)
66
67 it("LuaRocks remove force fast", function()
68 assert.is_true(test_env.need_luasocket())
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) \ No newline at end of file