diff options
| author | Hisham <hisham@gobolinux.org> | 2016-07-28 17:24:15 -0300 |
|---|---|---|
| committer | Hisham <hisham@gobolinux.org> | 2016-07-28 17:24:15 -0300 |
| commit | accce73cf90bde70baa3d8101b76ca56b0cb0720 (patch) | |
| tree | 705bb1ba44cd07f9b701cb8d6cf969d7bb48fd72 /spec/unpack_spec.lua | |
| parent | 5f5b26206068ba597091bb6fc22d8d63c0fef408 (diff) | |
| parent | 67a737310b31eed8d1c38eb0e34ff4b6fc411731 (diff) | |
| download | luarocks-accce73cf90bde70baa3d8101b76ca56b0cb0720.tar.gz luarocks-accce73cf90bde70baa3d8101b76ca56b0cb0720.tar.bz2 luarocks-accce73cf90bde70baa3d8101b76ca56b0cb0720.zip | |
Merge branch 'master' into luarocks-3
Diffstat (limited to 'spec/unpack_spec.lua')
| -rw-r--r-- | spec/unpack_spec.lua | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua new file mode 100644 index 00000000..495c514e --- /dev/null +++ b/spec/unpack_spec.lua | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | local test_env = require("test/test_environment") | ||
| 2 | local run = test_env.run | ||
| 3 | local testing_paths = test_env.testing_paths | ||
| 4 | local lfs = require("lfs") | ||
| 5 | |||
| 6 | test_env.unload_luarocks() | ||
| 7 | |||
| 8 | local extra_rocks = { | ||
| 9 | "/cprint-0.1-2.src.rock", | ||
| 10 | "/cprint-0.1-2.rockspec", | ||
| 11 | "/luazip-1.2.4-1.rockspec" | ||
| 12 | } | ||
| 13 | |||
| 14 | describe("LuaRocks unpack tests #blackbox #b_unpack", function() | ||
| 15 | |||
| 16 | before_each(function() | ||
| 17 | test_env.setup_specs(extra_rocks) | ||
| 18 | end) | ||
| 19 | |||
| 20 | describe("LuaRocks unpack basic fail tests", function() | ||
| 21 | it("LuaRocks unpack with no flags/arguments", function() | ||
| 22 | assert.is_false(run.luarocks_bool("unpack")) | ||
| 23 | end) | ||
| 24 | it("LuaRocks unpack with invalid rockspec", function() | ||
| 25 | assert.is_false(run.luarocks_bool("unpack invalid.rockspec")) | ||
| 26 | end) | ||
| 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")) | ||
| 29 | end) | ||
| 30 | end) | ||
| 31 | |||
| 32 | describe("LuaRocks unpack more complex tests", function() | ||
| 33 | it("LuaRocks unpack download", function() | ||
| 34 | assert.is_true(run.luarocks_bool("unpack cprint")) | ||
| 35 | test_env.remove_dir("cprint-0.1-2") | ||
| 36 | end) | ||
| 37 | it("LuaRocks unpack src", function() | ||
| 38 | assert.is_true(run.luarocks_bool("download --source cprint")) | ||
| 39 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock")) | ||
| 40 | os.remove("cprint-0.1-2.src.rock") | ||
| 41 | test_env.remove_dir("cprint-0.1-2") | ||
| 42 | end) | ||
| 43 | it("LuaRocks unpack rockspec", function() | ||
| 44 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) | ||
| 45 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) | ||
| 46 | os.remove("cprint-0.1-2.rockspec") | ||
| 47 | os.remove("lua-cprint") | ||
| 48 | test_env.remove_dir("cprint-0.1-2") | ||
| 49 | end) | ||
| 50 | -- #595 luarocks unpack of a git:// rockspec fails to copy the rockspec | ||
| 51 | it("LuaRocks unpack git:// rockspec", function() | ||
| 52 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) | ||
| 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() | ||
| 58 | assert.is_true(run.luarocks_bool("build cprint")) | ||
| 59 | assert.is_true(run.luarocks_bool("pack cprint")) | ||
| 60 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2." .. test_env.platform .. ".rock")) | ||
| 61 | test_env.remove_dir("cprint-0.1-2") | ||
| 62 | os.remove("cprint-0.1-2." .. test_env.platform .. ".rock") | ||
| 63 | end) | ||
| 64 | end) | ||
| 65 | end) | ||
| 66 | |||
| 67 | |||
