diff options
Diffstat (limited to 'spec/make_spec.lua')
-rw-r--r-- | spec/make_spec.lua | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/spec/make_spec.lua b/spec/make_spec.lua index e684033a..ae79a29c 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua | |||
@@ -6,9 +6,9 @@ local testing_paths = test_env.testing_paths | |||
6 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
7 | 7 | ||
8 | local extra_rocks = { | 8 | local extra_rocks = { |
9 | "/lpeg-0.12-1.src.rock", | 9 | "lpeg-1.0.0-1.rockspec", |
10 | "/luasocket-3.0rc1-1.src.rock", | 10 | "/luasocket-3.0rc1-2.src.rock", |
11 | "/luasocket-3.0rc1-1.rockspec", | 11 | "/luasocket-3.0rc1-2.rockspec", |
12 | "/lxsh-0.8.6-2.src.rock", | 12 | "/lxsh-0.8.6-2.src.rock", |
13 | "/lxsh-0.8.6-2.rockspec" | 13 | "/lxsh-0.8.6-2.rockspec" |
14 | } | 14 | } |
@@ -27,19 +27,19 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
27 | 27 | ||
28 | it("LuaRocks make with rockspec", function() | 28 | it("LuaRocks make with rockspec", function() |
29 | -- make luasocket | 29 | -- make luasocket |
30 | assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-1")) | 30 | assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-2")) |
31 | assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-1.src.rock")) | 31 | assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-2.src.rock")) |
32 | lfs.chdir("luasocket-3.0rc1-1/luasocket-3.0-rc1/") | 32 | lfs.chdir("luasocket-3.0rc1-2/luasocket-3.0-rc1/") |
33 | assert.is_true(run.luarocks_bool(test_env.quiet("make luasocket-3.0rc1-1.rockspec"))) | 33 | assert.is_true(run.luarocks_bool("make luasocket-3.0rc1-2.rockspec")) |
34 | 34 | ||
35 | -- test it | 35 | -- test it |
36 | assert.is_true(run.luarocks_bool(test_env.quiet("show luasocket"))) | 36 | assert.is_true(run.luarocks_bool("show luasocket")) |
37 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 37 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) |
38 | 38 | ||
39 | -- delete downloaded and unpacked files | 39 | -- delete downloaded and unpacked files |
40 | lfs.chdir(testing_paths.luarocks_dir) | 40 | lfs.chdir(testing_paths.luarocks_dir) |
41 | test_env.remove_dir("luasocket-3.0rc1-1") | 41 | test_env.remove_dir("luasocket-3.0rc1-2") |
42 | assert.is_true(os.remove("luasocket-3.0rc1-1.src.rock")) | 42 | assert.is_true(os.remove("luasocket-3.0rc1-2.src.rock")) |
43 | end) | 43 | end) |
44 | 44 | ||
45 | describe("LuaRocks making rockspecs (using lxsh)", function() | 45 | describe("LuaRocks making rockspecs (using lxsh)", function() |
@@ -61,37 +61,40 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
61 | assert.is_true(run.luarocks_bool("new_version lxsh-0.8.6-2.rockspec")) | 61 | assert.is_true(run.luarocks_bool("new_version lxsh-0.8.6-2.rockspec")) |
62 | assert.is_true(run.luarocks_bool("make")) | 62 | assert.is_true(run.luarocks_bool("make")) |
63 | 63 | ||
64 | assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) | 64 | assert.is_true(run.luarocks_bool("show lxsh")) |
65 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 65 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec")) |
66 | end) | 66 | end) |
67 | 67 | ||
68 | it("LuaRocks make unnamed rockspec", function() | 68 | it("LuaRocks make unnamed rockspec", function() |
69 | os.execute("cp lxsh-0.8.6-2.rockspec rockspec") --rewrite with lfs | 69 | test_env.copy("lxsh-0.8.6-2.rockspec", "rockspec") |
70 | assert.is_true(run.luarocks_bool("make")) | 70 | assert.is_true(run.luarocks_bool("make")) |
71 | 71 | ||
72 | assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) | 72 | assert.is_true(run.luarocks_bool("show lxsh")) |
73 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 73 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
74 | os.remove("rockspec") | ||
74 | end) | 75 | end) |
75 | 76 | ||
76 | it("LuaRocks make ambiguous rockspec", function() | 77 | it("LuaRocks make ambiguous rockspec", function() |
77 | assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "lxsh2-0.8.6-2.rockspec")) | 78 | assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "lxsh2-0.8.6-2.rockspec")) |
78 | assert.is_false(run.luarocks_bool("make")) | 79 | local output = run.luarocks("make") |
80 | assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) | ||
79 | 81 | ||
80 | assert.is_false(run.luarocks_bool("show lxsh")) | 82 | assert.is_false(run.luarocks_bool("show lxsh")) |
81 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 83 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
82 | end) | 84 | end) |
83 | 85 | ||
84 | it("LuaRocks make ambiguous unnamed rockspec", function() | 86 | it("LuaRocks make ambiguous unnamed rockspec", function() |
85 | assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "1_rockspec")) | 87 | assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "1_rockspec")) |
86 | os.execute("cp 1_rockspec 2_rockspec") --rewrite with lfs | 88 | test_env.copy("1_rockspec", "2_rockspec") |
87 | assert.is_false(run.luarocks_bool("make")) | 89 | local output = run.luarocks("make") |
90 | assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) | ||
88 | 91 | ||
89 | assert.is_false(run.luarocks_bool("show lxsh")) | 92 | assert.is_false(run.luarocks_bool("show lxsh")) |
90 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 93 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
91 | end) | 94 | end) |
92 | 95 | ||
93 | it("LuaRocks make pack binary rock", function() | 96 | it("LuaRocks make pack binary rock", function() |
94 | assert.is_true(run.luarocks_bool(test_env.quiet("make --deps-mode=none --pack-binary-rock"))) | 97 | assert.is_true(run.luarocks_bool("make --deps-mode=none --pack-binary-rock")) |
95 | assert.is.truthy(lfs.attributes("lxsh-0.8.6-2.all.rock")) | 98 | assert.is.truthy(lfs.attributes("lxsh-0.8.6-2.all.rock")) |
96 | end) | 99 | end) |
97 | end) | 100 | end) |