aboutsummaryrefslogtreecommitdiff
path: root/spec/build_spec.lua
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2024-02-29 00:46:06 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-02-29 15:46:16 +0000
commitf76b7a2b13e411df2e696146bb0a6396781acd92 (patch)
tree38ed32f81f05f6eacd03f36eacd5341e7b1d17dd /spec/build_spec.lua
parent0ca8c460e867356342180bb625760ed9201a5503 (diff)
downloadluarocks-f76b7a2b13e411df2e696146bb0a6396781acd92.tar.gz
luarocks-f76b7a2b13e411df2e696146bb0a6396781acd92.tar.bz2
luarocks-f76b7a2b13e411df2e696146bb0a6396781acd92.zip
tests: speed up and simplify
Diffstat (limited to 'spec/build_spec.lua')
-rw-r--r--spec/build_spec.lua71
1 files changed, 0 insertions, 71 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua
index d07447c1..00eac2e1 100644
--- a/spec/build_spec.lua
+++ b/spec/build_spec.lua
@@ -154,77 +154,6 @@ describe("LuaRocks build #integration", function()
154 end, finally) 154 end, finally)
155 end) 155 end)
156 156
157 it("supports --pin #pinning", function()
158 test_env.run_in_tmp(function(tmpdir)
159 write_file("test-1.0-1.rockspec", [[
160 package = "test"
161 version = "1.0-1"
162 source = {
163 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
164 }
165 dependencies = {
166 "a_rock >= 0.8"
167 }
168 build = {
169 type = "builtin",
170 modules = {
171 test = "test.lua"
172 }
173 }
174 ]])
175 write_file("test.lua", "return {}")
176
177 assert.is_true(run.luarocks_bool("build --server=" .. testing_paths.fixtures_dir .. "/a_repo test-1.0-1.rockspec --pin --tree=lua_modules"))
178 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/1.0-1/test-1.0-1.rockspec"))
179 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/a_rock/2.0-1/a_rock-2.0-1.rockspec"))
180 local lockfilename = "./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/1.0-1/luarocks.lock"
181 assert.is.truthy(lfs.attributes(lockfilename))
182 local lockdata = loadfile(lockfilename)()
183 assert.same({
184 dependencies = {
185 ["a_rock"] = "2.0-1",
186 ["lua"] = test_env.lua_version .. "-1",
187 }
188 }, lockdata)
189 end, finally)
190 end)
191
192 it("supports --pin --only-deps #pinning", function()
193 test_env.run_in_tmp(function(tmpdir)
194 write_file("test-1.0-1.rockspec", [[
195 package = "test"
196 version = "1.0-1"
197 source = {
198 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
199 }
200 dependencies = {
201 "a_rock >= 0.8"
202 }
203 build = {
204 type = "builtin",
205 modules = {
206 test = "test.lua"
207 }
208 }
209 ]])
210 write_file("test.lua", "return {}")
211
212 assert.is_true(run.luarocks_bool("build --server=" .. testing_paths.fixtures_dir .. "/a_repo test-1.0-1.rockspec --pin --only-deps --tree=lua_modules"))
213 assert.is.falsy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/1.0-1/test-1.0-1.rockspec"))
214 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/a_rock/2.0-1/a_rock-2.0-1.rockspec"))
215 assert.is.truthy(lfs.attributes("./luarocks.lock"))
216 local lockfilename = "./luarocks.lock"
217 assert.is.truthy(lfs.attributes(lockfilename))
218 local lockdata = loadfile(lockfilename)()
219 assert.same({
220 dependencies = {
221 ["a_rock"] = "2.0-1",
222 ["lua"] = test_env.lua_version .. "-1",
223 }
224 }, lockdata)
225 end, finally)
226 end)
227
228 it("lmathx deps partial match", function() 157 it("lmathx deps partial match", function()
229 if test_env.LUA_V == "5.1" or test_env.LUAJIT_V then 158 if test_env.LUA_V == "5.1" or test_env.LUAJIT_V then
230 assert.is_true(run.luarocks_bool("build lmathx")) 159 assert.is_true(run.luarocks_bool("build lmathx"))