aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-07-11 01:15:41 -0300
committerHisham <hisham@gobolinux.org>2016-07-11 01:15:41 -0300
commit994a041b4f1348564f390f3f4d8ec040c8edb4b8 (patch)
tree128d264d86576e0b62225056769b7097a745b822 /spec
parent41eccd4ca6fe51f8174dd43744e7a4bab4daf2cb (diff)
parent77b41dd05a870feeb519e930472133f63cf94317 (diff)
downloadluarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.tar.gz
luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.tar.bz2
luarocks-994a041b4f1348564f390f3f4d8ec040c8edb4b8.zip
Merge branch 'master' of https://github.com/keplerproject/luarocks
Diffstat (limited to 'spec')
-rw-r--r--spec/add_spec.lua44
-rw-r--r--spec/build_spec.lua181
-rw-r--r--spec/config_spec.lua90
-rw-r--r--spec/deps_spec.lua114
-rw-r--r--spec/doc_spec.lua71
-rw-r--r--spec/download_spec.lua36
-rw-r--r--spec/fetch_spec.lua15
-rw-r--r--spec/help_spec.lua27
-rw-r--r--spec/install_spec.lua128
-rw-r--r--spec/lint_spec.lua49
-rw-r--r--spec/list_spec.lua39
-rw-r--r--spec/make_manifest_spec.lua17
-rw-r--r--spec/make_spec.lua98
-rw-r--r--spec/new_version_spec.lua65
-rw-r--r--spec/pack_spec.lua33
-rw-r--r--spec/path_spec.lua26
-rw-r--r--spec/purge_spec.lua28
-rw-r--r--spec/refresh_cache_spec.lua17
-rw-r--r--spec/remove_spec.lua84
-rw-r--r--spec/search_spec.lua40
-rw-r--r--spec/show_spec.lua54
-rw-r--r--spec/unpack_spec.lua58
-rw-r--r--spec/upload_spec.lua39
-rw-r--r--spec/util_spec.lua96
-rw-r--r--spec/write_rockspec_spec.lua73
25 files changed, 1522 insertions, 0 deletions
diff --git a/spec/add_spec.lua b/spec/add_spec.lua
new file mode 100644
index 00000000..dca6f850
--- /dev/null
+++ b/spec/add_spec.lua
@@ -0,0 +1,44 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3local testing_paths = test_env.testing_paths
4
5test_env.unload_luarocks()
6
7local extra_rocks = {
8 "/luasocket-3.0rc1-1.src.rock",
9 "/luasocket-3.0rc1-1.rockspec"
10}
11
12describe("LuaRocks add tests #blackbox #b_add", function()
13
14 before_each(function()
15 test_env.setup_specs(extra_rocks)
16 end)
17
18 describe("LuaRocks-admin add tests", function()
19 it("LuaRocks-admin add invalid rock #ssh", function()
20 assert.is_false(run.luarocks_admin_bool("--server=testing add invalid"))
21 end)
22
23 it("LuaRocks-admin add missing argument", function()
24 assert.is_false(run.luarocks_admin_bool("--server=testing add"))
25 end)
26
27 it("LuaRocks-admin add invalid server", function()
28 assert.is_false(run.luarocks_admin_bool("--server=invalid add " .. testing_paths.testing_server .. "/luasocket-3.0rc1-1.src.rock"))
29 end)
30
31 it("LuaRocks-admin add invalid server #ssh", function()
32 assert.is_true(run.luarocks_admin_bool("--server=testing add " .. testing_paths.testing_server .. "/luasocket-3.0rc1-1.src.rock"))
33 end)
34
35 --TODO This test fails, sftp not implemented
36 it("LuaRocks-admin add invalid server", function() --?
37 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" } ))
38 end)
39
40 it("LuaRocks-admin add, split server url", function()
41 assert.is_false(run.luarocks_admin_bool("--server=\"localhost@/tmp/luarocks_testing\" add " .. testing_paths.testing_server .. "luasocket-3.0rc1-1.src.rock"))
42 end)
43 end)
44end)
diff --git a/spec/build_spec.lua b/spec/build_spec.lua
new file mode 100644
index 00000000..1ce99089
--- /dev/null
+++ b/spec/build_spec.lua
@@ -0,0 +1,181 @@
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 "/lmathx-20120430.51-1.src.rock",
10 "/lmathx-20120430.51-1.rockspec",
11 "/lmathx-20120430.52-1.src.rock",
12 "/lmathx-20120430.52-1.rockspec",
13 "/lmathx-20150505-1.src.rock",
14 "/lmathx-20150505-1.rockspec",
15 "/lpeg-0.12-1.src.rock",
16 "/lpty-1.0.1-1.src.rock",
17 "/luadoc-3.0.1-1.src.rock",
18 "/luafilesystem-1.6.3-1.src.rock",
19 "/lualogging-1.3.0-1.src.rock",
20 "/luarepl-0.4-1.src.rock",
21 "/luasec-0.6-1.rockspec",
22 "/luasocket-3.0rc1-1.src.rock",
23 "/luasocket-3.0rc1-1.rockspec",
24 "/lxsh-0.8.6-2.src.rock",
25 "/lxsh-0.8.6-2.rockspec",
26 "/stdlib-41.0.0-1.src.rock",
27 "/validate-args-1.5.4-1.rockspec"
28}
29
30describe("LuaRocks build tests #blackbox #b_build", function()
31
32 before_each(function()
33 test_env.setup_specs(extra_rocks)
34 end)
35
36 describe("LuaRocks build - basic testing set", function()
37 it("LuaRocks build with no flags/arguments", function()
38 assert.is_false(run.luarocks_bool("build"))
39 end)
40
41 it("LuaRocks build invalid", function()
42 assert.is_false(run.luarocks_bool("build invalid"))
43 end)
44 end)
45
46 describe("LuaRocks build - building lpeg with flags", function()
47 it("LuaRocks build fail build permissions", function()
48 if test_env.TEST_TARGET_OS == "osx" or test_env.TEST_TARGET_OS == "linux" then
49 assert.is_false(run.luarocks_bool("build --tree=/usr lpeg"))
50 end
51 end)
52
53 it("LuaRocks build fail build permissions parent", function()
54 if test_env.TEST_TARGET_OS == "osx" or test_env.TEST_TARGET_OS == "linux" then
55 assert.is_false(run.luarocks_bool("build --tree=/usr/invalid lpeg"))
56 end
57 end)
58
59 it("LuaRocks build lpeg verbose", function()
60 assert.is_true(run.luarocks_bool("build --verbose lpeg"))
61 end)
62
63 it("LuaRocks build lpeg branch=master", function()
64 assert.is_true(run.luarocks_bool("build --branch=master lpeg"))
65 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
66 end)
67
68 it("LuaRocks build lpeg deps-mode=123", function()
69 assert.is_false(run.luarocks_bool("build --deps-mode=123 lpeg"))
70 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
71 end)
72
73 it("LuaRocks build lpeg only-sources example", function()
74 assert.is_true(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg"))
75 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
76 end)
77
78 it("LuaRocks build lpeg with empty tree", function()
79 assert.is_false(run.luarocks_bool("build --tree=\"\" lpeg"))
80 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
81 end)
82 end)
83
84 describe("LuaRocks build - basic builds", function()
85
86 it("LuaRocks build luadoc", function()
87 assert.is_true(run.luarocks_bool("build luadoc"))
88 end)
89
90 it("LuaRocks build luacov diff version", function()
91 assert.is_true(run.luarocks_bool("build luacov 0.11.0-1"))
92 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luacov"))
93 end)
94
95 it("LuaRocks build command stdlib", function()
96 assert.is_true(run.luarocks_bool("build stdlib"))
97 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/stdlib"))
98 end)
99
100 it("LuaRocks build install bin luarepl", function()
101 assert.is_true(run.luarocks_bool("build luarepl"))
102 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl"))
103 end)
104
105 it("LuaRocks build supported platforms lpty", function()
106 assert.is_true(run.luarocks_bool("build lpty"))
107 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpty"))
108 end)
109
110 it("LuaRocks build luasec with skipping dependency checks", function()
111 assert.is_true(run.luarocks_bool("build luasec --nodeps"))
112 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec"))
113 end)
114
115 it("LuaRocks build lmathx deps partial match", function()
116 assert.is_true(run.luarocks_bool("build lmathx"))
117 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx"))
118 end)
119 end)
120
121 describe("LuaRocks build - more complex tests", function()
122
123 it("LuaRocks build luacheck show downloads test_config", function()
124 local out = run.luarocks("build luacheck", { LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config_show_downloads.lua"} )
125 print(out)
126 end)
127
128 it("LuaRocks build luasec only deps", function()
129 assert.is_true(run.luarocks_bool("build luasec --only-deps"))
130 assert.is_false(run.luarocks_bool("show luasec"))
131 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec"))
132 end)
133
134 it("LuaRocks build only deps of downloaded rockspec of lxsh", function()
135 assert.is_true(run.luarocks_bool("download --rockspec lxsh 0.8.6-2"))
136 assert.is_true(run.luarocks_bool("build lxsh-0.8.6-2.rockspec --only-deps"))
137 assert.is_false(run.luarocks_bool("show lxsh"))
138 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
139 assert.is_true(os.remove("lxsh-0.8.6-2.rockspec"))
140 end)
141
142 it("LuaRocks build only deps of downloaded rock of lxsh", function()
143 assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2"))
144 assert.is_true(run.luarocks_bool("build lxsh-0.8.6-2.src.rock --only-deps"))
145 assert.is_false(run.luarocks_bool("show lxsh"))
146 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
147 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
148 end)
149
150 it("LuaRocks build no https", function()
151 assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1"))
152 assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec"))
153
154 assert.is_true(run.luarocks_bool("show validate-args"))
155 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args"))
156
157 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec"))
158 end)
159
160 it("LuaRocks build with https", function()
161 assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1"))
162 assert.is_true(run.luarocks_bool("install luasec"))
163 assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec"))
164
165 assert.is_true(run.luarocks_bool("show validate-args"))
166 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args"))
167
168 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec"))
169 end)
170
171 it("LuaRocks build missing external", function()
172 assert.is_true(test_env.need_luasocket())
173 assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\""))
174 end)
175
176 it("LuaRocks build invalid patch", function()
177 assert.is_true(test_env.need_luasocket())
178 assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec"))
179 end)
180 end)
181end)
diff --git a/spec/config_spec.lua b/spec/config_spec.lua
new file mode 100644
index 00000000..0dee8620
--- /dev/null
+++ b/spec/config_spec.lua
@@ -0,0 +1,90 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4local testing_paths = test_env.testing_paths
5local site_config
6
7test_env.unload_luarocks()
8
9describe("LuaRocks config tests #blackbox #b_config", function()
10
11 before_each(function()
12 test_env.setup_specs()
13 test_env.unload_luarocks() -- need to be required here, because site_config is created after first loading of specs
14 site_config = require("luarocks.site_config")
15 end)
16
17 describe("LuaRocks config - basic tests", function()
18 it("LuaRocks config with no flags/arguments", function()
19 assert.is_false(run.luarocks_bool("config"))
20 end)
21
22 it("LuaRocks config include dir", function()
23 local output = run.luarocks("config --lua-incdir")
24 assert.are.same(output, site_config.LUA_INCDIR)
25 end)
26
27 it("LuaRocks config library dir", function()
28 local output = run.luarocks("config --lua-libdir")
29 assert.are.same(output, site_config.LUA_LIBDIR)
30 end)
31
32 it("LuaRocks config lua version", function()
33 local output = run.luarocks("config --lua-ver")
34 local lua_version = _VERSION:gsub("Lua ", "")
35 if test_env.LUAJIT_V then
36 lua_version = "5.1"
37 end
38 assert.are.same(output, lua_version)
39 end)
40
41 it("LuaRocks config rock trees", function()
42 assert.is_true(run.luarocks_bool("config --rock-trees"))
43 end)
44
45 it("LuaRocks config user config", function()
46 local user_config_path = run.luarocks("config --user-config")
47 assert.is.truthy(lfs.attributes(user_config_path))
48 end)
49
50 it("LuaRocks config missing user config", function()
51 assert.is_false(run.luarocks_bool("config --user-config", {LUAROCKS_CONFIG = "missing_file.lua"}))
52 end)
53 end)
54
55 describe("LuaRocks config - more complex tests", function()
56 it("LuaRocks fail system config", function()
57 os.remove(testing_paths.testing_lrprefix .. "/etc/luarocks/config.lua")
58 assert.is_false(run.luarocks_bool("config --system-config;"))
59 end)
60
61 it("LuaRocks system config", function()
62 local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks"
63 lfs.mkdir(testing_paths.testing_lrprefix)
64 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/")
65 lfs.mkdir(scdir)
66
67 local sysconfig = io.open(scdir .. "/config.lua", "w+")
68 sysconfig:write(" ")
69 sysconfig:close()
70
71 local output = run.luarocks("config --system-config;")
72 assert.are.same(output, scdir .. "/config.lua")
73 test_env.remove_dir(testing_paths.testing_lrprefix)
74 end)
75
76 it("LuaRocks fail system config invalid", function()
77 local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks"
78 lfs.mkdir(testing_paths.testing_lrprefix)
79 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/")
80 lfs.mkdir(scdir)
81
82 local sysconfig = io.open(scdir .. "/config.lua", "w+")
83 sysconfig:write("if if if")
84 sysconfig:close()
85
86 assert.is_false(run.luarocks_bool("config --system-config;"))
87 test_env.remove_dir(testing_paths.testing_lrprefix)
88 end)
89 end)
90end)
diff --git a/spec/deps_spec.lua b/spec/deps_spec.lua
new file mode 100644
index 00000000..c1bd404d
--- /dev/null
+++ b/spec/deps_spec.lua
@@ -0,0 +1,114 @@
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 "/lxsh-0.8.6-2.src.rock",
10 "/lxsh-0.8.6-2.rockspec",
11 "/luasocket-3.0rc1-1.src.rock",
12 "/luasocket-3.0rc1-1.rockspec",
13 "/lpeg-0.12-1.src.rock"
14}
15
16describe("LuaRocks deps tests #blackbox #b_deps", function()
17
18 before_each(function()
19 test_env.setup_specs(extra_rocks)
20 end)
21
22 it("LuaRocks deps mode one", function()
23 assert.is_true(run.luarocks_bool("build --tree=system lpeg"))
24 assert.is_true(run.luarocks_bool("build --deps-mode=one --tree=" .. testing_paths.testing_tree .. " lxsh"))
25
26 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
27 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
28 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
29 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
30 end)
31
32 it("LuaRocks deps mode order", function()
33 assert.is_true(run.luarocks_bool("build --tree=system lpeg"))
34 assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_tree .. " lxsh"))
35
36 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
37 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
38 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
39 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
40 end)
41
42 it("LuaRocks deps mode order sys", function()
43 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg"))
44 assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_sys_tree .. " lxsh"))
45
46 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
47 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
48 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
49 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
50 end)
51
52 it("LuaRocks deps mode all sys", function()
53 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg"))
54 assert.is_true(run.luarocks_bool("build --deps-mode=all --tree=" .. testing_paths.testing_sys_tree .. " lxsh"))
55
56 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
57 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
58 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
59 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
60 end)
61
62 it("LuaRocks deps mode none", function()
63 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg"))
64 assert.is_true(run.luarocks_bool("build --deps-mode=none lxsh"))
65
66 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
67 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
68 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
69 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
70 end)
71
72 it("LuaRocks nodeps alias", function()
73 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " --nodeps lxsh"))
74
75 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
76 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
77 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
78 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
79 end)
80
81 it("LuaRocks deps mode make order", function()
82 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_sys_tree .. " lpeg"))
83 assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6"))
84 assert.is_true(run.luarocks_bool("unpack lxsh-0.8.6-2.src.rock"))
85 lfs.chdir("lxsh-0.8.6-2/lxsh-0.8.6-1/")
86 assert.is_true(run.luarocks_bool("make --tree=" .. testing_paths.testing_tree .. " --deps-mode=order"))
87
88 lfs.chdir(testing_paths.luarocks_dir)
89 test_env.remove_dir("lxsh-0.8.6-2")
90 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
91
92 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
93 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
94 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
95 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
96 end)
97
98 it("LuaRocks deps mode make order sys", function()
99 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg"))
100 assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6"))
101 assert.is_true(run.luarocks_bool("unpack lxsh-0.8.6-2.src.rock"))
102 lfs.chdir("lxsh-0.8.6-2/lxsh-0.8.6-1/")
103 assert.is_true(run.luarocks_bool("make --tree=" .. testing_paths.testing_sys_tree .. " --deps-mode=order"))
104
105 lfs.chdir(testing_paths.luarocks_dir)
106 test_env.remove_dir("lxsh-0.8.6-2")
107 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
108
109 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg"))
110 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg"))
111 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh"))
112 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
113 end)
114end)
diff --git a/spec/doc_spec.lua b/spec/doc_spec.lua
new file mode 100644
index 00000000..a04d3c14
--- /dev/null
+++ b/spec/doc_spec.lua
@@ -0,0 +1,71 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3local testing_paths = test_env.testing_paths
4
5test_env.unload_luarocks()
6
7local extra_rocks = {
8 "/luarepl-0.4-1.src.rock",
9 "/c3-1.0-1.src.rock"
10}
11
12describe("LuaRocks doc tests #blackbox #b_doc", function()
13
14 before_each(function()
15 test_env.setup_specs(extra_rocks)
16 end)
17
18 describe("LuaRocks doc basic tests", function()
19 it("LuaRocks doc with no flags/arguments", function()
20 assert.is_false(run.luarocks_bool("doc"))
21 end)
22 it("LuaRocks doc with invalid argument", function()
23 assert.is_false(run.luarocks_bool("doc invalid"))
24 end)
25 it("LuaRocks doc with no homepage", function()
26 assert.is_true(run.luarocks_bool("install c3"))
27 assert.is_false(run.luarocks_bool("doc c3 --home"))
28 end)
29 it("LuaRocks doc with no home page and no doc folder", function()
30 assert.is_true(run.luarocks_bool("install c3"))
31 test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/c3/1.0-1/doc")
32 assert.is_false(run.luarocks_bool("doc c3"))
33 end)
34 it("LuaRocks doc with no doc folder opening descript.homepage", function()
35 assert.is_true(run.luarocks_bool("install luarepl"))
36 test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/doc")
37 local output = run.luarocks("doc luarepl")
38 assert.is.truthy(output:find("Local documentation directory not found"))
39 end)
40 end)
41
42 describe("LuaRocks doc tests with flags", function()
43 it("LuaRocks doc of installed luarepl", function()
44 assert.is_true(run.luarocks_bool("install luarepl"))
45 assert.is_true(run.luarocks_bool("doc luarepl"))
46 end)
47
48 it("LuaRocks doc of luacov and access its home page", function()
49 assert.is_true(run.luarocks_bool("install luacov"))
50 assert.is_true(run.luarocks_bool("doc luacov --home"))
51 end)
52
53 it("LuaRocks doc of luacov and list doc folder", function()
54 assert.is_true(run.luarocks_bool("install luacov"))
55 local output = assert.is.truthy(run.luarocks("doc luacov --list"))
56 assert.is.truthy(output:find("/lib/luarocks/rocks/luacov/0.11.0--1/doc/"))
57 end)
58
59 it("LuaRocks doc of luacov local", function()
60 assert.is_true(run.luarocks_bool("install luacov"))
61 assert.is_true(run.luarocks_bool("doc luacov --local"))
62 end)
63
64 it("LuaRocks doc of luacov porcelain", function()
65 assert.is_true(run.luarocks_bool("install luacov"))
66 assert.is_true(run.luarocks_bool("doc luacov --porcelain"))
67 end)
68 end)
69end)
70
71
diff --git a/spec/download_spec.lua b/spec/download_spec.lua
new file mode 100644
index 00000000..320d9304
--- /dev/null
+++ b/spec/download_spec.lua
@@ -0,0 +1,36 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4
5test_env.unload_luarocks()
6
7local extra_rocks = {
8 "/validate-args-1.5.4-1.rockspec"
9}
10
11describe("LuaRocks download tests #blackbox #b_download", function()
12
13 before_each(function()
14 test_env.setup_specs(extra_rocks)
15 end)
16
17 it("LuaRocks download with no flags/arguments", function()
18 assert.is_false(run.luarocks_bool("download"))
19 end)
20
21 it("LuaRocks download invalid", function()
22 assert.is_false(run.luarocks_bool("download invalid"))
23 end)
24
25 it("LuaRocks download all with delete downloaded files", function() --TODO maybe download --all more rocks
26 assert.is_true(run.luarocks_bool("download --all validate-args"))
27 assert.is.truthy(lfs.attributes("validate-args-1.5.4-1.rockspec"))
28 test_env.remove_files(lfs.currentdir(), "validate--args--")
29 end)
30
31 it("LuaRocks download rockspec version", function()
32 assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1"))
33 assert.is.truthy(lfs.attributes("validate-args-1.5.4-1.rockspec"))
34 test_env.remove_files(lfs.currentdir(), "validate--args--")
35 end)
36end)
diff --git a/spec/fetch_spec.lua b/spec/fetch_spec.lua
new file mode 100644
index 00000000..05a709e4
--- /dev/null
+++ b/spec/fetch_spec.lua
@@ -0,0 +1,15 @@
1local test_env = require("test/test_environment")
2
3test_env.unload_luarocks()
4local fetch = require("luarocks.fetch")
5
6describe("Luarocks fetch test #whitebox #w_fetch", function()
7 it("Fetch url to base dir", function()
8 assert.are.same("v0.3", fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2/archive/v0.3.zip"))
9 assert.are.same("lua-compat-5.2", fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.zip"))
10 assert.are.same("lua-compat-5.2", fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.tar.gz"))
11 assert.are.same("lua-compat-5.2", fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2.tar.bz2"))
12 assert.are.same("parser.moon", fetch.url_to_base_dir("git://github.com/Cirru/parser.moon"))
13 assert.are.same("v0.3", fetch.url_to_base_dir("https://github.com/hishamhm/lua-compat-5.2/archive/v0.3"))
14 end)
15end)
diff --git a/spec/help_spec.lua b/spec/help_spec.lua
new file mode 100644
index 00000000..0d41e2e9
--- /dev/null
+++ b/spec/help_spec.lua
@@ -0,0 +1,27 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3
4test_env.unload_luarocks()
5
6describe("LuaRocks help tests #blackbox #b_help", function()
7
8 before_each(function()
9 test_env.setup_specs()
10 end)
11
12 it("LuaRocks help with no flags/arguments", function()
13 assert.is_true(run.luarocks_bool("help"))
14 end)
15
16 it("LuaRocks help invalid argument", function()
17 assert.is_false(run.luarocks_bool("help invalid"))
18 end)
19
20 it("LuaRocks help config", function()
21 assert.is_true(run.luarocks_bool("help config"))
22 end)
23
24 it("LuaRocks-admin help with no flags/arguments", function()
25 assert.is_true(run.luarocks_admin_bool("help"))
26 end)
27end)
diff --git a/spec/install_spec.lua b/spec/install_spec.lua
new file mode 100644
index 00000000..0e406e22
--- /dev/null
+++ b/spec/install_spec.lua
@@ -0,0 +1,128 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4local testing_paths = test_env.testing_paths
5local env_variables = test_env.env_variables
6
7test_env.unload_luarocks()
8
9local extra_rocks = {
10 "/cprint-0.1-2.src.rock",
11 "/cprint-0.1-2.rockspec",
12 "/lpeg-0.12-1.src.rock",
13 "/luasec-0.6-1.rockspec",
14 "/luassert-1.7.0-1.src.rock",
15 "/luasocket-3.0rc1-1.src.rock",
16 "/luasocket-3.0rc1-1.rockspec",
17 "/lxsh-0.8.6-2.src.rock",
18 "/lxsh-0.8.6-2.rockspec",
19 "/say-1.2-1.src.rock",
20 "/say-1.0-1.src.rock",
21 "/wsapi-1.6-1.src.rock"
22}
23
24describe("LuaRocks install tests #blackbox #b_install", function()
25
26 before_each(function()
27 test_env.setup_specs(extra_rocks)
28 end)
29
30 describe("LuaRocks install - basic tests", function()
31 it("LuaRocks install with no flags/arguments", function()
32 assert.is_false(run.luarocks_bool("install"))
33 end)
34
35 it("LuaRocks install with invalid argument", function()
36 assert.is_false(run.luarocks_bool("install invalid"))
37 end)
38
39 it("LuaRocks install invalid patch", function()
40 assert.is_false(run.luarocks_bool("install " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec"))
41 end)
42
43 it("LuaRocks install invalid rock", function()
44 assert.is_false(run.luarocks_bool("install \"invalid.rock\" "))
45 end)
46
47 it("LuaRocks install with local flag as root", function()
48 assert.is_false(run.luarocks_bool("install --local luasocket", { USER = "root" } ))
49 end)
50
51 it("LuaRocks install not a zip file", function()
52 assert.is_false(run.luarocks_bool("install " .. testing_paths.testing_dir .. "/testfiles/not_a_zipfile-1.0-1.src.rock"))
53 end)
54
55 it("LuaRocks install only-deps of lxsh show there is no lxsh", function()
56 assert.is_true(run.luarocks_bool("install lxsh 0.8.6-2 --only-deps"))
57 assert.is_false(run.luarocks_bool("show lxsh"))
58 end)
59
60 it("LuaRocks install incompatible architecture", function()
61 assert.is_false(run.luarocks_bool("install \"foo-1.0-1.impossible-x86.rock\" "))
62 end)
63
64 it("LuaRocks install wsapi with bin", function()
65 run.luarocks_bool("install wsapi")
66 end)
67
68 it("LuaRocks install luasec and show luasocket (dependency)", function()
69 assert.is_true(run.luarocks_bool("install luasec"))
70 assert.is_true(run.luarocks_bool("show luasocket"))
71 end)
72 end)
73
74 describe("LuaRocks install - more complex tests", function()
75 it('LuaRocks install luasec with skipping dependency checks', function()
76 run.luarocks(" install luasec --nodeps")
77 assert.is_true(run.luarocks_bool("show luasec"))
78 if env_variables.TYPE_TEST_ENV == "minimal" then
79 assert.is_false(run.luarocks_bool("show luasocket"))
80 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
81 end
82 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec"))
83 end)
84
85 it("LuaRocks install only-deps of luasocket packed rock", function()
86 assert.is_true(test_env.need_luasocket())
87 local output = run.luarocks("install --only-deps " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock")
88 assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-1")
89 end)
90
91 it("LuaRocks install binary rock of cprint", function()
92 assert.is_true(test_env.need_luasocket())
93 assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint"))
94 assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock"))
95 assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock"))
96 end)
97
98 it("LuaRocks install reinstall", function()
99 assert.is_true(test_env.need_luasocket())
100 assert.is_true(run.luarocks_bool("install " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock"))
101 assert.is_true(run.luarocks_bool("install --deps-mode=none " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock"))
102 end)
103 end)
104
105 describe("New install functionality based on pull request 552", function()
106 it("LuaRocks install break dependencies warning", function()
107 assert.is_true(run.luarocks_bool("install say 1.2"))
108 assert.is_true(run.luarocks_bool("install luassert"))
109 assert.is_true(run.luarocks_bool("install say 1.0"))
110 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1"))
111 end)
112 it("LuaRocks install break dependencies force", function()
113 assert.is_true(run.luarocks_bool("install say 1.2"))
114 assert.is_true(run.luarocks_bool("install luassert"))
115 local output = run.luarocks("install --force say 1.0")
116 assert.is.truthy(output:find("Checking stability of dependencies"))
117 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1"))
118 end)
119 it("LuaRocks install break dependencies force fast", function()
120 assert.is_true(run.luarocks_bool("install say 1.2"))
121 assert.is_true(run.luarocks_bool("install luassert"))
122 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1"))
123 local output = run.luarocks("install --force-fast say 1.0")
124 assert.is.falsy(output:find("Checking stability of dependencies"))
125 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.0-1"))
126 end)
127 end)
128end)
diff --git a/spec/lint_spec.lua b/spec/lint_spec.lua
new file mode 100644
index 00000000..f7496037
--- /dev/null
+++ b/spec/lint_spec.lua
@@ -0,0 +1,49 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3local testing_paths = test_env.testing_paths
4
5test_env.unload_luarocks()
6
7local extra_rocks = {
8 "/validate-args-1.5.4-1.rockspec"
9}
10
11describe("LuaRocks lint tests #blackbox #b_lint", function()
12
13 before_each(function()
14 test_env.setup_specs(extra_rocks)
15 end)
16
17 it("LuaRocks lint with no flags/arguments", function()
18 assert.is_false(run.luarocks_bool("lint"))
19 end)
20
21 it("LuaRocks lint invalid argument", function()
22 assert.is_false(run.luarocks_bool("lint invalid"))
23 end)
24
25 it("LuaRocks lint OK", function()
26 assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1"))
27 local output = run.luarocks("lint validate-args-1.5.4-1.rockspec")
28 assert.are.same(output, "")
29 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec"))
30 end)
31
32 describe("LuaRocks lint mismatch set", function()
33 it("LuaRocks lint mismatch string", function()
34 assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_string-1.0-1.rockspec"))
35 end)
36
37 it("LuaRocks lint mismatch version", function()
38 assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_version-1.0-1.rockspec"))
39 end)
40
41 it("LuaRocks lint mismatch table", function()
42 assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_table-1.0-1.rockspec"))
43 end)
44
45 it("LuaRocks lint mismatch no build table", function()
46 assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/no_build_table-1.0-1.rockspec"))
47 end)
48 end)
49end)
diff --git a/spec/list_spec.lua b/spec/list_spec.lua
new file mode 100644
index 00000000..1b082ab6
--- /dev/null
+++ b/spec/list_spec.lua
@@ -0,0 +1,39 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3local testing_paths = test_env.testing_paths
4
5test_env.unload_luarocks()
6
7local extra_rocks = {
8 "/say-1.0-1.src.rock",
9 "/say-1.2-1.src.rock"
10}
11
12describe("LuaRocks list tests #blackbox #b_list", function()
13
14 before_each(function()
15 test_env.setup_specs(extra_rocks)
16 end)
17
18 it("LuaRocks list with no flags/arguments", function()
19 local output = run.luarocks("list")
20 assert.is.truthy(output:find("luacov"))
21 end)
22
23 it("LuaRocks list porcelain", function()
24 local output = run.luarocks("list --porcelain")
25 local path = testing_paths.testing_sys_tree:gsub("-", "--") -- !not sure! why this is good
26 assert.is.truthy(output:find("luacov\t0.11.0--1\tinstalled\t" .. path .. "/lib/luarocks/rocks" ))
27 end)
28
29 it("LuaRocks install outdated and list it", function()
30 assert.is_true(run.luarocks_bool("install say 1.0-1"))
31 local output = run.luarocks("list --outdated")
32 assert.is.truthy(output:find("say"))
33 end)
34
35 it("LuaRocks list invalid tree", function()
36 local output = run.luarocks("--tree=/some/invalid/tree list")
37 assert.are.same(output, "Installed rocks:----------------")
38 end)
39end)
diff --git a/spec/make_manifest_spec.lua b/spec/make_manifest_spec.lua
new file mode 100644
index 00000000..1c7f5bf8
--- /dev/null
+++ b/spec/make_manifest_spec.lua
@@ -0,0 +1,17 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3
4test_env.unload_luarocks()
5
6describe("LuaRocks make_manifest tests #blackbox #b_make_manifest", function()
7
8 before_each(function()
9 test_env.setup_specs()
10 end)
11
12 describe("LuaRocks-admin make manifest tests", function()
13 it("LuaRocks-admin make manifest", function()
14 assert.is_true(run.luarocks_admin_bool("make_manifest"))
15 end)
16 end)
17end)
diff --git a/spec/make_spec.lua b/spec/make_spec.lua
new file mode 100644
index 00000000..2821c143
--- /dev/null
+++ b/spec/make_spec.lua
@@ -0,0 +1,98 @@
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 "/lpeg-0.12-1.src.rock",
10 "/luasocket-3.0rc1-1.src.rock",
11 "/luasocket-3.0rc1-1.rockspec",
12 "/lxsh-0.8.6-2.src.rock",
13 "/lxsh-0.8.6-2.rockspec"
14}
15
16describe("LuaRocks make tests #blackbox #b_make", function()
17
18 before_each(function()
19 test_env.setup_specs(extra_rocks)
20 end)
21
22 it("LuaRocks make with no flags/arguments", function()
23 lfs.chdir("test")
24 assert.is_false(run.luarocks_bool("make"))
25 lfs.chdir(testing_paths.luarocks_dir)
26 end)
27
28 it("LuaRocks make with rockspec", function()
29 -- make luasocket
30 assert.is_true(run.luarocks_bool("download --source luasocket"))
31 assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-1.src.rock"))
32 lfs.chdir("luasocket-3.0rc1-1/luasocket-3.0-rc1/")
33 assert.is_true(run.luarocks_bool("make luasocket-3.0rc1-1.rockspec"))
34
35 -- test it
36 assert.is_true(run.luarocks_bool("show luasocket"))
37 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
38
39 -- delete downloaded and unpacked files
40 lfs.chdir(testing_paths.luarocks_dir)
41 test_env.remove_dir("luasocket-3.0rc1-1")
42 assert.is_true(os.remove("luasocket-3.0rc1-1.src.rock"))
43 end)
44
45 describe("LuaRocks making rockspecs (using lxsh)", function()
46 --download lxsh and unpack it
47 before_each(function()
48 assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2"))
49 assert.is_true(run.luarocks_bool("unpack lxsh-0.8.6-2.src.rock"))
50 assert.is_true(lfs.chdir("lxsh-0.8.6-2/lxsh-0.8.6-1/"))
51 end)
52
53 -- delete downloaded and unpacked files
54 after_each(function()
55 assert.is_true(lfs.chdir(testing_paths.luarocks_dir))
56 test_env.remove_dir("lxsh-0.8.6-2")
57 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
58 end)
59
60 it("LuaRocks make default rockspec", function()
61 assert.is_true(run.luarocks_bool("new_version lxsh-0.8.6-2.rockspec"))
62 assert.is_true(run.luarocks_bool("make"))
63
64 assert.is_true(run.luarocks_bool("show lxsh"))
65 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
66 end)
67
68 it("LuaRocks make unnamed rockspec", function()
69 os.execute("cp lxsh-0.8.6-2.rockspec rockspec") --rewrite with lfs
70 assert.is_true(run.luarocks_bool("make"))
71
72 assert.is_true(run.luarocks_bool("show lxsh"))
73 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
74 end)
75
76 it("LuaRocks make ambiguous rockspec", function()
77 assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "lxsh2-0.8.6-2.rockspec"))
78 assert.is_false(run.luarocks_bool("make"))
79
80 assert.is_false(run.luarocks_bool("show lxsh"))
81 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
82 end)
83
84 it("LuaRocks make ambiguous unnamed rockspec", function()
85 assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "1_rockspec"))
86 os.execute("cp 1_rockspec 2_rockspec") --rewrite with lfs
87 assert.is_false(run.luarocks_bool("make"))
88
89 assert.is_false(run.luarocks_bool("show lxsh"))
90 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh"))
91 end)
92
93 it("LuaRocks make pack binary rock", function()
94 assert.is_true(run.luarocks_bool("make --deps-mode=none --pack-binary-rock"))
95 assert.is.truthy(lfs.attributes("lxsh-0.8.6-2.all.rock"))
96 end)
97 end)
98end)
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)
diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua
new file mode 100644
index 00000000..416184a8
--- /dev/null
+++ b/spec/pack_spec.lua
@@ -0,0 +1,33 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4
5test_env.unload_luarocks()
6
7local extra_rocks = {
8 "/luasec-0.6-1.rockspec",
9 "/luasocket-3.0rc1-1.src.rock",
10 "/luasocket-3.0rc1-1.rockspec"
11}
12
13describe("LuaRocks pack tests #blackbox #b_pack", function()
14
15 before_each(function()
16 test_env.setup_specs(extra_rocks)
17 end)
18
19 it("LuaRocks pack basic", function()
20 assert.is_true(run.luarocks_bool("list"))
21 assert.is_true(run.luarocks_bool("pack luacov"))
22 assert.is_true(test_env.remove_files(lfs.currentdir(), "luacov-"))
23 end)
24
25 it("LuaRocks pack src", function()
26 assert.is_true(run.luarocks_bool("install luasec"))
27 assert.is_true(run.luarocks_bool("download --rockspec luasocket"))
28 assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-1.rockspec"))
29 assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-"))
30 end)
31end)
32
33
diff --git a/spec/path_spec.lua b/spec/path_spec.lua
new file mode 100644
index 00000000..22f07591
--- /dev/null
+++ b/spec/path_spec.lua
@@ -0,0 +1,26 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3
4test_env.unload_luarocks()
5
6describe("LuaRocks path tests #blackbox #b_path", function()
7 before_each(function()
8 test_env.setup_specs()
9 end)
10
11 it("LuaRocks path bin", function()
12 assert.is_true(run.luarocks_bool("path --bin"))
13 end)
14
15 it("LuaRocks path lr-path", function()
16 assert.is_true(run.luarocks_bool("path --lr-path"))
17 end)
18
19 it("LuaRocks path lr-cpath", function()
20 assert.is_true(run.luarocks_bool("path --lr-cpath"))
21 end)
22
23 it("LuaRocks path with tree", function()
24 assert.is_true(run.luarocks_bool("path --tree=lua_modules"))
25 end)
26end)
diff --git a/spec/purge_spec.lua b/spec/purge_spec.lua
new file mode 100644
index 00000000..09a9d433
--- /dev/null
+++ b/spec/purge_spec.lua
@@ -0,0 +1,28 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3local testing_paths = test_env.testing_paths
4
5test_env.unload_luarocks()
6
7describe("LuaRocks purge tests #blackbox #b_purge", function()
8 before_each(function()
9 test_env.setup_specs()
10 end)
11
12 describe("LuaRocks purge basic tests", function()
13 it("LuaRocks purge missing tree", function()
14 assert.is_false(run.luarocks_bool("purge --tree=" .. testing_paths.testing_tree))
15 end)
16 it("LuaRocks purge tree with no string", function()
17 assert.is_false(run.luarocks_bool("purge --tree=1"))
18 end)
19 it("LuaRocks purge tree with no string", function()
20 assert.is_true(run.luarocks_bool("purge --tree=" .. testing_paths.testing_sys_tree))
21 end)
22 it("LuaRocks purge old versions tree", function()
23 assert.is_true(run.luarocks_bool("purge --old-versions --tree=" .. testing_paths.testing_sys_tree))
24 end)
25 end)
26end)
27
28
diff --git a/spec/refresh_cache_spec.lua b/spec/refresh_cache_spec.lua
new file mode 100644
index 00000000..c20771ab
--- /dev/null
+++ b/spec/refresh_cache_spec.lua
@@ -0,0 +1,17 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3
4test_env.unload_luarocks()
5
6describe("LuaRocks refresh_cache tests #blackbox #b_refresh_cache", function()
7
8 before_each(function()
9 test_env.setup_specs()
10 end)
11
12 describe("LuaRocks-admin refresh cache tests #ssh", function()
13 it("LuaRocks-admin refresh cache", function()
14 assert.is_true(run.luarocks_admin_bool("--server=testing refresh_cache"))
15 end)
16 end)
17end)
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua
new file mode 100644
index 00000000..41c6348a
--- /dev/null
+++ b/spec/remove_spec.lua
@@ -0,0 +1,84 @@
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 "/lualogging-1.3.0-1.src.rock",
11 "/luasocket-3.0rc1-1.src.rock",
12 "/luasocket-3.0rc1-1.rockspec"
13}
14
15describe("LuaRocks remove tests #blackbox #b_remove", function()
16
17 before_each(function()
18 test_env.setup_specs(extra_rocks)
19 end)
20
21 describe("LuaRocks remove basic tests", function()
22 it("LuaRocks remove with no flags/arguments", function()
23 assert.is_false(run.luarocks_bool("remove"))
24 end)
25
26 it("LuaRocks remove invalid rock", function()
27 assert.is_false(run.luarocks_bool("remove invalid.rock"))
28 end)
29
30 it("LuaRocks remove missing rock", function()
31 assert.is_false(run.luarocks_bool("remove missing_rock"))
32 end)
33
34 it("LuaRocks remove invalid argument", function()
35 assert.is_false(run.luarocks_bool("remove luacov --deps-mode"))
36 end)
37
38 it("LuaRocks remove builded abelhas", function()
39 assert.is_true(run.luarocks_bool("build abelhas 1.0"))
40 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
41 assert.is_true(run.luarocks_bool("remove abelhas 1.0"))
42 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas"))
43 end)
44 end)
45
46 describe("LuaRocks remove more complex tests", function()
47 it("LuaRocks remove fail, break dependencies", function()
48 assert.is_true(test_env.need_luasocket())
49 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
50 assert.is_true(run.luarocks_bool("build lualogging"))
51
52 assert.is_false(run.luarocks_bool("remove luasocket"))
53 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
54 end)
55
56 it("LuaRocks remove force", function()
57 assert.is_true(test_env.need_luasocket())
58 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
59 assert.is_true(run.luarocks_bool("build lualogging"))
60
61 local output = run.luarocks("remove --force luasocket")
62 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
63 assert.is.truthy(output:find("Checking stability of dependencies"))
64 end)
65
66 it("LuaRocks remove force fast", function()
67 assert.is_true(test_env.need_luasocket())
68 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
69 assert.is_true(run.luarocks_bool("build lualogging"))
70
71 local output = run.luarocks("remove --force-fast luasocket")
72 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket"))
73 assert.is.falsy(output:find("Checking stability of dependencies"))
74 end)
75 end)
76
77 it("LuaRocks-admin remove #ssh", function()
78 assert.is_true(run.luarocks_admin_bool("--server=testing remove luasocket-3.0rc1-1.src.rock"))
79 end)
80
81 it("LuaRocks-admin remove missing", function()
82 assert.is_false(run.luarocks_admin_bool("--server=testing remove"))
83 end)
84end)
diff --git a/spec/search_spec.lua b/spec/search_spec.lua
new file mode 100644
index 00000000..33c49856
--- /dev/null
+++ b/spec/search_spec.lua
@@ -0,0 +1,40 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3
4test_env.unload_luarocks()
5
6local extra_rocks = {
7"/lzlib-0.4.1.53-1.src.rock"
8}
9
10describe("LuaRocks search tests #blackbox #b_search", function()
11
12 before_each(function()
13 test_env.setup_specs(extra_rocks)
14 end)
15
16 it("LuaRocks search with no flags/arguments", function()
17 assert.is_false(run.luarocks_bool("search"))
18 end)
19
20 it("LuaRocks search zlib", function()
21 assert.is_true(run.luarocks_bool("search zlib"))
22 end)
23
24 it("LuaRocks search zlib 1.1", function()
25 assert.is_true(run.luarocks_bool("search zlib 1.1"))
26 end)
27
28 it("LuaRocks search missing rock", function()
29 assert.is_true(run.luarocks_bool("search missing_rock"))
30 end)
31
32 it("LuaRocks search with flag all", function()
33 assert.is_true(run.luarocks_bool("search --all"))
34 end)
35
36 it("LuaRocks search zlib", function()
37 local num = 123
38 assert.is_true(run.luarocks_bool("search " .. num))
39 end)
40end)
diff --git a/spec/show_spec.lua b/spec/show_spec.lua
new file mode 100644
index 00000000..f528a6de
--- /dev/null
+++ b/spec/show_spec.lua
@@ -0,0 +1,54 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3
4test_env.unload_luarocks()
5
6describe("LuaRocks show tests #blackbox #b_show", function()
7
8 before_each(function()
9 test_env.setup_specs()
10 end)
11
12 it("LuaRocks show with no flags/arguments", function()
13 assert.is_false(run.luarocks_bool("show"))
14 end)
15
16 describe("LuaRocks show basic tests with flags", function()
17 it("LuaRocks show invalid", function()
18 assert.is_false(run.luarocks_bool("show invalid"))
19 end)
20
21 it("LuaRocks show luacov", function()
22 local output = run.luarocks("show luacov")
23 end)
24
25 it("LuaRocks show modules of luacov", function()
26 local output = run.luarocks("show --modules luacov")
27 end)
28
29 it("LuaRocks show dependencies of luacov", function()
30 local output = run.luarocks("show --deps luacov")
31 end)
32
33 it("LuaRocks show rockspec of luacov", function()
34 local output = run.luarocks("show --rockspec luacov")
35 end)
36
37 it("LuaRocks show mversion of luacov", function()
38 local output = run.luarocks("show --mversion luacov")
39 end)
40
41 it("LuaRocks show rock tree of luacov", function()
42 local output = run.luarocks("show --rock-tree luacov")
43 end)
44
45 it("LuaRocks show rock directory of luacov", function()
46 local output = run.luarocks("show --rock-dir luacov")
47 end)
48 end)
49
50 it("LuaRocks show old version of luacov", function()
51 run.luarocks("install luacov 0.11.0")
52 run.luarocks("show luacov 0.11.0")
53 end)
54end)
diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua
new file mode 100644
index 00000000..76e9e5a8
--- /dev/null
+++ b/spec/unpack_spec.lua
@@ -0,0 +1,58 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3local testing_paths = test_env.testing_paths
4
5test_env.unload_luarocks()
6
7local extra_rocks = {
8 "/cprint-0.1-2.src.rock",
9 "/cprint-0.1-2.rockspec"
10}
11
12describe("LuaRocks unpack tests #blackbox #b_unpack", function()
13
14 before_each(function()
15 test_env.setup_specs(extra_rocks)
16 end)
17
18 describe("LuaRocks unpack basic fail tests", function()
19 it("LuaRocks unpack with no flags/arguments", function()
20 assert.is_false(run.luarocks_bool("unpack"))
21 end)
22 it("LuaRocks unpack with invalid rockspec", function()
23 assert.is_false(run.luarocks_bool("unpack invalid.rockspec"))
24 end)
25 it("LuaRocks unpack with invalid patch", function()
26 assert.is_false(run.luarocks_bool("unpack " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec"))
27 end)
28 end)
29
30 describe("LuaRocks unpack more complex tests", function()
31 it("LuaRocks unpack download", function()
32 assert.is_true(run.luarocks_bool("unpack cprint"))
33 test_env.remove_dir("cprint-0.1-2")
34 end)
35 it("LuaRocks unpack src", function()
36 assert.is_true(run.luarocks_bool("download --source cprint"))
37 assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock"))
38 os.remove("cprint-0.1-2.src.rock")
39 test_env.remove_dir("cprint-0.1-2")
40 end)
41 it("LuaRocks unpack src", function()
42 assert.is_true(run.luarocks_bool("download --rockspec cprint"))
43 assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec"))
44 os.remove("cprint-0.1-2.rockspec")
45 os.remove("lua-cprint")
46 test_env.remove_dir("cprint-0.1-2")
47 end)
48 it("LuaRocks unpack binary", function()
49 assert.is_true(run.luarocks_bool("build cprint"))
50 assert.is_true(run.luarocks_bool("pack cprint"))
51 assert.is_true(run.luarocks_bool("unpack cprint-0.1-2." .. test_env.platform .. ".rock"))
52 test_env.remove_dir("cprint-0.1-2")
53 os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")
54 end)
55 end)
56end)
57
58
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua
new file mode 100644
index 00000000..c10ef0e9
--- /dev/null
+++ b/spec/upload_spec.lua
@@ -0,0 +1,39 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3
4test_env.unload_luarocks()
5
6local extra_rocks = {
7 "/lua-cjson-2.1.0-1.src.rock"
8}
9
10describe("LuaRocks upload tests #blackbox #b_upload", function()
11
12 before_each(function()
13 test_env.setup_specs(extra_rocks)
14 end)
15
16 it("LuaRocks upload with no flags/arguments", function()
17 assert.is_false(run.luarocks_bool("upload"))
18 end)
19
20 it("LuaRocks upload invalid rockspec", function()
21 assert.is_false(run.luarocks_bool("upload invalid.rockspec"))
22 end)
23
24 it("LuaRocks upload api key invalid", function()
25 assert.is_false(run.luarocks_bool("upload --api-key=invalid invalid.rockspec"))
26 end)
27
28 it("LuaRocks upload api key invalid and skip-pack", function()
29 assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack luacov-0.11.0-1.rockspec"))
30 end)
31
32 it("LuaRocks upload force", function()
33 assert.is_true(run.luarocks_bool("install lua-cjson"))
34 assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force luacov-0.11.0-1.rockspec"))
35 assert.is_true(run.luarocks_bool("install lua-cjson"))
36 end)
37end)
38
39
diff --git a/spec/util_spec.lua b/spec/util_spec.lua
new file mode 100644
index 00000000..9118ffc9
--- /dev/null
+++ b/spec/util_spec.lua
@@ -0,0 +1,96 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4local testing_paths = test_env.testing_paths
5local env_variables = test_env.env_variables
6
7describe("Basic tests #blackbox #b_util", function()
8
9 before_each(function()
10 test_env.setup_specs()
11 end)
12
13 it("LuaRocks version", function()
14 assert.is_true(run.luarocks_bool("--version"))
15 end)
16
17 it("LuaRocks unknown command", function()
18 assert.is_false(run.luarocks_bool("unknown_command"))
19 end)
20
21 it("LuaRocks arguments fail", function()
22 assert.is_false(run.luarocks_bool("--porcelain=invalid"))
23 assert.is_false(run.luarocks_bool("--invalid-flag"))
24 assert.is_false(run.luarocks_bool("--server"))
25 assert.is_false(run.luarocks_bool("--server --porcelain"))
26 assert.is_false(run.luarocks_bool("--invalid-flag=abc"))
27 assert.is_false(run.luarocks_bool("invalid=5"))
28 end)
29
30 it("LuaRocks execute from not existing directory", function()
31 local main_path = lfs.currentdir()
32 assert.is_true(lfs.mkdir("idontexist"))
33 assert.is_true(lfs.chdir("idontexist"))
34 local delete_path = lfs.currentdir()
35 assert.is_true(os.remove(delete_path))
36
37 assert.is_false(run.luarocks_bool(" "))
38 assert.is_true(lfs.chdir(main_path))
39 assert.is_true(run.luarocks_bool(" "))
40 end)
41
42 it("LuaRocks timeout", function()
43 assert.is_true(run.luarocks_bool("--timeout=10"))
44 end)
45
46 it("LuaRocks timeout invalid", function()
47 assert.is_false(run.luarocks_bool("--timeout=abc"))
48 end)
49
50 it("LuaRocks only server=testing", function()
51 assert.is_true(run.luarocks_bool("--only-server=testing"))
52 end)
53
54 it("LuaRocks test site config", function()
55 assert.is.truthy(os.rename("src/luarocks/site_config.lua", "src/luarocks/site_config.lua.tmp"))
56 assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua"))
57 assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua.tmp"))
58
59 assert.is_true(run.luarocks_bool(""))
60
61 assert.is.truthy(os.rename("src/luarocks/site_config.lua.tmp", "src/luarocks/site_config.lua"))
62 assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua.tmp"))
63 assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua"))
64 end)
65
66 describe("LuaRocks sysconfig fails", function()
67 local scdir = ""
68
69 before_each(function()
70 scdir = testing_paths.testing_lrprefix .. "/etc/luarocks/"
71 lfs.mkdir(testing_paths.testing_lrprefix)
72 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/")
73 lfs.mkdir(scdir)
74 end)
75
76 after_each(function()
77 test_env.remove_dir(testing_paths.testing_lrprefix)
78 end)
79
80 it("LuaRocks sysconfig fail", function()
81 local sysconfig = io.open(scdir .. "/config.lua", "w+")
82 sysconfig:write("aoeui")
83 sysconfig:close()
84
85 assert.is_false(run.luarocks_bool("list"))
86 end)
87
88 it("LuaRocks sysconfig fail", function()
89 local sysconfig = io.open(scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua", "w+")
90 sysconfig:write("aoeui")
91 sysconfig:close()
92
93 assert.is_false(run.luarocks_bool("list"))
94 end)
95 end)
96end)
diff --git a/spec/write_rockspec_spec.lua b/spec/write_rockspec_spec.lua
new file mode 100644
index 00000000..85e345d5
--- /dev/null
+++ b/spec/write_rockspec_spec.lua
@@ -0,0 +1,73 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4
5test_env.unload_luarocks()
6
7describe("LuaRocks write_rockspec tests #blackbox #b_write_rockspec", function()
8
9 before_each(function()
10 test_env.setup_specs()
11 end)
12
13 describe("LuaRocks write_rockspec basic tests", function()
14 it("LuaRocks write_rockspec with no flags/arguments", function()
15 assert.is_true(run.luarocks_bool("write_rockspec"))
16 os.remove("luarocks-scm-1.rockspec")
17 end)
18
19 it("LuaRocks write_rockspec with invalid argument", function()
20 assert.is_false(run.luarocks_bool("write_rockspec invalid"))
21 end)
22
23 it("LuaRocks write_rockspec invalid zip", function()
24 assert.is_false(run.luarocks_bool("write_rockspec http://example.com/invalid.zip"))
25 end)
26 end)
27
28 describe("LuaRocks write_rockspec more complex tests", function()
29 it("LuaRocks write_rockspec git luarocks", function()
30 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/keplerproject/luarocks"))
31 assert.is.truthy(lfs.attributes("luarocks-scm-1.rockspec"))
32 assert.is_true(os.remove("luarocks-scm-1.rockspec"))
33 end)
34
35 it("LuaRocks write_rockspec git luarocks --tag=v2.3.0", function()
36 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/keplerproject/luarocks --tag=v2.3.0"))
37 assert.is.truthy(lfs.attributes("luarocks-2.3.0-1.rockspec"))
38 assert.is_true(os.remove("luarocks-2.3.0-1.rockspec"))
39 end)
40
41 it("LuaRocks write_rockspec git luarocks with format flag", function()
42 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/mbalmer/luarocks --rockspec-format=1.1 --lua-version=5.1,5.2"))
43 assert.is.truthy(lfs.attributes("luarocks-scm-1.rockspec"))
44 assert.is_true(os.remove("luarocks-scm-1.rockspec"))
45 end)
46
47 it("LuaRocks write_rockspec git luarocks with full flags", function()
48 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/mbalmer/luarocks --lua-version=5.1,5.2 --license=\"MIT/X11\" "
49 .. " --homepage=\"http://www.luarocks.org\" --summary=\"A package manager for Lua modules\" "))
50 assert.is.truthy(lfs.attributes("luarocks-scm-1.rockspec"))
51 assert.is_true(os.remove("luarocks-scm-1.rockspec"))
52 end)
53
54 it("LuaRocks write_rockspec rockspec via http", function()
55 assert.is_true(run.luarocks_bool("write_rockspec http://luarocks.org/releases/luarocks-2.1.0.tar.gz --lua-version=5.1"))
56 assert.is.truthy(lfs.attributes("luarocks-2.1.0-1.rockspec"))
57 assert.is_true(os.remove("luarocks-2.1.0-1.rockspec"))
58 end)
59
60 it("LuaRocks write_rockspec base dir, luassert.tar.gz via https", function()
61 assert.is_true(run.luarocks_bool("write_rockspec https://github.com/downloads/Olivine-Labs/luassert/luassert-1.2.tar.gz --lua-version=5.1"))
62 assert.is.truthy(lfs.attributes("luassert-1.2-1.rockspec"))
63 assert.is_true(os.remove("luassert-1.2-1.rockspec"))
64 end)
65
66 it("LuaRocks write_rockspec git luafcgi with many flags", function()
67 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license=\"3-clause BSD\" "
68 .. "--lua-version=5.1,5.2"))
69 assert.is.truthy(lfs.attributes("luafcgi-scm-1.rockspec")) -- TODO maybe read it content and find arguments from flags?
70 assert.is_true(os.remove("luafcgi-scm-1.rockspec"))
71 end)
72 end)
73end)