diff options
Diffstat (limited to 'spec/unpack_spec.lua')
| -rw-r--r-- | spec/unpack_spec.lua | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua index 8db779c3..220ef00d 100644 --- a/spec/unpack_spec.lua +++ b/spec/unpack_spec.lua | |||
| @@ -1,14 +1,12 @@ | |||
| 1 | local test_env = require("test/test_environment") | 1 | local test_env = require("test/test_environment") |
| 2 | local run = test_env.run | 2 | local run = test_env.run |
| 3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
| 4 | local lfs = require("lfs") | ||
| 5 | 4 | ||
| 6 | test_env.unload_luarocks() | 5 | test_env.unload_luarocks() |
| 7 | 6 | ||
| 8 | local extra_rocks = { | 7 | local extra_rocks = { |
| 9 | "/cprint-0.1-2.src.rock", | 8 | "/cprint-0.1-2.src.rock", |
| 10 | "/cprint-0.1-2.rockspec", | 9 | "/cprint-0.1-2.rockspec" |
| 11 | "/luazip-1.2.4-1.rockspec" | ||
| 12 | } | 10 | } |
| 13 | 11 | ||
| 14 | describe("LuaRocks unpack tests #blackbox #b_unpack", function() | 12 | describe("LuaRocks unpack tests #blackbox #b_unpack", function() |
| @@ -21,9 +19,11 @@ describe("LuaRocks unpack tests #blackbox #b_unpack", function() | |||
| 21 | it("LuaRocks unpack with no flags/arguments", function() | 19 | it("LuaRocks unpack with no flags/arguments", function() |
| 22 | assert.is_false(run.luarocks_bool("unpack")) | 20 | assert.is_false(run.luarocks_bool("unpack")) |
| 23 | end) | 21 | end) |
| 22 | |||
| 24 | it("LuaRocks unpack with invalid rockspec", function() | 23 | it("LuaRocks unpack with invalid rockspec", function() |
| 25 | assert.is_false(run.luarocks_bool("unpack invalid.rockspec")) | 24 | assert.is_false(run.luarocks_bool("unpack invalid.rockspec")) |
| 26 | end) | 25 | end) |
| 26 | |||
| 27 | it("LuaRocks unpack with invalid patch", function() | 27 | it("LuaRocks unpack with invalid patch", function() |
| 28 | assert.is_false(run.luarocks_bool("unpack " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) | 28 | assert.is_false(run.luarocks_bool("unpack " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) |
| 29 | end) | 29 | end) |
| @@ -34,26 +34,22 @@ describe("LuaRocks unpack tests #blackbox #b_unpack", function() | |||
| 34 | assert.is_true(run.luarocks_bool("unpack cprint")) | 34 | assert.is_true(run.luarocks_bool("unpack cprint")) |
| 35 | test_env.remove_dir("cprint-0.1-2") | 35 | test_env.remove_dir("cprint-0.1-2") |
| 36 | end) | 36 | end) |
| 37 | |||
| 37 | it("LuaRocks unpack src", function() | 38 | it("LuaRocks unpack src", function() |
| 38 | assert.is_true(run.luarocks_bool("download --source cprint")) | 39 | assert.is_true(run.luarocks_bool("download --source cprint")) |
| 39 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock")) | 40 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock")) |
| 40 | os.remove("cprint-0.1-2.src.rock") | 41 | os.remove("cprint-0.1-2.src.rock") |
| 41 | test_env.remove_dir("cprint-0.1-2") | 42 | test_env.remove_dir("cprint-0.1-2") |
| 42 | end) | 43 | end) |
| 43 | it("LuaRocks unpack rockspec", function() | 44 | |
| 45 | it("LuaRocks unpack src", function() | ||
| 44 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) | 46 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) |
| 45 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) | 47 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) |
| 46 | os.remove("cprint-0.1-2.rockspec") | 48 | os.remove("cprint-0.1-2.rockspec") |
| 47 | os.remove("lua-cprint") | 49 | os.remove("lua-cprint") |
| 48 | test_env.remove_dir("cprint-0.1-2") | 50 | test_env.remove_dir("cprint-0.1-2") |
| 49 | end) | 51 | end) |
| 50 | -- #595 luarocks unpack of a git:// rockspec fails to copy the rockspec | 52 | |
| 51 | it("LuaRocks unpack git:// rockspec", function() | ||
| 52 | assert.is_true(run.luarocks_bool("download --rockspec luazip")) | ||
| 53 | assert.is_true(run.luarocks_bool("unpack luazip-1.2.4-1.rockspec")) | ||
| 54 | assert.is_truthy(lfs.attributes("luazip-1.2.4-1/luazip/luazip-1.2.4-1.rockspec")) | ||
| 55 | test_env.remove_dir("luazip-1.2.4-1") | ||
| 56 | end) | ||
| 57 | it("LuaRocks unpack binary", function() | 53 | it("LuaRocks unpack binary", function() |
| 58 | assert.is_true(run.luarocks_bool("build cprint")) | 54 | assert.is_true(run.luarocks_bool("build cprint")) |
| 59 | assert.is_true(run.luarocks_bool("pack cprint")) | 55 | assert.is_true(run.luarocks_bool("pack cprint")) |
