diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-28 19:12:08 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-28 20:15:26 -0300 |
| commit | 27ae57f6140cb8c136c74c38d415afdcadb58ddd (patch) | |
| tree | 6047ddc183a9c40960b1bd650c58409662680d8b /spec/pack_spec.lua | |
| parent | 5b496c39e051f0ed77c1969580a91e733ec3f6a8 (diff) | |
| download | luarocks-27ae57f6140cb8c136c74c38d415afdcadb58ddd.tar.gz luarocks-27ae57f6140cb8c136c74c38d415afdcadb58ddd.tar.bz2 luarocks-27ae57f6140cb8c136c74c38d415afdcadb58ddd.zip | |
Tests: cache build of mock server dependencies to speed up tests
Diffstat (limited to 'spec/pack_spec.lua')
| -rw-r--r-- | spec/pack_spec.lua | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 54d139e0..8fbade44 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua | |||
| @@ -5,14 +5,14 @@ local testing_paths = test_env.testing_paths | |||
| 5 | 5 | ||
| 6 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
| 7 | 7 | ||
| 8 | local extra_rocks = test_env.mock_server_extra_rocks({ | 8 | local extra_rocks = { |
| 9 | "/luasec-0.6-1.rockspec", | 9 | "/luasec-0.6-1.rockspec", |
| 10 | "/luassert-1.7.0-1.src.rock", | 10 | "/luassert-1.7.0-1.src.rock", |
| 11 | "/luasocket-3.0rc1-2.src.rock", | 11 | "/luasocket-3.0rc1-2.src.rock", |
| 12 | "/luasocket-3.0rc1-2.rockspec", | 12 | "/luasocket-3.0rc1-2.rockspec", |
| 13 | "/say-1.2-1.src.rock", | 13 | "/say-1.2-1.src.rock", |
| 14 | "/say-1.0-1.src.rock" | 14 | "/say-1.0-1.src.rock" |
| 15 | }) | 15 | } |
| 16 | 16 | ||
| 17 | describe("LuaRocks pack #blackbox #b_pack", function() | 17 | describe("LuaRocks pack #blackbox #b_pack", function() |
| 18 | 18 | ||
| @@ -50,14 +50,7 @@ describe("LuaRocks pack #blackbox #b_pack", function() | |||
| 50 | assert(test_env.remove_files(lfs.currentdir(), "say%-")) | 50 | assert(test_env.remove_files(lfs.currentdir(), "say%-")) |
| 51 | end) | 51 | end) |
| 52 | 52 | ||
| 53 | it("src", function() | 53 | describe("#mock", function() |
| 54 | assert(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) | ||
| 55 | assert(run.luarocks_bool("download --rockspec luasocket 3.0rc1-2")) | ||
| 56 | assert(run.luarocks_bool("pack luasocket-3.0rc1-2.rockspec")) | ||
| 57 | assert(test_env.remove_files(lfs.currentdir(), "luasocket%-")) | ||
| 58 | end) | ||
| 59 | |||
| 60 | describe("#mock namespaced dependencies", function() | ||
| 61 | 54 | ||
| 62 | setup(function() | 55 | setup(function() |
| 63 | test_env.mock_server_init() | 56 | test_env.mock_server_init() |
| @@ -67,12 +60,23 @@ describe("LuaRocks pack #blackbox #b_pack", function() | |||
| 67 | test_env.mock_server_done() | 60 | test_env.mock_server_done() |
| 68 | end) | 61 | end) |
| 69 | 62 | ||
| 70 | it("can pack rockspec with namespaced dependencies", function() | 63 | it("can pack a rockspec into a .src.rock", function() |
| 71 | finally(function() | 64 | finally(function() |
| 72 | os.remove("has_namespaced_dep-1.0-1.src.rock") | 65 | os.remove("a_rock-1.0-1.src.rock") |
| 66 | end) | ||
| 67 | assert(run.luarocks_bool("download --rockspec --server=" .. testing_paths.fixtures_dir .. "/a_repo a_rock 1.0-1")) | ||
| 68 | assert(run.luarocks_bool("pack a_rock-1.0-1.rockspec")) | ||
| 69 | assert.is_truthy(lfs.attributes("a_rock-1.0-1.src.rock")) | ||
| 70 | end) | ||
| 71 | |||
| 72 | describe("namespaced dependencies", function() | ||
| 73 | it("can pack rockspec with namespaced dependencies", function() | ||
| 74 | finally(function() | ||
| 75 | os.remove("has_namespaced_dep-1.0-1.src.rock") | ||
| 76 | end) | ||
| 77 | assert(run.luarocks_bool("pack " .. testing_paths.fixtures_dir .. "/a_repo/has_namespaced_dep-1.0-1.rockspec")) | ||
| 78 | assert.is_truthy(lfs.attributes("has_namespaced_dep-1.0-1.src.rock")) | ||
| 73 | end) | 79 | end) |
| 74 | assert(run.luarocks_bool("pack " .. testing_paths.fixtures_dir .. "/a_repo/has_namespaced_dep-1.0-1.rockspec")) | ||
| 75 | assert.is_truthy(lfs.attributes("has_namespaced_dep-1.0-1.src.rock")) | ||
| 76 | end) | 80 | end) |
| 77 | end) | 81 | end) |
| 78 | 82 | ||
