From 35d139407db87349e8ccc11e0e1696b610d9582e Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 5 Jun 2018 01:58:48 -0300 Subject: General refactor introducing Rockspec and Build.Opts objects Adds a Rockspec object responsible for constructing all Rockspec tables in the manner of the Queries and Results objects, and a type-checked Build.Opts tables for build options, since the number of attributes passed around was getting out of hand. This allowed a major cleanup in the luarocks.build, luarocks.fetch and luarocks.cmd.write_rockspec modules. --- spec/dir_spec.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'spec/dir_spec.lua') diff --git a/spec/dir_spec.lua b/spec/dir_spec.lua index 04e26b57..27966777 100644 --- a/spec/dir_spec.lua +++ b/spec/dir_spec.lua @@ -12,8 +12,19 @@ describe("Luarocks dir test #unit", function() assert.truthy(dir.is_basic_protocol("https")) assert.truthy(dir.is_basic_protocol("ftp")) assert.truthy(dir.is_basic_protocol("file")) - assert.falsy(dir.is_basic_protocol("file", true)) + assert.falsy(dir.is_basic_protocol("git")) + assert.falsy(dir.is_basic_protocol("git+https")) assert.falsy(dir.is_basic_protocol("invalid")) end) end) + + describe("dir.deduce_base_dir", function() + assert.are.same("v0.3", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2/archive/v0.3.zip")) + assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.zip")) + assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.tar.gz")) + assert.are.same("lua-compat-5.2", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2.tar.bz2")) + assert.are.same("parser.moon", dir.deduce_base_dir("git://example.com/Cirru/parser.moon")) + assert.are.same("v0.3", dir.deduce_base_dir("https://example.com/hishamhm/lua-compat-5.2/archive/v0.3")) + end) + end) -- cgit v1.2.3-55-g6feb