From 568624c42d3ce2e0781e644e881f4b696424829f Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 20 Feb 2020 15:18:29 -0300 Subject: fs: always check for failure of fs.which_tool (#1157) --- spec/install_spec.lua | 12 ++++++++++++ spec/util/test_env.lua | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 5ee913f0..78b4b28d 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -56,6 +56,18 @@ describe("luarocks install #integration", function() assert.is_false(run.luarocks_bool("install --local luasocket ", { USER = "root" } )) end) + it("fails with no downloader", function() + if test_env.TYPE_TEST_ENV ~= "full" then + local output = assert(run.luarocks("install https://example.com/rock-1.0.src.rock", { LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/testing_config_no_downloader.lua" } )) + assert.match("no downloader tool", output) + + -- can do http but not https + assert(run.luarocks("install luasocket")) + output = assert(run.luarocks("install https://example.com/rock-1.0.src.rock", { LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/testing_config_no_downloader.lua" } )) + assert.match("no downloader tool", output) + end + end) + it("fails not a zip file", function() test_env.run_in_tmp(function(tmpdir) write_file("not_a_zipfile-1.0-1.src.rock", [[ diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index d4591c91..8aebd74e 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -709,7 +709,9 @@ end --- Create configs for luacov and several versions of Luarocks -- configs needed for some tests. local function create_configs() - -- testing_config.lua and testing_config_show_downloads.lua + -- testing_config.lua + -- testing_config_show_downloads.lua + -- testing_config_no_downloader.lua local config_content = substitute([[ rocks_trees = { "%{testing_tree}", @@ -737,6 +739,8 @@ local function create_configs() test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config.lua", config_content .. " \nweb_browser = \"true\"") test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config_show_downloads.lua", config_content .. "show_downloads = true \n rocks_servers={\"http://luarocks.org/repositories/rocks\"}") + test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config_no_downloader.lua", config_content + .. "variables = { WGET = 'invalid', CURL = 'invalid' }") -- testing_config_sftp.lua config_content = substitute([[ -- cgit v1.2.3-55-g6feb