diff options
Diffstat (limited to 'spec/pack_spec.lua')
| -rw-r--r-- | spec/pack_spec.lua | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua new file mode 100644 index 00000000..0e5b31c6 --- /dev/null +++ b/spec/pack_spec.lua | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | local test_env = require("test/test_environment") | ||
| 2 | local lfs = require("lfs") | ||
| 3 | local run = test_env.run | ||
| 4 | local testing_paths = test_env.testing_paths | ||
| 5 | |||
| 6 | test_env.unload_luarocks() | ||
| 7 | |||
| 8 | local extra_rocks = { | ||
| 9 | "/luasec-0.6-1.rockspec", | ||
| 10 | "/luasocket-3.0rc1-1.src.rock", | ||
| 11 | "/luasocket-3.0rc1-1.rockspec", | ||
| 12 | "/say-1.2-1.src.rock", | ||
| 13 | "/say-1.0-1.src.rock" | ||
| 14 | } | ||
| 15 | |||
| 16 | describe("LuaRocks pack tests #blackbox #b_pack", function() | ||
| 17 | |||
| 18 | before_each(function() | ||
| 19 | test_env.setup_specs(extra_rocks) | ||
| 20 | end) | ||
| 21 | |||
| 22 | it("LuaRocks pack with no flags/arguments", function() | ||
| 23 | assert.is_false(run.luarocks_bool("pack")) | ||
| 24 | end) | ||
| 25 | |||
| 26 | it("LuaRocks pack basic", function() | ||
| 27 | assert.is_true(run.luarocks_bool(test_env.quiet("pack luacov"))) | ||
| 28 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luacov-")) | ||
| 29 | end) | ||
| 30 | |||
| 31 | it("LuaRocks pack invalid rockspec", function() | ||
| 32 | assert.is_false(run.luarocks_bool("pack " .. testing_paths.testing_dir .. "/testfiles/invaild_validate-args-1.5.4-1.rockspec")) | ||
| 33 | end) | ||
| 34 | |||
| 35 | it("LuaRocks pack not installed rock", function() | ||
| 36 | assert.is_false(run.luarocks_bool("pack cjson")) | ||
| 37 | end) | ||
| 38 | |||
| 39 | it("LuaRocks pack not installed rock from non existing manifest", function() | ||
| 40 | assert.is_false(run.luarocks_bool("pack /non/exist/temp.manif")) | ||
| 41 | end) | ||
| 42 | |||
| 43 | it("LuaRocks pack specify which version of rock", function() | ||
| 44 | assert.is_true(run.luarocks_bool("install say 1.2")) | ||
| 45 | assert.is_true(run.luarocks_bool("install luassert")) | ||
| 46 | assert.is_true(run.luarocks_bool("install say 1.0")) | ||
| 47 | |||
| 48 | assert.is_false(run.luarocks_bool("pack say")) | ||
| 49 | end) | ||
| 50 | |||
| 51 | it("LuaRocks pack src", function() | ||
| 52 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) | ||
| 53 | assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-1")) | ||
| 54 | assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-1.rockspec")) | ||
| 55 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) | ||
| 56 | end) | ||
| 57 | end) | ||
| 58 | |||
| 59 | |||
