aboutsummaryrefslogtreecommitdiff
path: root/spec/remove_spec.lua
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-07-11 01:15:41 -0300
committerHisham <hisham@gobolinux.org>2016-07-11 01:15:41 -0300
commit994a041b4f1348564f390f3f4d8ec040c8edb4b8 (patch)
tree128d264d86576e0b62225056769b7097a745b822 /spec/remove_spec.lua
parent41eccd4ca6fe51f8174dd43744e7a4bab4daf2cb (diff)
parent77b41dd05a870feeb519e930472133f63cf94317 (diff)
downloadluarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.tar.gz
luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.tar.bz2
luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.zip
Merge branch 'master' of https://github.com/keplerproject/luarocks
Diffstat (limited to 'spec/remove_spec.lua')
-rw-r--r--spec/remove_spec.lua84
1 files changed, 84 insertions, 0 deletions
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua
new file mode 100644
index 00000000..41c6348a
--- /dev/null
+++ b/spec/remove_spec.lua
@@ -0,0 +1,84 @@
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 it("LuaRocks remove fail, break dependencies", function()
48 assert.is_true(test_env.need_luasocket())
49 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
50 assert.is_true(run.luarocks_bool("build lualogging"))
51
52 assert.is_false(run.luarocks_bool("remove luasocket"))
53 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
54 end)
55
56 it("LuaRocks remove force", function()
57 assert.is_true(test_env.need_luasocket())
58 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
59 assert.is_true(run.luarocks_bool("build lualogging"))
60
61 local output = run.luarocks("remove --force luasocket")
62 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
63 assert.is.truthy(output:find("Checking stability of dependencies"))
64 end)
65
66 it("LuaRocks remove force fast", function()
67 assert.is_true(test_env.need_luasocket())
68 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
69 assert.is_true(run.luarocks_bool("build lualogging"))
70
71 local output = run.luarocks("remove --force-fast luasocket")
72 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
73 assert.is.falsy(output:find("Checking stability of dependencies"))
74 end)
75 end)
76
77 it("LuaRocks-admin remove #ssh", function()
78 assert.is_true(run.luarocks_admin_bool("--server=testing remove luasocket-3.0rc1-1.src.rock"))
79 end)
80
81 it("LuaRocks-admin remove missing", function()
82 assert.is_false(run.luarocks_admin_bool("--server=testing remove"))
83 end)
84end)