aboutsummaryrefslogtreecommitdiff
path: root/spec/make_spec.lua
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2024-02-26 18:30:31 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-02-27 13:28:33 -0300
commit03e401231972d7b4db0145a71ce74d5d18d1a901 (patch)
tree10e59cd4fe0065ec87db0699965bb5e2f0436d74 /spec/make_spec.lua
parent5b2e63e6b087bdf626dd7cef319d6ba29f5e197c (diff)
downloadluarocks-03e401231972d7b4db0145a71ce74d5d18d1a901.tar.gz
luarocks-03e401231972d7b4db0145a71ce74d5d18d1a901.tar.bz2
luarocks-03e401231972d7b4db0145a71ce74d5d18d1a901.zip
tests: reorganize and speed up unit tests
Diffstat (limited to 'spec/make_spec.lua')
-rw-r--r--spec/make_spec.lua24
1 files changed, 11 insertions, 13 deletions
diff --git a/spec/make_spec.lua b/spec/make_spec.lua
index 626d84df..6cce0543 100644
--- a/spec/make_spec.lua
+++ b/spec/make_spec.lua
@@ -5,8 +5,6 @@ local testing_paths = test_env.testing_paths
5local env_variables = test_env.env_variables 5local env_variables = test_env.env_variables
6local write_file = test_env.write_file 6local write_file = test_env.write_file
7 7
8test_env.unload_luarocks()
9
10local extra_rocks = { 8local extra_rocks = {
11 "/luasocket-${LUASOCKET}.src.rock", 9 "/luasocket-${LUASOCKET}.src.rock",
12 "/luasocket-${LUASOCKET}.rockspec", 10 "/luasocket-${LUASOCKET}.rockspec",
@@ -156,8 +154,8 @@ describe("luarocks make #integration", function()
156 test = "test.lua" 154 test = "test.lua"
157 } 155 }
158 } 156 }
159 ]], finally) 157 ]])
160 write_file("test.lua", "return {}", finally) 158 write_file("test.lua", "return {}")
161 159
162 assert.is_true(run.luarocks_bool("make --server=" .. testing_paths.fixtures_dir .. "/a_repo --pin --tree=lua_modules")) 160 assert.is_true(run.luarocks_bool("make --server=" .. testing_paths.fixtures_dir .. "/a_repo --pin --tree=lua_modules"))
163 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/1.0-1/test-1.0-1.rockspec")) 161 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/1.0-1/test-1.0-1.rockspec"))
@@ -171,7 +169,7 @@ describe("luarocks make #integration", function()
171 ["lua"] = test_env.lua_version .. "-1", 169 ["lua"] = test_env.lua_version .. "-1",
172 } 170 }
173 }, lockdata) 171 }, lockdata)
174 end) 172 end, finally)
175 end) 173 end)
176 174
177 it("respects luarocks.lock when present #pinning", function() 175 it("respects luarocks.lock when present #pinning", function()
@@ -191,15 +189,15 @@ describe("luarocks make #integration", function()
191 test = "test.lua" 189 test = "test.lua"
192 } 190 }
193 } 191 }
194 ]], finally) 192 ]])
195 write_file("test.lua", "return {}", finally) 193 write_file("test.lua", "return {}")
196 write_file("luarocks.lock", [[ 194 write_file("luarocks.lock", [[
197 return { 195 return {
198 dependencies = { 196 dependencies = {
199 ["a_rock"] = "1.0-1", 197 ["a_rock"] = "1.0-1",
200 } 198 }
201 } 199 }
202 ]], finally) 200 ]])
203 201
204 print(run.luarocks("make --server=" .. testing_paths.fixtures_dir .. "/a_repo --tree=lua_modules")) 202 print(run.luarocks("make --server=" .. testing_paths.fixtures_dir .. "/a_repo --tree=lua_modules"))
205 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/2.0-1/test-2.0-1.rockspec")) 203 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/2.0-1/test-2.0-1.rockspec"))
@@ -212,7 +210,7 @@ describe("luarocks make #integration", function()
212 ["a_rock"] = "1.0-1", 210 ["a_rock"] = "1.0-1",
213 } 211 }
214 }, lockdata) 212 }, lockdata)
215 end) 213 end, finally)
216 end) 214 end)
217 215
218 it("overrides luarocks.lock with --pin #pinning", function() 216 it("overrides luarocks.lock with --pin #pinning", function()
@@ -232,15 +230,15 @@ describe("luarocks make #integration", function()
232 test = "test.lua" 230 test = "test.lua"
233 } 231 }
234 } 232 }
235 ]], finally) 233 ]])
236 write_file("test.lua", "return {}", finally) 234 write_file("test.lua", "return {}")
237 write_file("luarocks.lock", [[ 235 write_file("luarocks.lock", [[
238 return { 236 return {
239 dependencies = { 237 dependencies = {
240 ["a_rock"] = "1.0-1", 238 ["a_rock"] = "1.0-1",
241 } 239 }
242 } 240 }
243 ]], finally) 241 ]])
244 242
245 print(run.luarocks("make --server=" .. testing_paths.fixtures_dir .. "/a_repo --tree=lua_modules --pin")) 243 print(run.luarocks("make --server=" .. testing_paths.fixtures_dir .. "/a_repo --tree=lua_modules --pin"))
246 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/2.0-1/test-2.0-1.rockspec")) 244 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/2.0-1/test-2.0-1.rockspec"))
@@ -254,7 +252,7 @@ describe("luarocks make #integration", function()
254 ["lua"] = test_env.lua_version .. "-1", 252 ["lua"] = test_env.lua_version .. "-1",
255 } 253 }
256 }, lockdata) 254 }, lockdata)
257 end) 255 end, finally)
258 end) 256 end)
259 257
260 describe("#ddt upgrading rockspecs with double deploy types", function() 258 describe("#ddt upgrading rockspecs with double deploy types", function()