From fa465f2bfd3641bbffccc70b2ded331ee6ab1766 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 25 Sep 2018 18:32:54 -0400 Subject: write_rockspec: fix representation of Lua version dependency The Lua version dependency specified with --lua-versions was using the internal table format. This commit ensures that it is stored in rockspecs using the string format. Includes a regression test. --- spec/init_spec.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'spec') diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 95aa8ff6..2c8dd64c 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua @@ -9,6 +9,11 @@ local lfs = require("lfs") test_env.unload_luarocks() describe("Luarocks init test #integration", function() + + setup(function() + test_env.setup_specs() + end) + it("LuaRocks init with no arguments", function() test_env.run_in_tmp(function(tmpdir) local myproject = tmpdir .. "/myproject" @@ -42,6 +47,22 @@ describe("Luarocks init test #integration", function() end, finally) end) + it("LuaRocks init with --lua-versions", function() + test_env.run_in_tmp(function(tmpdir) + local myproject = tmpdir .. "/myproject" + lfs.mkdir(myproject) + lfs.chdir(myproject) + + assert(run.luarocks("init --lua-versions=5.1,5.2,5.3")) + local rockspec_name = myproject .. "/myproject-dev-1.rockspec" + assert.truthy(lfs.attributes(rockspec_name)) + local fd = assert(io.open(rockspec_name, "rb")) + local data = fd:read("*a") + fd:close() + assert.truthy(data:find("lua >= 5.1, < 5.4", 1, true)) + end, finally) + end) + it("LuaRocks init in a git repo", function() test_env.run_in_tmp(function(tmpdir) local myproject = tmpdir .. "/myproject" -- cgit v1.2.3-55-g6feb