aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2020-02-20 15:18:29 -0300
committerGitHub <noreply@github.com>2020-02-20 15:18:29 -0300
commit568624c42d3ce2e0781e644e881f4b696424829f (patch)
treed5f18e3f71adfa03829dd8eb85841580a63ddd04 /spec
parentdbd8c0dcdc50f4b79ce616221c43de03356e8264 (diff)
downloadluarocks-568624c42d3ce2e0781e644e881f4b696424829f.tar.gz
luarocks-568624c42d3ce2e0781e644e881f4b696424829f.tar.bz2
luarocks-568624c42d3ce2e0781e644e881f4b696424829f.zip
fs: always check for failure of fs.which_tool (#1157)
Diffstat (limited to 'spec')
-rw-r--r--spec/install_spec.lua12
-rw-r--r--spec/util/test_env.lua6
2 files changed, 17 insertions, 1 deletions
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()
56 assert.is_false(run.luarocks_bool("install --local luasocket ", { USER = "root" } )) 56 assert.is_false(run.luarocks_bool("install --local luasocket ", { USER = "root" } ))
57 end) 57 end)
58 58
59 it("fails with no downloader", function()
60 if test_env.TYPE_TEST_ENV ~= "full" then
61 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" } ))
62 assert.match("no downloader tool", output)
63
64 -- can do http but not https
65 assert(run.luarocks("install luasocket"))
66 output = assert(run.luarocks("install https://example.com/rock-1.0.src.rock", { LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/testing_config_no_downloader.lua" } ))
67 assert.match("no downloader tool", output)
68 end
69 end)
70
59 it("fails not a zip file", function() 71 it("fails not a zip file", function()
60 test_env.run_in_tmp(function(tmpdir) 72 test_env.run_in_tmp(function(tmpdir)
61 write_file("not_a_zipfile-1.0-1.src.rock", [[ 73 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
709--- Create configs for luacov and several versions of Luarocks 709--- Create configs for luacov and several versions of Luarocks
710-- configs needed for some tests. 710-- configs needed for some tests.
711local function create_configs() 711local function create_configs()
712 -- testing_config.lua and testing_config_show_downloads.lua 712 -- testing_config.lua
713 -- testing_config_show_downloads.lua
714 -- testing_config_no_downloader.lua
713 local config_content = substitute([[ 715 local config_content = substitute([[
714 rocks_trees = { 716 rocks_trees = {
715 "%{testing_tree}", 717 "%{testing_tree}",
@@ -737,6 +739,8 @@ local function create_configs()
737 test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config.lua", config_content .. " \nweb_browser = \"true\"") 739 test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config.lua", config_content .. " \nweb_browser = \"true\"")
738 test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config_show_downloads.lua", config_content 740 test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config_show_downloads.lua", config_content
739 .. "show_downloads = true \n rocks_servers={\"http://luarocks.org/repositories/rocks\"}") 741 .. "show_downloads = true \n rocks_servers={\"http://luarocks.org/repositories/rocks\"}")
742 test_env.write_file(test_env.testing_paths.testrun_dir .. "/testing_config_no_downloader.lua", config_content
743 .. "variables = { WGET = 'invalid', CURL = 'invalid' }")
740 744
741 -- testing_config_sftp.lua 745 -- testing_config_sftp.lua
742 config_content = substitute([[ 746 config_content = substitute([[