From 8d95d5607fdd829d4b77c5225fd6b9015b1df034 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 11 Sep 2018 16:06:15 -0400 Subject: Tests: add regression test for luarocks.loader startup --- spec/loader_spec.lua | 10 ++++++++++ spec/util/test_env.lua | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 spec/loader_spec.lua diff --git a/spec/loader_spec.lua b/spec/loader_spec.lua new file mode 100644 index 00000000..0f946b72 --- /dev/null +++ b/spec/loader_spec.lua @@ -0,0 +1,10 @@ +local test_env = require("spec.util.test_env") +local run = test_env.run + +describe("luarocks.loader", function() + describe("#unit", function() + it("starts", function() + assert(run.lua_bool([[-e "require 'luarocks.loader'; print(package.loaded['luarocks.loaded'])"]])) + end) + end) +end) diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 181f4693..f4cd3f60 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -473,7 +473,9 @@ local function make_run_function(cmd_name, exec_function, with_coverage, do_prin cmd_prefix = cmd_prefix .. "-e \"require('luacov.runner')('" .. test_env.testing_paths.testrun_dir .. "/luacov.config')\" " end - cmd_prefix = cmd_prefix .. test_env.testing_paths.src_dir .. "/bin/" .. cmd_name .. " " + if cmd_name then + cmd_prefix = cmd_prefix .. test_env.testing_paths.src_dir .. "/bin/" .. cmd_name .. " " + end return function(cmd, new_vars) local temp_vars = {} @@ -491,6 +493,8 @@ end local function make_run_functions() return { + lua = make_run_function(nil, execute_output, true, true), + lua_bool = make_run_function(nil, execute_bool, true, true), luarocks = make_run_function("luarocks", execute_output, true, true), luarocks_bool = make_run_function("luarocks", execute_bool, true, true), luarocks_noprint = make_run_function("luarocks", execute_bool, true, false), -- cgit v1.2.3-55-g6feb