diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-01-02 15:46:46 -0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-01-02 15:46:46 -0200 |
| commit | b162729c9b6dcbb798409d1ebfa7da930c49ee04 (patch) | |
| tree | b88ca03a25402c9a3ab2cadca5e8caf1271424d1 | |
| parent | 53a54bbb10e75f9ac2e754d9292cfb080f53b69d (diff) | |
| download | luarocks-b162729c9b6dcbb798409d1ebfa7da930c49ee04.tar.gz luarocks-b162729c9b6dcbb798409d1ebfa7da930c49ee04.tar.bz2 luarocks-b162729c9b6dcbb798409d1ebfa7da930c49ee04.zip | |
Tests: fetching from git stores an identifier
| -rw-r--r-- | spec/fetch_spec.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/fetch_spec.lua b/spec/fetch_spec.lua index 05a709e4..ab2cd54e 100644 --- a/spec/fetch_spec.lua +++ b/spec/fetch_spec.lua | |||
| @@ -2,6 +2,7 @@ local test_env = require("test/test_environment") | |||
| 2 | 2 | ||
| 3 | test_env.unload_luarocks() | 3 | test_env.unload_luarocks() |
| 4 | local fetch = require("luarocks.fetch") | 4 | local fetch = require("luarocks.fetch") |
| 5 | local vers = require("luarocks.vers") | ||
| 5 | 6 | ||
| 6 | describe("Luarocks fetch test #whitebox #w_fetch", function() | 7 | describe("Luarocks fetch test #whitebox #w_fetch", function() |
| 7 | it("Fetch url to base dir", function() | 8 | it("Fetch url to base dir", function() |
| @@ -12,4 +13,26 @@ describe("Luarocks fetch test #whitebox #w_fetch", function() | |||
| 12 | assert.are.same("parser.moon", fetch.url_to_base_dir("git://github.com/Cirru/parser.moon")) | 13 | assert.are.same("parser.moon", fetch.url_to_base_dir("git://github.com/Cirru/parser.moon")) |
| 13 | assert.are.same("v0.3", fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2/archive/v0.3")) | 14 | assert.are.same("v0.3", fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2/archive/v0.3")) |
| 14 | end) | 15 | end) |
| 16 | |||
| 17 | describe("fetch_sources", function() | ||
| 18 | it("from Git", function() | ||
| 19 | local rockspec = { | ||
| 20 | format_is_at_least = vers.format_is_at_least, | ||
| 21 | name = "testrock", | ||
| 22 | version = "dev-1", | ||
| 23 | source = { | ||
| 24 | protocol = "git", | ||
| 25 | url = "git://github.com/luarocks/testrock", | ||
| 26 | }, | ||
| 27 | variables = { | ||
| 28 | GIT = "git", | ||
| 29 | }, | ||
| 30 | } | ||
| 31 | local pathname, tmpdir = fetch.fetch_sources(rockspec, false) | ||
| 32 | assert.are.same("testrock", pathname) | ||
| 33 | assert.match("luarocks_testrock%-dev%-1%-", tmpdir) | ||
| 34 | assert.match("^%d%d%d%d%d%d%d%d.%d%d%d%d%d%d.%x+$", rockspec.source.identifier) | ||
| 35 | end) | ||
| 36 | end) | ||
| 37 | |||
| 15 | end) | 38 | end) |
