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