From fbd857e1a0b2aae5beb3875427612e41bf67b35e Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 19 Mar 2021 17:13:34 -0300 Subject: pack: check that directory inside archive actually exists --- spec/fixtures/bad_pack-0.1-1.rockspec | 19 +++++++++++++++++++ spec/pack_spec.lua | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100644 spec/fixtures/bad_pack-0.1-1.rockspec (limited to 'spec') diff --git a/spec/fixtures/bad_pack-0.1-1.rockspec b/spec/fixtures/bad_pack-0.1-1.rockspec new file mode 100644 index 00000000..23934244 --- /dev/null +++ b/spec/fixtures/bad_pack-0.1-1.rockspec @@ -0,0 +1,19 @@ +rockspec_format = "3.0" +package = "bad_pack" +version = "0.1-1" +source = { + url = "http://localhost:8080/file/busted_project-0.1.tar.gz", + dir = "invalid_dir", +} +description = { + summary = "A project that uses Busted tests", +} +build = { + type = "builtin", + modules = { + sum = "sum.lua", + } +} +test = { + type = "busted", +} diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 0790c801..55071839 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua @@ -80,6 +80,12 @@ describe("luarocks pack #integration", function() assert.is_truthy(lfs.attributes("a_rock-1.0-1.src.rock")) end) + it("fails packing a rockspec into a .src.rock dir if doesn't exist", function() + local output = run.luarocks("pack " .. testing_paths.fixtures_dir .. "/bad_pack-0.1-1.rockspec") + assert.match("Directory invalid_dir not found", output) + assert.is_falsy(lfs.attributes("bad_pack-0.1-1.src.rock")) + end) + describe("namespaced dependencies", function() it("can pack rockspec with namespaced dependencies", function() finally(function() -- cgit v1.2.3-55-g6feb