From 6a11f673d02145ffe03aea173817ea9ab566f784 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 21 Jul 2020 11:05:11 -0300 Subject: tests: check that builtin auto-reads lua/ when modules table is empty Test case for issue reported at https://github.com/Kong/kong/issues/5017 --- spec/build_spec.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index e498509f..4843ed73 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -547,6 +547,27 @@ describe("LuaRocks build #unit", function() end) describe("build.builtin", function() + it("builtin auto installs files in lua subdir", function() + test_env.run_in_tmp(function(tmpdir) + lfs.mkdir("lua") + write_file("lua_module-1.0-1.rockspec", [[ + package = "lua_module" + version = "1.0-1" + source = { + url = "http://example.com/lua_module" + } + build = { + type = "builtin", + modules = {} + } + ]], finally) + write_file("lua/lua_module.lua", "return 123", finally) + + assert.is_true(run.luarocks_bool("build")) + assert.match("[\\/]lua_module%.lua", run.luarocks("show lua_module")) + end, finally) + end) + describe("builtin.autodetect_external_dependencies", function() it("returns false if the given build table has no external dependencies", function() local build_table = { -- cgit v1.2.3-55-g6feb