From 5620d3b00c7defcbcbcfcb2a42401a0f567ad30a Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 13 Feb 2020 12:41:57 -0300 Subject: show: accept a substring when unambiguous and matches a single entry --- spec/show_spec.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec') diff --git a/spec/show_spec.lua b/spec/show_spec.lua index a0987de0..c2840d29 100644 --- a/spec/show_spec.lua +++ b/spec/show_spec.lua @@ -78,6 +78,17 @@ describe("LuaRocks show #integration", function() run.luarocks_bool("show luacov 0.13.0") end) + it("can find by substring", function() + assert(run.luarocks_bool("install has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) + assert.match("a_build_dep", run.luarocks("show has_")) + end) + + it("fails when substring matches multiple", function() + assert(run.luarocks_bool("install has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) + assert(run.luarocks_bool("install a_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) + assert.match("multiple installed packages match the name 'dep'", run.luarocks("show dep")) + end) + it("shows #build_dependencies", function() assert(run.luarocks_bool("install has_build_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) assert.match("a_build_dep", run.luarocks("show has_build_dep")) -- cgit v1.2.3-55-g6feb