diff options
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 | ||