diff options
| author | robooo <robo.karasek@gmail.com> | 2016-07-07 21:58:19 +0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2016-07-07 16:58:19 -0300 |
| commit | 5af7e0d7c2dcf65e41ae8523f3771e9528be32a7 (patch) | |
| tree | bcd14624e0566a23da2e708675197d212cecf35d /spec/add_spec.lua | |
| parent | b5b285a678fe78b80d452cc9eb7565b8bf087b81 (diff) | |
| download | luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.gz luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.bz2 luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.zip | |
New test-suite for LuaRocks (#581)
First version of new test-suite, using Busted framework based on Google Summer of Code project:
https://summerofcode.withgoogle.com/projects/#5695811874717696
* Rewritten from Bash to Lua
* Tests now check if they did what they were supposed to, beyond only checking success or failure of the `luarocks` command
* Support for black-box (launching `luarocks` as an external command) and white-box (testing functions in modules directly) testing
Diffstat (limited to 'spec/add_spec.lua')
| -rw-r--r-- | spec/add_spec.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/add_spec.lua b/spec/add_spec.lua new file mode 100644 index 00000000..e417f974 --- /dev/null +++ b/spec/add_spec.lua | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | local test_env = require("test/test_environment") | ||
| 2 | local lfs = require("lfs") | ||
| 3 | |||
| 4 | test_env.unload_luarocks() | ||
| 5 | local add = require("luarocks.add") | ||
| 6 | |||
| 7 | local extra_rocks = { | ||
| 8 | "/luasocket-3.0rc1-1.src.rock", | ||
| 9 | "/luasocket-3.0rc1-1.rockspec" | ||
| 10 | } | ||
| 11 | |||
| 12 | expose("LuaRocks add tests #blackbox #b_add", function() | ||
| 13 | |||
| 14 | before_each(function() | ||
| 15 | test_env.setup_specs(extra_rocks) | ||
| 16 | testing_paths = test_env.testing_paths | ||
| 17 | run = test_env.run | ||
| 18 | end) | ||
| 19 | |||
| 20 | describe("LuaRocks-admin add tests", function() | ||
| 21 | it("LuaRocks-admin add invalid rock #ssh", function() | ||
| 22 | assert.is_false(run.luarocks_admin_bool("--server=testing add invalid")) | ||
| 23 | end) | ||
| 24 | |||
| 25 | it("LuaRocks-admin add missing argument", function() | ||
| 26 | assert.is_false(run.luarocks_admin_bool("--server=testing add")) | ||
| 27 | end) | ||
| 28 | |||
| 29 | it("LuaRocks-admin add invalid server", function() | ||
| 30 | assert.is_false(run.luarocks_admin_bool("--server=invalid add " .. testing_paths.testing_server .. "/luasocket-3.0rc1-1.src.rock")) | ||
| 31 | end) | ||
| 32 | |||
| 33 | it("LuaRocks-admin add invalid server #ssh", function() | ||
| 34 | assert.is_true(run.luarocks_admin_bool("--server=testing add " .. testing_paths.testing_server .. "/luasocket-3.0rc1-1.src.rock")) | ||
| 35 | end) | ||
| 36 | |||
| 37 | --TODO This test fails, sftp not implemented | ||
| 38 | it("LuaRocks-admin add invalid server", function() --? | ||
| 39 | assert.is_false(run.luarocks_admin_bool("--server=testing add luasocket-3.0rc1-1.src.rock", { LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config_sftp.lua" } )) | ||
| 40 | end) | ||
| 41 | |||
| 42 | it("LuaRocks-admin add, split server url", function() | ||
| 43 | assert.is_false(run.luarocks_admin_bool("--server=\"localhost@/tmp/luarocks_testing\" add " .. testing_paths.testing_server .. "luasocket-3.0rc1-1.src.rock")) | ||
| 44 | end) | ||
| 45 | end) | ||
| 46 | end) \ No newline at end of file | ||
