aboutsummaryrefslogtreecommitdiff
path: root/spec/deps_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/deps_spec.lua')
-rw-r--r--spec/deps_spec.lua114
1 files changed, 114 insertions, 0 deletions
diff --git a/spec/deps_spec.lua b/spec/deps_spec.lua
new file mode 100644
index 00000000..c1bd404d
--- /dev/null
+++ b/spec/deps_spec.lua
@@ -0,0 +1,114 @@
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 "/lxsh-0.8.6-2.src.rock",
10 "/lxsh-0.8.6-2.rockspec",
11 "/luasocket-3.0rc1-1.src.rock",
12 "/luasocket-3.0rc1-1.rockspec",
13 "/lpeg-0.12-1.src.rock"
14}
15
16describe("LuaRocks deps tests #blackbox #b_deps", function()
17
18 before_each(function()
19 test_env.setup_specs(extra_rocks)
20 end)
21
22 it("LuaRocks deps mode one", function()
23 assert.is_true(run.luarocks_bool("build --tree=system lpeg"))
24 assert.is_true(run.luarocks_bool("build --deps-mode=one --tree=" .. testing_paths.testing_tree .. " lxsh"))
25
26 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
27 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
28 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
29 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
30 end)
31
32 it("LuaRocks deps mode order", function()
33 assert.is_true(run.luarocks_bool("build --tree=system lpeg"))
34 assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_tree .. " lxsh"))
35
36 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
37 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
38 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
39 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
40 end)
41
42 it("LuaRocks deps mode order sys", function()
43 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg"))
44 assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_sys_tree .. " lxsh"))
45
46 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
47 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
48 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
49 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
50 end)
51
52 it("LuaRocks deps mode all sys", function()
53 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg"))
54 assert.is_true(run.luarocks_bool("build --deps-mode=all --tree=" .. testing_paths.testing_sys_tree .. " lxsh"))
55
56 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
57 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
58 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
59 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
60 end)
61
62 it("LuaRocks deps mode none", function()
63 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg"))
64 assert.is_true(run.luarocks_bool("build --deps-mode=none lxsh"))
65
66 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
67 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
68 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
69 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
70 end)
71
72 it("LuaRocks nodeps alias", function()
73 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " --nodeps lxsh"))
74
75 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
76 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
77 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
78 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
79 end)
80
81 it("LuaRocks deps mode make order", function()
82 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_sys_tree .. " lpeg"))
83 assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6"))
84 assert.is_true(run.luarocks_bool("unpack lxsh-0.8.6-2.src.rock"))
85 lfs.chdir("lxsh-0.8.6-2/lxsh-0.8.6-1/")
86 assert.is_true(run.luarocks_bool("make --tree=" .. testing_paths.testing_tree .. " --deps-mode=order"))
87
88 lfs.chdir(testing_paths.luarocks_dir)
89 test_env.remove_dir("lxsh-0.8.6-2")
90 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
91
92 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
93 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
94 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
95 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
96 end)
97
98 it("LuaRocks deps mode make order sys", function()
99 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg"))
100 assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6"))
101 assert.is_true(run.luarocks_bool("unpack lxsh-0.8.6-2.src.rock"))
102 lfs.chdir("lxsh-0.8.6-2/lxsh-0.8.6-1/")
103 assert.is_true(run.luarocks_bool("make --tree=" .. testing_paths.testing_sys_tree .. " --deps-mode=order"))
104
105 lfs.chdir(testing_paths.luarocks_dir)
106 test_env.remove_dir("lxsh-0.8.6-2")
107 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
108
109 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
110 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
111 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
112 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
113 end)
114end)