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/remove_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/remove_spec.lua')
| -rw-r--r-- | spec/remove_spec.lua | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua new file mode 100644 index 00000000..7bf1bb10 --- /dev/null +++ b/spec/remove_spec.lua | |||
| @@ -0,0 +1,85 @@ | |||
| 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 | "/abelhas-1.0-1.rockspec", | ||
| 10 | "/lualogging-1.3.0-1.src.rock", | ||
| 11 | "/luasocket-3.0rc1-1.src.rock", | ||
| 12 | "/luasocket-3.0rc1-1.rockspec" | ||
| 13 | } | ||
| 14 | |||
| 15 | describe("LuaRocks remove tests #blackbox #b_remove", function() | ||
| 16 | |||
| 17 | before_each(function() | ||
| 18 | test_env.setup_specs(extra_rocks) | ||
| 19 | end) | ||
| 20 | |||
| 21 | describe("LuaRocks remove basic tests", function() | ||
| 22 | it("LuaRocks remove with no flags/arguments", function() | ||
| 23 | assert.is_false(run.luarocks_bool("remove")) | ||
| 24 | end) | ||
| 25 | |||
| 26 | it("LuaRocks remove invalid rock", function() | ||
| 27 | assert.is_false(run.luarocks_bool("remove invalid.rock")) | ||
| 28 | end) | ||
| 29 | |||
| 30 | it("LuaRocks remove missing rock", function() | ||
| 31 | assert.is_false(run.luarocks_bool("remove missing_rock")) | ||
| 32 | end) | ||
| 33 | |||
| 34 | it("LuaRocks remove invalid argument", function() | ||
| 35 | assert.is_false(run.luarocks_bool("remove luacov --deps-mode")) | ||
| 36 | end) | ||
| 37 | |||
| 38 | it("LuaRocks remove builded abelhas", function() | ||
| 39 | assert.is_true(run.luarocks_bool("build abelhas 1.0")) | ||
| 40 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) | ||
| 41 | assert.is_true(run.luarocks_bool("remove abelhas 1.0")) | ||
| 42 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) | ||
| 43 | end) | ||
| 44 | end) | ||
| 45 | |||
| 46 | describe("LuaRocks remove more complex tests", function() | ||
| 47 | before_each(function() | ||
| 48 | assert.is.truthy(test_env.need_rock("luasocket")) | ||
| 49 | end) | ||
| 50 | |||
| 51 | it("LuaRocks remove fail, break dependencies", function() | ||
| 52 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | ||
| 53 | assert.is_true(run.luarocks_bool("build lualogging")) | ||
| 54 | |||
| 55 | assert.is_false(run.luarocks_bool("remove luasocket")) | ||
| 56 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | ||
| 57 | end) | ||
| 58 | |||
| 59 | it("LuaRocks remove force", function() | ||
| 60 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | ||
| 61 | assert.is_true(run.luarocks_bool("build lualogging")) | ||
| 62 | |||
| 63 | local output = run.luarocks("remove --force luasocket") | ||
| 64 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | ||
| 65 | assert.is.truthy(output:find("Checking stability of dependencies")) | ||
| 66 | end) | ||
| 67 | |||
| 68 | it("LuaRocks remove force fast", function() | ||
| 69 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | ||
| 70 | assert.is_true(run.luarocks_bool("build lualogging")) | ||
| 71 | |||
| 72 | local output = run.luarocks("remove --force-fast luasocket") | ||
| 73 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | ||
| 74 | assert.is.falsy(output:find("Checking stability of dependencies")) | ||
| 75 | end) | ||
| 76 | end) | ||
| 77 | |||
| 78 | it("LuaRocks-admin remove #ssh", function() | ||
| 79 | assert.is_true(run.luarocks_admin_bool("--server=testing remove luasocket-3.0rc1-1.src.rock")) | ||
| 80 | end) | ||
| 81 | |||
| 82 | it("LuaRocks-admin remove missing", function() | ||
| 83 | assert.is_false(run.luarocks_admin_bool("--server=testing remove")) | ||
| 84 | end) | ||
| 85 | end) | ||
