aboutsummaryrefslogtreecommitdiff
path: root/spec/new_version_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--spec/new_version_spec.lua65
1 files changed, 65 insertions, 0 deletions
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua
new file mode 100644
index 00000000..4e4d5d27
--- /dev/null
+++ b/spec/new_version_spec.lua
@@ -0,0 +1,65 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4local testing_paths = test_env.testing_paths
5
6test_env.unload_luarocks()
7
8local extra_rocks = {
9 "/abelhas-1.0-1.rockspec",
10 "/lpeg-0.12-1.rockspec"
11}
12
13describe("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 test_env.remove_files(lfs.currentdir(), "abelhas--")
34 end)
35 end)
36
37 describe("LuaRocks new_version more complex tests", function()
38 it("LuaRocks new_version of luacov", function()
39 assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0"))
40 assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec 0.2"))
41 assert.is.truthy(lfs.attributes("luacov-0.2-1.rockspec"))
42 test_env.remove_files(lfs.currentdir(), "luacov--")
43 end)
44
45 it("LuaRocks new_version url of abelhas", function()
46 assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0"))
47 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"))
48 assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec"))
49 test_env.remove_files(lfs.currentdir(), "abelhas--")
50 end)
51
52 it("LuaRocks new_version of luacov with tag", function()
53 assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0"))
54 assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec --tag v0.3"))
55 assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec"))
56 test_env.remove_files(lfs.currentdir(), "luacov--")
57 end)
58
59 it("LuaRocks new version updating md5", function()
60 assert.is_true(run.luarocks_bool("download --rockspec lpeg 0.12"))
61 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"))
62 test_env.remove_files(lfs.currentdir(), "lpeg--")
63 end)
64 end)
65end)