diff options
Diffstat (limited to 'spec/new_version_spec.lua')
-rw-r--r-- | spec/new_version_spec.lua | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua deleted file mode 100644 index 18271176..00000000 --- a/spec/new_version_spec.lua +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | local test_env = require("spec.util.test_env") | ||
2 | local lfs = require("lfs") | ||
3 | local run = test_env.run | ||
4 | local testing_paths = test_env.testing_paths | ||
5 | |||
6 | local extra_rocks = { | ||
7 | "/abelhas-1.1-1.rockspec", | ||
8 | "/lpeg-${LPEG}.rockspec" | ||
9 | } | ||
10 | |||
11 | describe("luarocks new_version #integration", function() | ||
12 | |||
13 | lazy_setup(function() | ||
14 | test_env.setup_specs(extra_rocks) | ||
15 | end) | ||
16 | |||
17 | describe("basic tests", function() | ||
18 | it("with no flags/arguments", function() | ||
19 | finally(function() | ||
20 | lfs.chdir(testing_paths.testrun_dir) | ||
21 | test_env.remove_dir("empty") | ||
22 | end) | ||
23 | assert(lfs.mkdir("empty")) | ||
24 | assert(lfs.chdir("empty")) | ||
25 | assert.is_false(run.luarocks_bool("new_version")) | ||
26 | end) | ||
27 | |||
28 | it("with invalid", function() | ||
29 | assert.is_false(run.luarocks_bool("new_version invalid")) | ||
30 | end) | ||
31 | |||
32 | it("with invalid url", function() | ||
33 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.1")) | ||
34 | assert.is_true(run.luarocks_bool("new_version abelhas-1.1-1.rockspec 1.1 http://luainvalid")) | ||
35 | assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) | ||
36 | test_env.remove_files(lfs.currentdir(), "abelhas%-") | ||
37 | end) | ||
38 | end) | ||
39 | |||
40 | describe("more complex tests", function() | ||
41 | it("of luacov", function() | ||
42 | assert.is_true(run.luarocks_bool("download --rockspec luacov ${LUACOV_V}")) | ||
43 | assert.is_true(run.luarocks_bool("new_version luacov-${LUACOV}.rockspec 0.2")) | ||
44 | assert.is.truthy(lfs.attributes("luacov-0.2-1.rockspec")) | ||
45 | test_env.remove_files(lfs.currentdir(), "luacov%-") | ||
46 | end) | ||
47 | |||
48 | it("url of abelhas", function() | ||
49 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.1")) | ||
50 | assert.is_true(run.luarocks_bool("new_version abelhas-1.1-1.rockspec 1.2 http://example.com/abelhas-1.2.tar.gz")) | ||
51 | assert.is.truthy(lfs.attributes("abelhas-1.2-1.rockspec")) | ||
52 | test_env.remove_files(lfs.currentdir(), "abelhas%-") | ||
53 | end) | ||
54 | |||
55 | it("of luacov with tag", function() | ||
56 | assert.is_true(run.luarocks_bool("download --rockspec luacov ${LUACOV_V}")) | ||
57 | assert.is_true(run.luarocks_bool("new_version luacov-${LUACOV}.rockspec --tag v0.3")) | ||
58 | assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec")) | ||
59 | test_env.remove_files(lfs.currentdir(), "luacov%-") | ||
60 | end) | ||
61 | |||
62 | it("updating md5", function() | ||
63 | assert.is_true(run.luarocks_bool("download --rockspec lpeg ${LPEG_V}")) | ||
64 | assert.is_true(run.luarocks_bool("new_version lpeg-${LPEG}.rockspec 0.2 https://luarocks.org/manifests/gvvaughan/lpeg-1.0.0-1.rockspec")) | ||
65 | test_env.remove_files(lfs.currentdir(), "lpeg%-") | ||
66 | end) | ||
67 | end) | ||
68 | |||
69 | describe("remote tests #mock", function() | ||
70 | lazy_setup(function() | ||
71 | test_env.setup_specs(extra_rocks, "mock") | ||
72 | test_env.mock_server_init() | ||
73 | end) | ||
74 | lazy_teardown(function() | ||
75 | test_env.mock_server_done() | ||
76 | end) | ||
77 | it("with remote spec", function() | ||
78 | assert.is_true(run.luarocks_bool("new_version http://localhost:8080/file/a_rock-1.0-1.rockspec")) | ||
79 | assert.is.truthy(lfs.attributes("a_rock-1.0-1.rockspec")) | ||
80 | assert.is.truthy(lfs.attributes("a_rock-1.0-2.rockspec")) | ||
81 | test_env.remove_files(lfs.currentdir(), "luasocket%-") | ||
82 | end) | ||
83 | end) | ||
84 | |||
85 | end) | ||