diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-09-25 18:32:54 -0400 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-09-25 23:32:31 -0400 |
commit | fa465f2bfd3641bbffccc70b2ded331ee6ab1766 (patch) | |
tree | d37f83844a484908ebd4fbb59fece2aac74b68f1 /spec | |
parent | d221d4df39bd614924515901f56ab2c7aa59dc2b (diff) | |
download | luarocks-fa465f2bfd3641bbffccc70b2ded331ee6ab1766.tar.gz luarocks-fa465f2bfd3641bbffccc70b2ded331ee6ab1766.tar.bz2 luarocks-fa465f2bfd3641bbffccc70b2ded331ee6ab1766.zip |
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.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/init_spec.lua | 21 |
1 files changed, 21 insertions, 0 deletions
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") | |||
9 | test_env.unload_luarocks() | 9 | test_env.unload_luarocks() |
10 | 10 | ||
11 | describe("Luarocks init test #integration", function() | 11 | describe("Luarocks init test #integration", function() |
12 | |||
13 | setup(function() | ||
14 | test_env.setup_specs() | ||
15 | end) | ||
16 | |||
12 | it("LuaRocks init with no arguments", function() | 17 | it("LuaRocks init with no arguments", function() |
13 | test_env.run_in_tmp(function(tmpdir) | 18 | test_env.run_in_tmp(function(tmpdir) |
14 | local myproject = tmpdir .. "/myproject" | 19 | local myproject = tmpdir .. "/myproject" |
@@ -42,6 +47,22 @@ describe("Luarocks init test #integration", function() | |||
42 | end, finally) | 47 | end, finally) |
43 | end) | 48 | end) |
44 | 49 | ||
50 | it("LuaRocks init with --lua-versions", function() | ||
51 | test_env.run_in_tmp(function(tmpdir) | ||
52 | local myproject = tmpdir .. "/myproject" | ||
53 | lfs.mkdir(myproject) | ||
54 | lfs.chdir(myproject) | ||
55 | |||
56 | assert(run.luarocks("init --lua-versions=5.1,5.2,5.3")) | ||
57 | local rockspec_name = myproject .. "/myproject-dev-1.rockspec" | ||
58 | assert.truthy(lfs.attributes(rockspec_name)) | ||
59 | local fd = assert(io.open(rockspec_name, "rb")) | ||
60 | local data = fd:read("*a") | ||
61 | fd:close() | ||
62 | assert.truthy(data:find("lua >= 5.1, < 5.4", 1, true)) | ||
63 | end, finally) | ||
64 | end) | ||
65 | |||
45 | it("LuaRocks init in a git repo", function() | 66 | it("LuaRocks init in a git repo", function() |
46 | test_env.run_in_tmp(function(tmpdir) | 67 | test_env.run_in_tmp(function(tmpdir) |
47 | local myproject = tmpdir .. "/myproject" | 68 | local myproject = tmpdir .. "/myproject" |