aboutsummaryrefslogtreecommitdiff
path: root/spec/install_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/install_spec.lua')
-rw-r--r--spec/install_spec.lua69
1 files changed, 0 insertions, 69 deletions
diff --git a/spec/install_spec.lua b/spec/install_spec.lua
index d410ca97..45979b9c 100644
--- a/spec/install_spec.lua
+++ b/spec/install_spec.lua
@@ -20,14 +20,11 @@ local extra_rocks = {
20 "/lxsh-${LXSH}.rockspec", 20 "/lxsh-${LXSH}.rockspec",
21 "/say-1.2-1.src.rock", 21 "/say-1.2-1.src.rock",
22 "/say-1.0-1.src.rock", 22 "/say-1.0-1.src.rock",
23 "/wsapi-1.6-1.src.rock",
24 "/luafilesystem-${LUAFILESYSTEM}.src.rock", 23 "/luafilesystem-${LUAFILESYSTEM}.src.rock",
25 "/luafilesystem-${LUAFILESYSTEM_OLD}.src.rock", 24 "/luafilesystem-${LUAFILESYSTEM_OLD}.src.rock",
26 "spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock", 25 "spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock",
27 "spec/fixtures/a_repo/a_build_dep-1.0-1.all.rock", 26 "spec/fixtures/a_repo/a_build_dep-1.0-1.all.rock",
28 "spec/fixtures/a_repo/a_rock-1.0-1.src.rock", 27 "spec/fixtures/a_repo/a_rock-1.0-1.src.rock",
29 "spec/fixtures/a_repo/non_lua_file-1.0-1.src.rock",
30 "spec/fixtures/a_repo/non_lua_file-1.0-2.src.rock",
31} 28}
32 29
33describe("luarocks install #integration", function() 30describe("luarocks install #integration", function()
@@ -37,22 +34,6 @@ describe("luarocks install #integration", function()
37 end) 34 end)
38 35
39 describe("basic tests", function() 36 describe("basic tests", function()
40 it("fails with no flags/arguments", function()
41 assert.is_false(run.luarocks_bool("install"))
42 end)
43
44 it("fails with invalid argument", function()
45 assert.is_false(run.luarocks_bool("install invalid"))
46 end)
47
48 it("fails invalid patch", function()
49 assert.is_false(run.luarocks_bool("install " .. testing_paths.fixtures_dir .. "/invalid_patch-0.1-1.rockspec"))
50 end)
51
52 it("fails invalid rock", function()
53 assert.is_false(run.luarocks_bool("install \"invalid.rock\" "))
54 end)
55
56 it("fails with local flag as root #unix", function() 37 it("fails with local flag as root #unix", function()
57 if test_env.TYPE_TEST_ENV ~= "full" then 38 if test_env.TYPE_TEST_ENV ~= "full" then
58 assert.is_false(run.luarocks_bool("install --local luasocket ", { USER = "root" } )) 39 assert.is_false(run.luarocks_bool("install --local luasocket ", { USER = "root" } ))
@@ -71,38 +52,15 @@ describe("luarocks install #integration", function()
71 end 52 end
72 end) 53 end)
73 54
74 it("fails not a zip file", function()
75 test_env.run_in_tmp(function(tmpdir)
76 write_file("not_a_zipfile-1.0-1.src.rock", [[
77 I am not a .zip file!
78 ]], finally)
79 assert.is_false(run.luarocks_bool("install not_a_zipfile-1.0-1.src.rock"))
80 end, finally)
81 end)
82
83 it("only-deps of lxsh show there is no lxsh", function() 55 it("only-deps of lxsh show there is no lxsh", function()
84 assert.is_true(run.luarocks_bool("install lxsh ${LXSH} --only-deps")) 56 assert.is_true(run.luarocks_bool("install lxsh ${LXSH} --only-deps"))
85 assert.is_false(run.luarocks_bool("show lxsh")) 57 assert.is_false(run.luarocks_bool("show lxsh"))
86 end) 58 end)
87 59
88 it("fails with incompatible architecture", function()
89 assert.is_false(run.luarocks_bool("install \"foo-1.0-1.impossible-x86.rock\" "))
90 end)
91
92 it("installs a package with an executable", function()
93 assert(run.luarocks_bool("install wsapi"))
94 end)
95
96 it("installs a package with a dependency", function() 60 it("installs a package with a dependency", function()
97 assert.is_true(run.luarocks_bool("install has_build_dep")) 61 assert.is_true(run.luarocks_bool("install has_build_dep"))
98 assert.is_true(run.luarocks_bool("show a_rock")) 62 assert.is_true(run.luarocks_bool("show a_rock"))
99 end) 63 end)
100
101 it("installs a package without its documentation", function()
102 assert.is_true(run.luarocks_bool("install wsapi 1.6 --no-doc"))
103 assert.is_true(run.luarocks_bool("show wsapi 1.6"))
104 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/wsapi/1.6-1/doc"))
105 end)
106 end) 64 end)
107 65
108 describe("#namespaces", function() 66 describe("#namespaces", function()
@@ -172,33 +130,6 @@ describe("luarocks install #integration", function()
172 assert.is.falsy(lfs.attributes(relative_path)) 130 assert.is.falsy(lfs.attributes(relative_path))
173 end) 131 end)
174 132
175 it('handle versioned modules when installing another version with --keep #268', function()
176 local libdir = testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION
177
178 assert.is_true(run.luarocks_bool("install luafilesystem"))
179 assert.is.truthy(lfs.attributes(libdir .."/lfs."..test_env.lib_extension))
180
181 local suffix = (V"${LUAFILESYSTEM_OLD}"):gsub("[%.%-]", "_")
182
183 assert.is_true(run.luarocks_bool("install luafilesystem ${LUAFILESYSTEM_OLD} --keep"))
184 assert.is.truthy(lfs.attributes(libdir .. "/lfs."..test_env.lib_extension))
185 assert.is.truthy(lfs.attributes(libdir .. "/luafilesystem_"..suffix.."-lfs."..test_env.lib_extension))
186
187 assert.is_true(run.luarocks_bool("install luafilesystem"))
188 assert.is.truthy(lfs.attributes(libdir .. "/lfs."..test_env.lib_extension))
189 assert.is.falsy(lfs.attributes(libdir .. "/luafilesystem_"..suffix.."-lfs."..test_env.lib_extension))
190 end)
191
192 it('handle non-Lua files in build.install.lua when upgrading sailorproject/sailor#138', function()
193 assert.is_true(run.luarocks_bool("install non_lua_file 1.0-1 --deps-mode=none"))
194 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/sailor/blank-app/.htaccess"))
195 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/sailor/blank-app/.htaccess~"))
196
197 assert.is_true(run.luarocks_bool("install non_lua_file 1.0-2 --deps-mode=none"))
198 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/sailor/blank-app/.htaccess"))
199 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION.."/sailor/blank-app/.htaccess~"))
200 end)
201
202 it("only-deps of luasocket packed rock", function() 133 it("only-deps of luasocket packed rock", function()
203 assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket ${LUASOCKET}")) 134 assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket ${LUASOCKET}"))
204 local output = run.luarocks("install --only-deps " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock") 135 local output = run.luarocks("install --only-deps " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")