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/new_version_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/new_version_spec.lua')
| -rw-r--r-- | spec/new_version_spec.lua | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua new file mode 100644 index 00000000..c4185b1d --- /dev/null +++ b/spec/new_version_spec.lua | |||
| @@ -0,0 +1,73 @@ | |||
| 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 | "/lpeg-0.12-1.rockspec" | ||
| 11 | } | ||
| 12 | |||
| 13 | describe("LuaRocks new_version tests #blackbox #b_new_version", function() | ||
| 14 | |||
| 15 | before_each(function() | ||
| 16 | test_env.setup_specs(extra_rocks) | ||
| 17 | end) | ||
| 18 | |||
| 19 | describe("LuaRocks new_version basic tests", function() | ||
| 20 | it("LuaRocks new version with no flags/arguments", function() | ||
| 21 | lfs.chdir("test") | ||
| 22 | assert.is_false(run.luarocks_bool("new_version")) | ||
| 23 | lfs.chdir(testing_paths.luarocks_dir) | ||
| 24 | end) | ||
| 25 | |||
| 26 | it("LuaRocks new version invalid", function() | ||
| 27 | assert.is_false(run.luarocks_bool("new_version invalid")) | ||
| 28 | end) | ||
| 29 | |||
| 30 | it("LuaRocks new version invalid url", function() | ||
| 31 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) | ||
| 32 | assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luainvalid")) | ||
| 33 | assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) | ||
| 34 | test_env.remove_files(lfs.currentdir(), "abelhas--") | ||
| 35 | end) | ||
| 36 | end) | ||
| 37 | |||
| 38 | describe("LuaRocks new_version more complex tests", function() | ||
| 39 | it("LuaRocks new version with remote spec", function() | ||
| 40 | assert.is_true(run.luarocks_bool("new_version https://luarocks.org/manifests/luarocks/luasocket-2.0.2-6.rockspec")) | ||
| 41 | assert.is.truthy(lfs.attributes("luasocket-2.0.2-6.rockspec")) | ||
| 42 | assert.is.truthy(lfs.attributes("luasocket-2.0.2-7.rockspec")) | ||
| 43 | test_env.remove_files(lfs.currentdir(), "luasocket--") | ||
| 44 | end) | ||
| 45 | |||
| 46 | it("LuaRocks new_version of luacov", function() | ||
| 47 | assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) | ||
| 48 | assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec 0.2")) | ||
| 49 | assert.is.truthy(lfs.attributes("luacov-0.2-1.rockspec")) | ||
| 50 | test_env.remove_files(lfs.currentdir(), "luacov--") | ||
| 51 | end) | ||
| 52 | |||
| 53 | it("LuaRocks new_version url of abelhas", function() | ||
| 54 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) | ||
| 55 | assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luaforge.net/frs/download.php/2658/abelhas-1.0.tar.gz")) | ||
| 56 | assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) | ||
| 57 | test_env.remove_files(lfs.currentdir(), "abelhas--") | ||
| 58 | end) | ||
| 59 | |||
| 60 | it("LuaRocks new_version of luacov with tag", function() | ||
| 61 | assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) | ||
| 62 | assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec --tag v0.3")) | ||
| 63 | assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec")) | ||
| 64 | test_env.remove_files(lfs.currentdir(), "luacov--") | ||
| 65 | end) | ||
| 66 | |||
| 67 | it("LuaRocks new version updating md5", function() | ||
| 68 | assert.is_true(run.luarocks_bool("download --rockspec lpeg 0.12")) | ||
| 69 | assert.is_true(run.luarocks_bool("new_version lpeg-0.12-1.rockspec 0.2 https://luarocks.org/manifests/gvvaughan/lpeg-1.0.0-1.rockspec")) | ||
| 70 | test_env.remove_files(lfs.currentdir(), "lpeg--") | ||
| 71 | end) | ||
| 72 | end) | ||
| 73 | end) | ||
