aboutsummaryrefslogtreecommitdiff
path: root/spec/build_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/build_spec.lua')
-rw-r--r--spec/build_spec.lua41
1 files changed, 38 insertions, 3 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua
index eeca75cf..d64ace4d 100644
--- a/spec/build_spec.lua
+++ b/spec/build_spec.lua
@@ -116,11 +116,11 @@ describe("LuaRocks build #integration", function()
116 end) 116 end)
117 117
118 it("with --only-sources", function() 118 it("with --only-sources", function()
119 assert.is_true(run.luarocks_bool("download --server=" .. testing_paths.fixtures_dir .. "/a_repo --rockspec a_rock")) 119 assert.is_true(run.luarocks_bool("download --server=" .. testing_paths.fixtures_dir .. "/a_repo --rockspec a_rock 1.0"))
120 assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" a_rock-1.0-1.rockspec")) 120 assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" a_rock-1.0-1.rockspec"))
121 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) 121 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec"))
122 122
123 assert.is_true(run.luarocks_bool("download --server=" .. testing_paths.fixtures_dir .. "/a_repo --source a_rock")) 123 assert.is_true(run.luarocks_bool("download --server=" .. testing_paths.fixtures_dir .. "/a_repo --source a_rock 1.0"))
124 assert.is_true(run.luarocks_bool("build --only-sources=\"http://example.com\" a_rock-1.0-1.src.rock")) 124 assert.is_true(run.luarocks_bool("build --only-sources=\"http://example.com\" a_rock-1.0-1.src.rock"))
125 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec")) 125 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/a_rock/1.0-1/a_rock-1.0-1.rockspec"))
126 126
@@ -199,7 +199,42 @@ describe("LuaRocks build #integration", function()
199 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec")) 199 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/test/1.0-1/test-1.0-1.rockspec"))
200 end) 200 end)
201 end) 201 end)
202 202
203 it("supports --pin #pinning", function()
204 test_env.run_in_tmp(function(tmpdir)
205 write_file("test-1.0-1.rockspec", [[
206 package = "test"
207 version = "1.0-1"
208 source = {
209 url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua"
210 }
211 dependencies = {
212 "a_rock >= 0.8"
213 }
214 build = {
215 type = "builtin",
216 modules = {
217 test = "test.lua"
218 }
219 }
220 ]], finally)
221 write_file("test.lua", "return {}", finally)
222
223 assert.is_true(run.luarocks_bool("build --server=" .. testing_paths.fixtures_dir .. "/a_repo test-1.0-1.rockspec --pin --tree=lua_modules"))
224 assert.is.truthy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/1.0-1/test-1.0-1.rockspec"))
225 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"))
226 local lockfilename = "./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/1.0-1/luarocks.lock"
227 assert.is.truthy(lfs.attributes(lockfilename))
228 local lockdata = loadfile(lockfilename)()
229 assert.same({
230 dependencies = {
231 ["a_rock"] = "2.0-1",
232 ["lua"] = test_env.lua_version .. "-1",
233 }
234 }, lockdata)
235 end)
236 end)
237
203 it("lmathx deps partial match", function() 238 it("lmathx deps partial match", function()
204 assert.is_true(run.luarocks_bool("build lmathx")) 239 assert.is_true(run.luarocks_bool("build lmathx"))
205 240