aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-10-04 11:14:42 -0300
committerGitHub <noreply@github.com>2017-10-04 11:14:42 -0300
commit84b4fe99cac37850a97858e0b641043bd3178d8a (patch)
treeb4578689091b8360aed71f531faf2513b7d41684 /spec
parent100c18d048936b5a47f29f55e6ce8b24277fb70f (diff)
downloadluarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.tar.gz
luarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.tar.bz2
luarocks-84b4fe99cac37850a97858e0b641043bd3178d8a.zip
Use versioned files only. (#734)
Let's take the opportunity of a new major version to make an important cleanup: getting rid of the error-prone unversioned configuration files. This drops support for: * Unversioned config.lua -> use config-5.x.lua * Unversioned luarocks/site_config.lua -> it always generates luarocks/core/site_config_5_x.lua * Unversioned lib/luarocks/rocks -> it always uses lib/luarocks/rocks-5.x
Diffstat (limited to 'spec')
-rw-r--r--spec/build_spec.lua40
-rw-r--r--spec/config_spec.lua12
-rw-r--r--spec/deps_spec.lua64
-rw-r--r--spec/doc_spec.lua6
-rw-r--r--spec/install_spec.lua12
-rw-r--r--spec/list_spec.lua3
-rw-r--r--spec/make_spec.lua10
-rw-r--r--spec/remove_spec.lua20
-rw-r--r--spec/util_spec.lua63
9 files changed, 87 insertions, 143 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua
index 2ff7cbe6..ffae144d 100644
--- a/spec/build_spec.lua
+++ b/spec/build_spec.lua
@@ -63,22 +63,22 @@ describe("LuaRocks build tests #blackbox #b_build", function()
63 63
64 it("LuaRocks build lpeg branch=master", function() 64 it("LuaRocks build lpeg branch=master", function()
65 assert.is_true(run.luarocks_bool("build --branch=master lpeg")) 65 assert.is_true(run.luarocks_bool("build --branch=master lpeg"))
66 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 66 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
67 end) 67 end)
68 68
69 it("LuaRocks build lpeg deps-mode=123", function() 69 it("LuaRocks build lpeg deps-mode=123", function()
70 assert.is_false(run.luarocks_bool("build --deps-mode=123 lpeg --verbose")) 70 assert.is_false(run.luarocks_bool("build --deps-mode=123 lpeg --verbose"))
71 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 71 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
72 end) 72 end)
73 73
74 it("LuaRocks build lpeg only-sources example", function() 74 it("LuaRocks build lpeg only-sources example", function()
75 assert.is_true(run.luarocks_bool("download --rockspec lpeg")) 75 assert.is_true(run.luarocks_bool("download --rockspec lpeg"))
76 assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.rockspec")) 76 assert.is_false(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.rockspec"))
77 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 77 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
78 78
79 assert.is_true(run.luarocks_bool("download --source lpeg")) 79 assert.is_true(run.luarocks_bool("download --source lpeg"))
80 assert.is_true(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.src.rock")) 80 assert.is_true(run.luarocks_bool("build --only-sources=\"http://example.com\" lpeg-1.0.0-1.src.rock"))
81 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 81 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
82 82
83 assert.is_true(os.remove("lpeg-1.0.0-1.rockspec")) 83 assert.is_true(os.remove("lpeg-1.0.0-1.rockspec"))
84 assert.is_true(os.remove("lpeg-1.0.0-1.src.rock")) 84 assert.is_true(os.remove("lpeg-1.0.0-1.src.rock"))
@@ -86,7 +86,7 @@ describe("LuaRocks build tests #blackbox #b_build", function()
86 86
87 it("LuaRocks build lpeg with empty tree", function() 87 it("LuaRocks build lpeg with empty tree", function()
88 assert.is_false(run.luarocks_bool("build --tree=\"\" lpeg")) 88 assert.is_false(run.luarocks_bool("build --tree=\"\" lpeg"))
89 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 89 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
90 end) 90 end)
91 end) 91 end)
92 92
@@ -97,17 +97,17 @@ describe("LuaRocks build tests #blackbox #b_build", function()
97 97
98 it("LuaRocks build luacov diff version", function() 98 it("LuaRocks build luacov diff version", function()
99 assert.is_true(run.luarocks_bool("build luacov 0.11.0-1")) 99 assert.is_true(run.luarocks_bool("build luacov 0.11.0-1"))
100 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luacov/0.11.0-1/luacov-0.11.0-1.rockspec")) 100 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luacov/0.11.0-1/luacov-0.11.0-1.rockspec"))
101 end) 101 end)
102 102
103 it("LuaRocks build command stdlib", function() 103 it("LuaRocks build command stdlib", function()
104 assert.is_true(run.luarocks_bool("build stdlib")) 104 assert.is_true(run.luarocks_bool("build stdlib"))
105 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec")) 105 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/stdlib/41.0.0-1/stdlib-41.0.0-1.rockspec"))
106 end) 106 end)
107 107
108 it("LuaRocks build install bin luarepl", function() 108 it("LuaRocks build install bin luarepl", function()
109 assert.is_true(run.luarocks_bool("build luarepl")) 109 assert.is_true(run.luarocks_bool("build luarepl"))
110 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/luarepl-0.4-1.rockspec")) 110 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luarepl/0.4-1/luarepl-0.4-1.rockspec"))
111 end) 111 end)
112 112
113 it("LuaRocks build supported platforms lpty", function() 113 it("LuaRocks build supported platforms lpty", function()
@@ -115,24 +115,24 @@ describe("LuaRocks build tests #blackbox #b_build", function()
115 assert.is_false(run.luarocks_bool("build lpty")) --Error: This rockspec for lpty does not support win32, windows platforms 115 assert.is_false(run.luarocks_bool("build lpty")) --Error: This rockspec for lpty does not support win32, windows platforms
116 else 116 else
117 assert.is_true(run.luarocks_bool("build lpty")) 117 assert.is_true(run.luarocks_bool("build lpty"))
118 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpty/1.0.1-1/lpty-1.0.1-1.rockspec")) 118 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpty/1.0.1-1/lpty-1.0.1-1.rockspec"))
119 end 119 end
120 end) 120 end)
121 121
122 it("LuaRocks build luasec with skipping dependency checks", function() 122 it("LuaRocks build luasec with skipping dependency checks", function()
123 assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) 123 assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --nodeps"))
124 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) 124 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec"))
125 end) 125 end)
126 126
127 it("LuaRocks build lmathx deps partial match", function() 127 it("LuaRocks build lmathx deps partial match", function()
128 assert.is_true(run.luarocks_bool("build lmathx")) 128 assert.is_true(run.luarocks_bool("build lmathx"))
129 129
130 if test_env.LUA_V == "5.1" or test_env.LUAJIT_V then 130 if test_env.LUA_V == "5.1" or test_env.LUAJIT_V then
131 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20120430.51-1/lmathx-20120430.51-1.rockspec")) 131 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20120430.51-1/lmathx-20120430.51-1.rockspec"))
132 elseif test_env.LUA_V == "5.2" then 132 elseif test_env.LUA_V == "5.2" then
133 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20120430.52-1/lmathx-20120430.52-1.rockspec")) 133 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20120430.52-1/lmathx-20120430.52-1.rockspec"))
134 elseif test_env.LUA_V == "5.3" then 134 elseif test_env.LUA_V == "5.3" then
135 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20150505-1/lmathx-20150505-1.rockspec")) 135 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lmathx/20150505-1/lmathx-20150505-1.rockspec"))
136 end 136 end
137 end) 137 end)
138 end) 138 end)
@@ -148,15 +148,15 @@ describe("LuaRocks build tests #blackbox #b_build", function()
148 it("LuaRocks build luasec only deps", function() 148 it("LuaRocks build luasec only deps", function()
149 assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps")) 149 assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps"))
150 assert.is_false(run.luarocks_bool("show luasec")) 150 assert.is_false(run.luarocks_bool("show luasec"))
151 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) 151 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec/0.6-1/luasec-0.6-1.rockspec"))
152 end) 152 end)
153 153
154 it("LuaRocks build only deps of downloaded rockspec of lxsh", function() 154 it("LuaRocks build only deps of downloaded rockspec of lxsh", function()
155 assert.is_true(run.luarocks_bool("download --rockspec lxsh 0.8.6-2")) 155 assert.is_true(run.luarocks_bool("download --rockspec lxsh 0.8.6-2"))
156 assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.rockspec --only-deps")) 156 assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.rockspec --only-deps"))
157 assert.is_false(run.luarocks_bool("show lxsh")) 157 assert.is_false(run.luarocks_bool("show lxsh"))
158 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 158 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
159 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 159 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
160 assert.is_true(os.remove("lxsh-0.8.6-2.rockspec")) 160 assert.is_true(os.remove("lxsh-0.8.6-2.rockspec"))
161 end) 161 end)
162 162
@@ -164,8 +164,8 @@ describe("LuaRocks build tests #blackbox #b_build", function()
164 assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2")) 164 assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2"))
165 assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.src.rock --only-deps")) 165 assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.src.rock --only-deps"))
166 assert.is_false(run.luarocks_bool("show lxsh")) 166 assert.is_false(run.luarocks_bool("show lxsh"))
167 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 167 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
168 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 168 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
169 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) 169 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
170 end) 170 end)
171 171
@@ -174,7 +174,7 @@ describe("LuaRocks build tests #blackbox #b_build", function()
174 assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) 174 assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec"))
175 175
176 assert.is.truthy(run.luarocks("show validate-args")) 176 assert.is.truthy(run.luarocks("show validate-args"))
177 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) 177 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec"))
178 178
179 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) 179 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec"))
180 end) 180 end)
@@ -185,7 +185,7 @@ describe("LuaRocks build tests #blackbox #b_build", function()
185 185
186 assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) 186 assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec"))
187 assert.is.truthy(run.luarocks("show validate-args")) 187 assert.is.truthy(run.luarocks("show validate-args"))
188 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) 188 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec"))
189 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) 189 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec"))
190 end) 190 end)
191 191
diff --git a/spec/config_spec.lua b/spec/config_spec.lua
index cdb5ccc4..6be586c2 100644
--- a/spec/config_spec.lua
+++ b/spec/config_spec.lua
@@ -12,7 +12,7 @@ describe("LuaRocks config tests #blackbox #b_config", function()
12 before_each(function() 12 before_each(function()
13 test_env.setup_specs() 13 test_env.setup_specs()
14 test_env.unload_luarocks() -- need to be required here, because site_config is created after first loading of specs 14 test_env.unload_luarocks() -- need to be required here, because site_config is created after first loading of specs
15 site_config = require("luarocks.site_config") 15 site_config = require("luarocks.core.site_config_" .. test_env.lua_version:gsub("%.", "_"))
16 end) 16 end)
17 17
18 describe("LuaRocks config - basic tests", function() 18 describe("LuaRocks config - basic tests", function()
@@ -64,15 +64,7 @@ describe("LuaRocks config tests #blackbox #b_config", function()
64 64
65 describe("LuaRocks config - more complex tests", function() 65 describe("LuaRocks config - more complex tests", function()
66 local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" 66 local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks"
67 local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" 67 local configfile = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua"
68 local scname = scdir .. "/config.lua"
69
70 local configfile
71 if test_env.TEST_TARGET_OS == "windows" then
72 configfile = versioned_scname
73 else
74 configfile = scname
75 end
76 68
77 it("LuaRocks fail system config", function() 69 it("LuaRocks fail system config", function()
78 os.rename(configfile, configfile .. ".bak") 70 os.rename(configfile, configfile .. ".bak")
diff --git a/spec/deps_spec.lua b/spec/deps_spec.lua
index e453c9a1..8c4effcd 100644
--- a/spec/deps_spec.lua
+++ b/spec/deps_spec.lua
@@ -23,59 +23,59 @@ describe("LuaRocks deps tests #blackbox #b_deps", function()
23 assert.is_true(run.luarocks_bool("build --tree=system lpeg")) 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")) 24 assert.is_true(run.luarocks_bool("build --deps-mode=one --tree=" .. testing_paths.testing_tree .. " lxsh"))
25 25
26 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 26 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
27 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 27 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
28 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 28 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
29 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 29 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
30 end) 30 end)
31 31
32 it("LuaRocks deps mode order", function() 32 it("LuaRocks deps mode order", function()
33 assert.is_true(run.luarocks_bool("build --tree=system lpeg")) 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")) 34 assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_tree .. " lxsh"))
35 35
36 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 36 assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
37 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 37 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
38 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 38 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
39 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 39 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
40 end) 40 end)
41 41
42 it("LuaRocks deps mode order sys", function() 42 it("LuaRocks deps mode order sys", function()
43 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) 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")) 44 assert.is_true(run.luarocks_bool("build --deps-mode=order --tree=" .. testing_paths.testing_sys_tree .. " lxsh"))
45 45
46 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 46 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
47 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 47 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
48 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 48 assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
49 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 49 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
50 end) 50 end)
51 51
52 it("LuaRocks deps mode all sys", function() 52 it("LuaRocks deps mode all sys", function()
53 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) 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")) 54 assert.is_true(run.luarocks_bool("build --deps-mode=all --tree=" .. testing_paths.testing_sys_tree .. " lxsh"))
55 55
56 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 56 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
57 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 57 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
58 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 58 assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
59 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 59 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
60 end) 60 end)
61 61
62 it("LuaRocks deps mode none", function() 62 it("LuaRocks deps mode none", function()
63 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " lpeg")) 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")) 64 assert.is_true(run.luarocks_bool("build --deps-mode=none lxsh"))
65 65
66 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 66 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
67 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 67 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
68 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 68 assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
69 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 69 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
70 end) 70 end)
71 71
72 it("LuaRocks nodeps alias", function() 72 it("LuaRocks nodeps alias", function()
73 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " --nodeps lxsh")) 73 assert.is_true(run.luarocks_bool("build --tree=" .. testing_paths.testing_tree .. " --nodeps lxsh"))
74 74
75 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 75 assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
76 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 76 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
77 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 77 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
78 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 78 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
79 end) 79 end)
80 80
81 it("LuaRocks deps mode make order", function() 81 it("LuaRocks deps mode make order", function()
@@ -89,10 +89,10 @@ describe("LuaRocks deps tests #blackbox #b_deps", function()
89 test_env.remove_dir("lxsh-0.8.6-2") 89 test_env.remove_dir("lxsh-0.8.6-2")
90 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) 90 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
91 91
92 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 92 assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
93 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 93 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
94 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 94 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
95 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 95 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
96 end) 96 end)
97 97
98 it("LuaRocks deps mode make order sys", function() 98 it("LuaRocks deps mode make order sys", function()
@@ -106,9 +106,9 @@ describe("LuaRocks deps tests #blackbox #b_deps", function()
106 test_env.remove_dir("lxsh-0.8.6-2") 106 test_env.remove_dir("lxsh-0.8.6-2")
107 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) 107 assert.is_true(os.remove("lxsh-0.8.6-2.src.rock"))
108 108
109 assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 109 assert.is.truthy(lfs.attributes(testing_paths.testing_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
110 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec")) 110 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lpeg/1.0.0-1/lpeg-1.0.0-1.rockspec"))
111 assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 111 assert.is.falsy(lfs.attributes(testing_paths.testing_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
112 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 112 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
113 end) 113 end)
114end) 114end)
diff --git a/spec/doc_spec.lua b/spec/doc_spec.lua
index a04d3c14..ea42cd6b 100644
--- a/spec/doc_spec.lua
+++ b/spec/doc_spec.lua
@@ -28,12 +28,12 @@ describe("LuaRocks doc tests #blackbox #b_doc", function()
28 end) 28 end)
29 it("LuaRocks doc with no home page and no doc folder", function() 29 it("LuaRocks doc with no home page and no doc folder", function()
30 assert.is_true(run.luarocks_bool("install c3")) 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") 31 test_env.remove_dir(testing_paths.testing_sys_rocks .. "/c3/1.0-1/doc")
32 assert.is_false(run.luarocks_bool("doc c3")) 32 assert.is_false(run.luarocks_bool("doc c3"))
33 end) 33 end)
34 it("LuaRocks doc with no doc folder opening descript.homepage", function() 34 it("LuaRocks doc with no doc folder opening descript.homepage", function()
35 assert.is_true(run.luarocks_bool("install luarepl")) 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") 36 test_env.remove_dir(testing_paths.testing_sys_rocks .. "/luarepl/0.4-1/doc")
37 local output = run.luarocks("doc luarepl") 37 local output = run.luarocks("doc luarepl")
38 assert.is.truthy(output:find("Local documentation directory not found")) 38 assert.is.truthy(output:find("Local documentation directory not found"))
39 end) 39 end)
@@ -53,7 +53,7 @@ describe("LuaRocks doc tests #blackbox #b_doc", function()
53 it("LuaRocks doc of luacov and list doc folder", function() 53 it("LuaRocks doc of luacov and list doc folder", function()
54 assert.is_true(run.luarocks_bool("install luacov")) 54 assert.is_true(run.luarocks_bool("install luacov"))
55 local output = assert.is.truthy(run.luarocks("doc luacov --list")) 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/")) 56 assert.is.truthy(output:find("/lib/luarocks/rocks%-.*/luacov/0.11.0%-1/doc/", 1))
57 end) 57 end)
58 58
59 it("LuaRocks doc of luacov local", function() 59 it("LuaRocks doc of luacov local", function()
diff --git a/spec/install_spec.lua b/spec/install_spec.lua
index 74f8f493..92b780d3 100644
--- a/spec/install_spec.lua
+++ b/spec/install_spec.lua
@@ -83,9 +83,9 @@ describe("LuaRocks install tests #blackbox #b_install", function()
83 assert.is_true(run.luarocks_bool("show luasec")) 83 assert.is_true(run.luarocks_bool("show luasec"))
84 if env_variables.TYPE_TEST_ENV == "minimal" then 84 if env_variables.TYPE_TEST_ENV == "minimal" then
85 assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) 85 assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket")))
86 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) 86 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket"))
87 end 87 end
88 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) 88 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasec"))
89 end) 89 end)
90 90
91 it('LuaRocks install - handle relative path in --tree #632', function() 91 it('LuaRocks install - handle relative path in --tree #632', function()
@@ -170,22 +170,22 @@ describe("LuaRocks install tests #blackbox #b_install", function()
170 assert.is_true(run.luarocks_bool("install say 1.2")) 170 assert.is_true(run.luarocks_bool("install say 1.2"))
171 assert.is_true(run.luarocks_bool("install luassert")) 171 assert.is_true(run.luarocks_bool("install luassert"))
172 assert.is_true(run.luarocks_bool("install say 1.0")) 172 assert.is_true(run.luarocks_bool("install say 1.0"))
173 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) 173 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1"))
174 end) 174 end)
175 it("LuaRocks install break dependencies force", function() 175 it("LuaRocks install break dependencies force", function()
176 assert.is_true(run.luarocks_bool("install say 1.2")) 176 assert.is_true(run.luarocks_bool("install say 1.2"))
177 assert.is_true(run.luarocks_bool("install luassert")) 177 assert.is_true(run.luarocks_bool("install luassert"))
178 local output = run.luarocks("install --force say 1.0") 178 local output = run.luarocks("install --force say 1.0")
179 assert.is.truthy(output:find("Checking stability of dependencies")) 179 assert.is.truthy(output:find("Checking stability of dependencies"))
180 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) 180 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1"))
181 end) 181 end)
182 it("LuaRocks install break dependencies force fast", function() 182 it("LuaRocks install break dependencies force fast", function()
183 assert.is_true(run.luarocks_bool("install say 1.2")) 183 assert.is_true(run.luarocks_bool("install say 1.2"))
184 assert.is_true(run.luarocks_bool("install luassert")) 184 assert.is_true(run.luarocks_bool("install luassert"))
185 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.2-1")) 185 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1"))
186 local output = run.luarocks("install --force-fast say 1.0") 186 local output = run.luarocks("install --force-fast say 1.0")
187 assert.is.falsy(output:find("Checking stability of dependencies")) 187 assert.is.falsy(output:find("Checking stability of dependencies"))
188 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/say/1.0-1")) 188 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.0-1"))
189 end) 189 end)
190 end) 190 end)
191end) 191end)
diff --git a/spec/list_spec.lua b/spec/list_spec.lua
index 1b082ab6..b9a8e4c4 100644
--- a/spec/list_spec.lua
+++ b/spec/list_spec.lua
@@ -22,8 +22,7 @@ describe("LuaRocks list tests #blackbox #b_list", function()
22 22
23 it("LuaRocks list porcelain", function() 23 it("LuaRocks list porcelain", function()
24 local output = run.luarocks("list --porcelain") 24 local output = run.luarocks("list --porcelain")
25 local path = testing_paths.testing_sys_tree:gsub("-", "--") -- !not sure! why this is good 25 assert.is.truthy(output:find("luacov\t0.11.0-1\tinstalled\t" .. testing_paths.testing_sys_rocks, 1, true))
26 assert.is.truthy(output:find("luacov\t0.11.0--1\tinstalled\t" .. path .. "/lib/luarocks/rocks" ))
27 end) 26 end)
28 27
29 it("LuaRocks install outdated and list it", function() 28 it("LuaRocks install outdated and list it", function()
diff --git a/spec/make_spec.lua b/spec/make_spec.lua
index ab2d49a3..4c406c68 100644
--- a/spec/make_spec.lua
+++ b/spec/make_spec.lua
@@ -35,7 +35,7 @@ describe("LuaRocks make tests #blackbox #b_make", function()
35 35
36 -- test it 36 -- test it
37 assert.is_true(run.luarocks_bool("show luasocket")) 37 assert.is_true(run.luarocks_bool("show luasocket"))
38 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) 38 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec"))
39 39
40 -- delete downloaded and unpacked files 40 -- delete downloaded and unpacked files
41 lfs.chdir(testing_paths.luarocks_dir) 41 lfs.chdir(testing_paths.luarocks_dir)
@@ -63,7 +63,7 @@ describe("LuaRocks make tests #blackbox #b_make", function()
63 assert.is_true(run.luarocks_bool("make")) 63 assert.is_true(run.luarocks_bool("make"))
64 64
65 assert.is_true(run.luarocks_bool("show lxsh")) 65 assert.is_true(run.luarocks_bool("show lxsh"))
66 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec")) 66 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec"))
67 end) 67 end)
68 68
69 it("LuaRocks make unnamed rockspec", function() 69 it("LuaRocks make unnamed rockspec", function()
@@ -71,7 +71,7 @@ describe("LuaRocks make tests #blackbox #b_make", function()
71 assert.is_true(run.luarocks_bool("make")) 71 assert.is_true(run.luarocks_bool("make"))
72 72
73 assert.is_true(run.luarocks_bool("show lxsh")) 73 assert.is_true(run.luarocks_bool("show lxsh"))
74 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 74 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
75 os.remove("rockspec") 75 os.remove("rockspec")
76 end) 76 end)
77 77
@@ -81,7 +81,7 @@ describe("LuaRocks make tests #blackbox #b_make", function()
81 assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) 81 assert.is.truthy(output:match("Error: Inconsistency between rockspec filename"))
82 82
83 assert.is_false(run.luarocks_bool("show lxsh")) 83 assert.is_false(run.luarocks_bool("show lxsh"))
84 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 84 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
85 end) 85 end)
86 86
87 it("LuaRocks make ambiguous unnamed rockspec", function() 87 it("LuaRocks make ambiguous unnamed rockspec", function()
@@ -91,7 +91,7 @@ describe("LuaRocks make tests #blackbox #b_make", function()
91 assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) 91 assert.is.truthy(output:match("Error: Please specify which rockspec file to use"))
92 92
93 assert.is_false(run.luarocks_bool("show lxsh")) 93 assert.is_false(run.luarocks_bool("show lxsh"))
94 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) 94 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec"))
95 end) 95 end)
96 96
97 it("LuaRocks make pack binary rock", function() 97 it("LuaRocks make pack binary rock", function()
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua
index 03b3681e..4d3f5cdc 100644
--- a/spec/remove_spec.lua
+++ b/spec/remove_spec.lua
@@ -37,16 +37,16 @@ describe("LuaRocks remove tests #blackbox #b_remove", function()
37 37
38 it("LuaRocks remove built abelhas", function() 38 it("LuaRocks remove built abelhas", function()
39 assert.is_true(run.luarocks_bool("build abelhas 1.0")) 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")) 40 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas"))
41 assert.is_true(run.luarocks_bool("remove abelhas 1.0")) 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")) 42 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas"))
43 end) 43 end)
44 44
45 it("LuaRocks remove built abelhas with uppercase name", function() 45 it("LuaRocks remove built abelhas with uppercase name", function()
46 assert.is_true(run.luarocks_bool("build abelhas 1.0")) 46 assert.is_true(run.luarocks_bool("build abelhas 1.0"))
47 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) 47 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas"))
48 assert.is_true(run.luarocks_bool("remove Abelhas 1.0")) 48 assert.is_true(run.luarocks_bool("remove Abelhas 1.0"))
49 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/abelhas")) 49 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/abelhas"))
50 end) 50 end)
51 end) 51 end)
52 52
@@ -56,28 +56,28 @@ describe("LuaRocks remove tests #blackbox #b_remove", function()
56 end) 56 end)
57 57
58 it("LuaRocks remove fail, break dependencies", function() 58 it("LuaRocks remove fail, break dependencies", function()
59 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) 59 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket"))
60 assert.is_true(run.luarocks_bool("build lualogging")) 60 assert.is_true(run.luarocks_bool("build lualogging"))
61 61
62 assert.is_false(run.luarocks_bool("remove luasocket")) 62 assert.is_false(run.luarocks_bool("remove luasocket"))
63 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) 63 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket"))
64 end) 64 end)
65 65
66 it("LuaRocks remove force", function() 66 it("LuaRocks remove force", function()
67 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) 67 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket"))
68 assert.is_true(run.luarocks_bool("build lualogging")) 68 assert.is_true(run.luarocks_bool("build lualogging"))
69 69
70 local output = run.luarocks("remove --force luasocket") 70 local output = run.luarocks("remove --force luasocket")
71 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) 71 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket"))
72 assert.is.truthy(output:find("Checking stability of dependencies")) 72 assert.is.truthy(output:find("Checking stability of dependencies"))
73 end) 73 end)
74 74
75 it("LuaRocks remove force fast", function() 75 it("LuaRocks remove force fast", function()
76 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) 76 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket"))
77 assert.is_true(run.luarocks_bool("build lualogging")) 77 assert.is_true(run.luarocks_bool("build lualogging"))
78 78
79 local output = run.luarocks("remove --force-fast luasocket") 79 local output = run.luarocks("remove --force-fast luasocket")
80 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) 80 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket"))
81 assert.is.falsy(output:find("Checking stability of dependencies")) 81 assert.is.falsy(output:find("Checking stability of dependencies"))
82 end) 82 end)
83 end) 83 end)
diff --git a/spec/util_spec.lua b/spec/util_spec.lua
index 988d8ef0..25cc51d8 100644
--- a/spec/util_spec.lua
+++ b/spec/util_spec.lua
@@ -55,66 +55,19 @@ describe("Basic tests #blackbox #b_util", function()
55 end) 55 end)
56 56
57 it("LuaRocks test site config", function() 57 it("LuaRocks test site config", function()
58 assert.is.truthy(os.rename("src/luarocks/site_config.lua", "src/luarocks/site_config.lua.tmp")) 58 local scname = "src/luarocks/core/site_config_"..test_env.lua_version:gsub("%.", "_")..".lua"
59 assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua")) 59
60 assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua.tmp")) 60 assert.is.truthy(os.rename(scname, scname..".tmp"))
61 assert.is.falsy(lfs.attributes(scname))
62 assert.is.truthy(lfs.attributes(scname..".tmp"))
61 63
62 assert.is.truthy(run.luarocks("")) 64 assert.is.truthy(run.luarocks(""))
63 65
64 assert.is.truthy(os.rename("src/luarocks/site_config.lua.tmp", "src/luarocks/site_config.lua")) 66 assert.is.truthy(os.rename(scname..".tmp", scname))
65 assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua.tmp")) 67 assert.is.falsy(lfs.attributes(scname..".tmp"))
66 assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua")) 68 assert.is.truthy(lfs.attributes(scname))
67 end) 69 end)
68 70
69 -- Disable versioned config temporarily, because it always takes
70 -- precedence over config.lua (config-5.x.lua is installed by default on Windows,
71 -- but not on Unix, so on Unix the os.rename commands below will fail silently, but this is harmless)
72 describe("LuaRocks config - more complex tests", function()
73 local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks"
74 local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua"
75 local scname = scdir .. "/config.lua"
76
77 local configfile
78 if test_env.TEST_TARGET_OS == "windows" then
79 configfile = versioned_scname
80 else
81 configfile = scname
82 end
83
84 it("LuaRocks fail system config", function()
85 os.rename(versioned_scname, versioned_scname .. "bak")
86 local ok = run.luarocks_bool("config --system-config")
87 os.rename(versioned_scname .. ".bak", versioned_scname)
88 assert.is_false(ok)
89 end)
90
91 it("LuaRocks system config", function()
92 lfs.mkdir(testing_paths.testing_lrprefix)
93 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/")
94 lfs.mkdir(scdir)
95
96 local sysconfig = io.open(configfile, "w+")
97 sysconfig:write(" ")
98 sysconfig:close()
99
100 local output = run.luarocks("config --system-config")
101 os.remove(configfile)
102 assert.are.same(output, configfile)
103 end)
104
105 it("LuaRocks fail system config invalid", function()
106 lfs.mkdir(testing_paths.testing_lrprefix)
107 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/")
108 lfs.mkdir(scdir)
109
110 local sysconfig = io.open(configfile, "w+")
111 sysconfig:write("if if if")
112 sysconfig:close()
113 local ok = run.luarocks_bool("config --system-config")
114 os.remove(configfile)
115 assert.is_false(ok)
116 end)
117 end)
118end) 71end)
119 72
120test_env.unload_luarocks() 73test_env.unload_luarocks()