From 0cf93c431c5ff251324c7f6b875d9d56feeb3cad Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 23 Sep 2020 12:14:58 -0300 Subject: Support --pin and --only-deps together (#1222) --- spec/build_spec.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 4843ed73..7d18ae4c 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -237,6 +237,42 @@ describe("LuaRocks build #integration", function() end) end) + it("supports --pin --only-deps #pinning", function() + test_env.run_in_tmp(function(tmpdir) + write_file("test-1.0-1.rockspec", [[ + package = "test" + version = "1.0-1" + source = { + url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/test.lua" + } + dependencies = { + "a_rock >= 0.8" + } + build = { + type = "builtin", + modules = { + test = "test.lua" + } + } + ]], finally) + write_file("test.lua", "return {}", finally) + + 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")) + assert.is.falsy(lfs.attributes("./lua_modules/lib/luarocks/rocks-" .. test_env.lua_version .. "/test/1.0-1/test-1.0-1.rockspec")) + 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")) + assert.is.truthy(lfs.attributes("./luarocks.lock")) + local lockfilename = "./luarocks.lock" + assert.is.truthy(lfs.attributes(lockfilename)) + local lockdata = loadfile(lockfilename)() + assert.same({ + dependencies = { + ["a_rock"] = "2.0-1", + ["lua"] = test_env.lua_version .. "-1", + } + }, lockdata) + end) + end) + it("lmathx deps partial match", function() assert.is_true(run.luarocks_bool("build lmathx")) -- cgit v1.2.3-55-g6feb