From 9c7e9fed578b58fff14e7a3dd95bdad62ff6ab31 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 6 Nov 2017 18:11:38 -0200 Subject: Tests: build using INCDIR for an external dependency --- spec/build_spec.lua | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index ffae144d..c6d5f717 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -189,12 +189,30 @@ describe("LuaRocks build tests #blackbox #b_build", function() assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) end) - it("LuaRocks build missing external", function() - assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\"")) - end) - it("LuaRocks build invalid patch", function() assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) end) end) + + describe("external dependencies", function() + setup(function() + test_env.mock_server_init() + end) + + teardown(function() + test_env.mock_server_done() + end) + + it("fails when missing external dependency", function() + assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\"")) + end) + + it("builds with external dependency", function() + local rockspec = testing_paths.testing_dir .. "/testfiles/with_external_dep-0.1-1.rockspec" + local foo_incdir = testing_paths.testing_dir .. "/testfiles/with_external_dep" + assert.is_truthy(run.luarocks_bool("build " .. rockspec .. " FOO_INCDIR=\"" .. foo_incdir .. "\"")) + assert.is.truthy(run.luarocks("show with_external_dep")) + end) + end) + end) -- cgit v1.2.3-55-g6feb