diff options
| author | Hisham <hisham@gobolinux.org> | 2016-07-11 01:15:41 -0300 |
|---|---|---|
| committer | Hisham <hisham@gobolinux.org> | 2016-07-11 01:15:41 -0300 |
| commit | 994a041b4f1348564f390f3f4d8ec040c8edb4b8 (patch) | |
| tree | 128d264d86576e0b62225056769b7097a745b822 /spec/unpack_spec.lua | |
| parent | 41eccd4ca6fe51f8174dd43744e7a4bab4daf2cb (diff) | |
| parent | 77b41dd05a870feeb519e930472133f63cf94317 (diff) | |
| download | luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.tar.gz luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.tar.bz2 luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.zip | |
Merge branch 'master' of https://github.com/keplerproject/luarocks
Diffstat (limited to 'spec/unpack_spec.lua')
| -rw-r--r-- | spec/unpack_spec.lua | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua new file mode 100644 index 00000000..76e9e5a8 --- /dev/null +++ b/spec/unpack_spec.lua | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | local test_env = require("test/test_environment") | ||
| 2 | local run = test_env.run | ||
| 3 | local testing_paths = test_env.testing_paths | ||
| 4 | |||
| 5 | test_env.unload_luarocks() | ||
| 6 | |||
| 7 | local extra_rocks = { | ||
| 8 | "/cprint-0.1-2.src.rock", | ||
| 9 | "/cprint-0.1-2.rockspec" | ||
| 10 | } | ||
| 11 | |||
| 12 | describe("LuaRocks unpack tests #blackbox #b_unpack", function() | ||
| 13 | |||
| 14 | before_each(function() | ||
| 15 | test_env.setup_specs(extra_rocks) | ||
| 16 | end) | ||
| 17 | |||
| 18 | describe("LuaRocks unpack basic fail tests", function() | ||
| 19 | it("LuaRocks unpack with no flags/arguments", function() | ||
| 20 | assert.is_false(run.luarocks_bool("unpack")) | ||
| 21 | end) | ||
| 22 | it("LuaRocks unpack with invalid rockspec", function() | ||
| 23 | assert.is_false(run.luarocks_bool("unpack invalid.rockspec")) | ||
| 24 | end) | ||
| 25 | it("LuaRocks unpack with invalid patch", function() | ||
| 26 | assert.is_false(run.luarocks_bool("unpack " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) | ||
| 27 | end) | ||
| 28 | end) | ||
| 29 | |||
| 30 | describe("LuaRocks unpack more complex tests", function() | ||
| 31 | it("LuaRocks unpack download", function() | ||
| 32 | assert.is_true(run.luarocks_bool("unpack cprint")) | ||
| 33 | test_env.remove_dir("cprint-0.1-2") | ||
| 34 | end) | ||
| 35 | it("LuaRocks unpack src", function() | ||
| 36 | assert.is_true(run.luarocks_bool("download --source cprint")) | ||
| 37 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock")) | ||
| 38 | os.remove("cprint-0.1-2.src.rock") | ||
| 39 | test_env.remove_dir("cprint-0.1-2") | ||
| 40 | end) | ||
| 41 | it("LuaRocks unpack src", function() | ||
| 42 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) | ||
| 43 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) | ||
| 44 | os.remove("cprint-0.1-2.rockspec") | ||
| 45 | os.remove("lua-cprint") | ||
| 46 | test_env.remove_dir("cprint-0.1-2") | ||
| 47 | end) | ||
| 48 | it("LuaRocks unpack binary", function() | ||
| 49 | assert.is_true(run.luarocks_bool("build cprint")) | ||
| 50 | assert.is_true(run.luarocks_bool("pack cprint")) | ||
| 51 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2." .. test_env.platform .. ".rock")) | ||
| 52 | test_env.remove_dir("cprint-0.1-2") | ||
| 53 | os.remove("cprint-0.1-2." .. test_env.platform .. ".rock") | ||
| 54 | end) | ||
| 55 | end) | ||
| 56 | end) | ||
| 57 | |||
| 58 | |||
