From c905deaa146dcd285b5b6a0edf0d569c52ea1e5a Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 6 Jun 2018 14:28:27 -0300 Subject: builtin: auto-detect modules when build.modules (or build!) is absent --- spec/build_spec.lua | 42 ++++++++++++++++++++++++++++++++++++++++ spec/fixtures/autodetect/bla.lua | 1 + 2 files changed, 43 insertions(+) create mode 100644 spec/fixtures/autodetect/bla.lua (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index b703478e..af2dfe38 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -269,6 +269,48 @@ describe("LuaRocks build tests #integration", function() assert.truthy(run.luarocks_bool("build " .. rockspec)) assert.is.truthy(run.luarocks("show a_rock")) end) + + it("'builtin' detects lua files if modules are not given", function() + local rockspec = "autodetect-1.0-1.rockspec" + test_env.write_file(rockspec, [[ + rockspec_format = "3.0" + package = "autodetect" + version = "1.0-1" + source = { + url = "file://]] .. testing_paths.fixtures_dir .. [[/autodetect/bla.lua" + } + description = { + summary = "An example rockspec", + } + dependencies = { + "lua >= 5.1" + } + build = { + } + ]], finally) + assert.truthy(run.luarocks_bool("build " .. rockspec)) + assert.match("bla.lua", run.luarocks("show autodetect")) + end) + + it("'builtin' detects lua files if build is not given", function() + local rockspec = "autodetect-1.0-1.rockspec" + test_env.write_file(rockspec, [[ + rockspec_format = "3.0" + package = "autodetect" + version = "1.0-1" + source = { + url = "file://]] .. testing_paths.fixtures_dir .. [[/autodetect/bla.lua" + } + description = { + summary = "An example rockspec", + } + dependencies = { + "lua >= 5.1" + } + ]], finally) + assert.truthy(run.luarocks_bool("build " .. rockspec)) + assert.match("bla.lua", run.luarocks("show autodetect")) + end) end) describe("#mock external dependencies", function() diff --git a/spec/fixtures/autodetect/bla.lua b/spec/fixtures/autodetect/bla.lua new file mode 100644 index 00000000..a5647075 --- /dev/null +++ b/spec/fixtures/autodetect/bla.lua @@ -0,0 +1 @@ +return {} -- cgit v1.2.3-55-g6feb