diff options
author | Hisham <hisham@gobolinux.org> | 2016-10-14 16:38:51 -0700 |
---|---|---|
committer | Hisham <hisham@gobolinux.org> | 2016-10-14 16:38:51 -0700 |
commit | 075196e8b5d315888a8ae110fa9a18089044ae3b (patch) | |
tree | eca3eb78c23f8d85dbe625564a2d66966d6281f1 /spec | |
parent | dbca97cdcc15e386554b2631a0ae7aca02500abf (diff) | |
parent | 1fea0e3a0972bcc6b4319cd3d9e79834562486bc (diff) | |
download | luarocks-075196e8b5d315888a8ae110fa9a18089044ae3b.tar.gz luarocks-075196e8b5d315888a8ae110fa9a18089044ae3b.tar.bz2 luarocks-075196e8b5d315888a8ae110fa9a18089044ae3b.zip |
Merge branch 'master' into luarocks-3
Diffstat (limited to 'spec')
-rw-r--r-- | spec/add_spec.lua | 16 | ||||
-rw-r--r-- | spec/build_spec.lua | 79 | ||||
-rw-r--r-- | spec/config_spec.lua | 70 | ||||
-rw-r--r-- | spec/deps_spec.lua | 70 | ||||
-rw-r--r-- | spec/help_spec.lua | 4 | ||||
-rw-r--r-- | spec/install_spec.lua | 32 | ||||
-rw-r--r-- | spec/make_manifest_spec.lua | 2 | ||||
-rw-r--r-- | spec/make_spec.lua | 49 | ||||
-rw-r--r-- | spec/pack_spec.lua | 22 | ||||
-rw-r--r-- | spec/refresh_cache_spec.lua | 2 | ||||
-rw-r--r-- | spec/remove_spec.lua | 6 | ||||
-rw-r--r-- | spec/search_spec.lua | 3 | ||||
-rw-r--r-- | spec/show_spec.lua | 6 | ||||
-rw-r--r-- | spec/unpack_spec.lua | 12 | ||||
-rw-r--r-- | spec/upload_spec.lua | 6 | ||||
-rw-r--r-- | spec/util_spec.lua | 111 |
16 files changed, 314 insertions, 176 deletions
diff --git a/spec/add_spec.lua b/spec/add_spec.lua index dca6f850..d42a97d0 100644 --- a/spec/add_spec.lua +++ b/spec/add_spec.lua | |||
@@ -5,8 +5,8 @@ local testing_paths = test_env.testing_paths | |||
5 | test_env.unload_luarocks() | 5 | test_env.unload_luarocks() |
6 | 6 | ||
7 | local extra_rocks = { | 7 | local extra_rocks = { |
8 | "/luasocket-3.0rc1-1.src.rock", | 8 | "/luasocket-3.0rc1-2.src.rock", |
9 | "/luasocket-3.0rc1-1.rockspec" | 9 | "/luasocket-3.0rc1-2.rockspec" |
10 | } | 10 | } |
11 | 11 | ||
12 | describe("LuaRocks add tests #blackbox #b_add", function() | 12 | describe("LuaRocks add tests #blackbox #b_add", function() |
@@ -25,20 +25,20 @@ describe("LuaRocks add tests #blackbox #b_add", function() | |||
25 | end) | 25 | end) |
26 | 26 | ||
27 | it("LuaRocks-admin add invalid server", function() | 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")) | 28 | assert.is_false(run.luarocks_admin_bool("--server=invalid add " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.src.rock")) |
29 | end) | 29 | end) |
30 | 30 | ||
31 | it("LuaRocks-admin add invalid server #ssh", function() | 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")) | 32 | assert.is_true(run.luarocks_admin_bool("--server=testing add " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.src.rock")) |
33 | end) | 33 | end) |
34 | 34 | ||
35 | --TODO This test fails, sftp not implemented | 35 | --TODO This test fails, sftp support not yet implemented |
36 | it("LuaRocks-admin add invalid server", function() --? | 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" } )) | 37 | assert.is_false(run.luarocks_admin_bool("--server=testing add luasocket-3.0rc1-2.src.rock", { LUAROCKS_CONFIG = testing_paths.testing_dir .. "/testing_config_sftp.lua" } )) |
38 | end) | 38 | end) |
39 | 39 | ||
40 | it("LuaRocks-admin add, split server url", function() | 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")) | 41 | assert.is_false(run.luarocks_admin_bool("--server=\"localhost@/tmp/luarocks_testing\" add " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.src.rock")) |
42 | end) | 42 | end) |
43 | end) | 43 | end) |
44 | end) | 44 | end) |
diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 2ede5211..2ff7cbe6 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua | |||
@@ -12,15 +12,16 @@ local extra_rocks = { | |||
12 | "/lmathx-20120430.52-1.rockspec", | 12 | "/lmathx-20120430.52-1.rockspec", |
13 | "/lmathx-20150505-1.src.rock", | 13 | "/lmathx-20150505-1.src.rock", |
14 | "/lmathx-20150505-1.rockspec", | 14 | "/lmathx-20150505-1.rockspec", |
15 | "/lpeg-0.12-1.src.rock", | 15 | "/lpeg-1.0.0-1.rockspec", |
16 | "/lpeg-1.0.0-1.src.rock", | ||
16 | "/lpty-1.0.1-1.src.rock", | 17 | "/lpty-1.0.1-1.src.rock", |
17 | "/luadoc-3.0.1-1.src.rock", | 18 | "/luadoc-3.0.1-1.src.rock", |
18 | "/luafilesystem-1.6.3-1.src.rock", | 19 | "/luafilesystem-1.6.3-1.src.rock", |
19 | "/lualogging-1.3.0-1.src.rock", | 20 | "/lualogging-1.3.0-1.src.rock", |
20 | "/luarepl-0.4-1.src.rock", | 21 | "/luarepl-0.4-1.src.rock", |
21 | "/luasec-0.6-1.rockspec", | 22 | "/luasec-0.6-1.rockspec", |
22 | "/luasocket-3.0rc1-1.src.rock", | 23 | "/luasocket-3.0rc1-2.src.rock", |
23 | "/luasocket-3.0rc1-1.rockspec", | 24 | "/luasocket-3.0rc1-2.rockspec", |
24 | "/lxsh-0.8.6-2.src.rock", | 25 | "/lxsh-0.8.6-2.src.rock", |
25 | "/lxsh-0.8.6-2.rockspec", | 26 | "/lxsh-0.8.6-2.rockspec", |
26 | "/stdlib-41.0.0-1.src.rock", | 27 | "/stdlib-41.0.0-1.src.rock", |
@@ -57,63 +58,82 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
57 | end) | 58 | end) |
58 | 59 | ||
59 | it("LuaRocks build lpeg verbose", function() | 60 | it("LuaRocks build lpeg verbose", function() |
60 | assert.is.truthy(run.luarocks("build --verbose lpeg")) | 61 | assert.is_true(run.luarocks_bool("build --verbose lpeg")) |
61 | end) | 62 | end) |
62 | 63 | ||
63 | it("LuaRocks build lpeg branch=master", function() | 64 | it("LuaRocks build lpeg branch=master", function() |
64 | assert.is_true(run.luarocks_bool("build --branch=master lpeg")) | 65 | 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 | 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 | end) | 67 | end) |
67 | 68 | ||
68 | it("LuaRocks build lpeg deps-mode=123", function() | 69 | it("LuaRocks build lpeg deps-mode=123", function() |
69 | assert.is_false(run.luarocks_bool("build --deps-mode=123 lpeg")) | 70 | assert.is_false(run.luarocks_bool("build --deps-mode=123 lpeg --verbose")) |
70 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg")) | 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 | end) | 72 | end) |
72 | 73 | ||
73 | it("LuaRocks build lpeg only-sources example", function() | 74 | 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_true(run.luarocks_bool("download --rockspec lpeg")) |
75 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) | ||
78 | |||
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")) | ||
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")) | ||
82 | |||
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")) | ||
76 | end) | 85 | end) |
77 | 86 | ||
78 | it("LuaRocks build lpeg with empty tree", function() | 87 | it("LuaRocks build lpeg with empty tree", function() |
79 | assert.is_false(run.luarocks_bool("build --tree=\"\" lpeg")) | 88 | assert.is_false(run.luarocks_bool("build --tree=\"\" lpeg")) |
80 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/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")) |
81 | end) | 90 | end) |
82 | end) | 91 | end) |
83 | 92 | ||
84 | describe("LuaRocks build - basic builds", function() | 93 | describe("LuaRocks build - basic builds", function() |
85 | it("LuaRocks build luadoc", function() | 94 | it("LuaRocks build luadoc", function() |
86 | assert.is_true(run.luarocks_bool(test_env.quiet("build luadoc"))) | 95 | assert.is_true(run.luarocks_bool("build luadoc")) |
87 | end) | 96 | end) |
88 | 97 | ||
89 | it("LuaRocks build luacov diff version", function() | 98 | it("LuaRocks build luacov diff version", function() |
90 | 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")) |
91 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luacov")) | 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")) |
92 | end) | 101 | end) |
93 | 102 | ||
94 | it("LuaRocks build command stdlib", function() | 103 | it("LuaRocks build command stdlib", function() |
95 | assert.is_true(run.luarocks_bool("build stdlib")) | 104 | assert.is_true(run.luarocks_bool("build stdlib")) |
96 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/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")) |
97 | end) | 106 | end) |
98 | 107 | ||
99 | it("LuaRocks build install bin luarepl", function() | 108 | it("LuaRocks build install bin luarepl", function() |
100 | assert.is_true(run.luarocks_bool("build luarepl")) | 109 | assert.is_true(run.luarocks_bool("build luarepl")) |
101 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl")) | 110 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/luarepl-0.4-1.rockspec")) |
102 | end) | 111 | end) |
103 | 112 | ||
104 | it("LuaRocks build supported platforms lpty", function() | 113 | it("LuaRocks build supported platforms lpty", function() |
105 | assert.is_true(run.luarocks_bool(test_env.quiet("build lpty"))) | 114 | if test_env.TEST_TARGET_OS == "windows" then |
106 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpty")) | 115 | assert.is_false(run.luarocks_bool("build lpty")) --Error: This rockspec for lpty does not support win32, windows platforms |
116 | else | ||
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")) | ||
119 | end | ||
107 | end) | 120 | end) |
108 | 121 | ||
109 | it("LuaRocks build luasec with skipping dependency checks", function() | 122 | it("LuaRocks build luasec with skipping dependency checks", function() |
110 | assert.is_true(run.luarocks_bool(test_env.quiet("build luasec --nodeps"))) | 123 | assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) |
111 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) | 124 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) |
112 | end) | 125 | end) |
113 | 126 | ||
114 | it("LuaRocks build lmathx deps partial match", function() | 127 | it("LuaRocks build lmathx deps partial match", function() |
115 | assert.is_true(run.luarocks_bool("build lmathx")) | 128 | assert.is_true(run.luarocks_bool("build lmathx")) |
116 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx")) | 129 | |
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")) | ||
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")) | ||
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")) | ||
136 | end | ||
117 | end) | 137 | end) |
118 | end) | 138 | end) |
119 | 139 | ||
@@ -126,17 +146,17 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
126 | end | 146 | end |
127 | 147 | ||
128 | it("LuaRocks build luasec only deps", function() | 148 | it("LuaRocks build luasec only deps", function() |
129 | assert.is_true(run.luarocks_bool(test_env.quiet("build luasec --only-deps"))) | 149 | assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps")) |
130 | assert.is_false(run.luarocks_bool("show luasec")) | 150 | assert.is_false(run.luarocks_bool("show luasec")) |
131 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) | 151 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) |
132 | end) | 152 | end) |
133 | 153 | ||
134 | it("LuaRocks build only deps of downloaded rockspec of lxsh", function() | 154 | 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")) | 155 | assert.is_true(run.luarocks_bool("download --rockspec lxsh 0.8.6-2")) |
136 | 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")) |
137 | assert.is_false(run.luarocks_bool("show lxsh")) | 157 | assert.is_false(run.luarocks_bool("show lxsh")) |
138 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/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")) |
139 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
140 | assert.is_true(os.remove("lxsh-0.8.6-2.rockspec")) | 160 | assert.is_true(os.remove("lxsh-0.8.6-2.rockspec")) |
141 | end) | 161 | end) |
142 | 162 | ||
@@ -144,8 +164,8 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
144 | 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")) |
145 | 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")) |
146 | assert.is_false(run.luarocks_bool("show lxsh")) | 166 | assert.is_false(run.luarocks_bool("show lxsh")) |
147 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/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")) |
148 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
149 | 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")) |
150 | end) | 170 | end) |
151 | 171 | ||
@@ -154,19 +174,18 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
154 | 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")) |
155 | 175 | ||
156 | assert.is.truthy(run.luarocks("show validate-args")) | 176 | assert.is.truthy(run.luarocks("show validate-args")) |
157 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/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")) |
158 | 178 | ||
159 | 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")) |
160 | end) | 180 | end) |
161 | 181 | ||
162 | it("LuaRocks build with https", function() | 182 | it("LuaRocks build with https", function() |
163 | assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) | 183 | assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) |
164 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) | 184 | assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) |
185 | |||
165 | 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")) |
166 | |||
167 | assert.is.truthy(run.luarocks("show validate-args")) | 187 | assert.is.truthy(run.luarocks("show validate-args")) |
168 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/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")) |
169 | |||
170 | 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")) |
171 | end) | 190 | end) |
172 | 191 | ||
diff --git a/spec/config_spec.lua b/spec/config_spec.lua index 0dee8620..4a7f4aea 100644 --- a/spec/config_spec.lua +++ b/spec/config_spec.lua | |||
@@ -2,6 +2,7 @@ local test_env = require("test/test_environment") | |||
2 | local lfs = require("lfs") | 2 | local lfs = require("lfs") |
3 | local run = test_env.run | 3 | local run = test_env.run |
4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
5 | local env_variables = test_env.env_variables | ||
5 | local site_config | 6 | local site_config |
6 | 7 | ||
7 | test_env.unload_luarocks() | 8 | test_env.unload_luarocks() |
@@ -21,12 +22,20 @@ describe("LuaRocks config tests #blackbox #b_config", function() | |||
21 | 22 | ||
22 | it("LuaRocks config include dir", function() | 23 | it("LuaRocks config include dir", function() |
23 | local output = run.luarocks("config --lua-incdir") | 24 | local output = run.luarocks("config --lua-incdir") |
24 | assert.are.same(output, site_config.LUA_INCDIR) | 25 | if test_env.TEST_TARGET_OS == "windows" then |
26 | assert.are.same(output, site_config.LUA_INCDIR:gsub("\\","/")) | ||
27 | else | ||
28 | assert.are.same(output, site_config.LUA_INCDIR) | ||
29 | end | ||
25 | end) | 30 | end) |
26 | 31 | ||
27 | it("LuaRocks config library dir", function() | 32 | it("LuaRocks config library dir", function() |
28 | local output = run.luarocks("config --lua-libdir") | 33 | local output = run.luarocks("config --lua-libdir") |
29 | assert.are.same(output, site_config.LUA_LIBDIR) | 34 | if test_env.TEST_TARGET_OS == "windows" then |
35 | assert.are.same(output, site_config.LUA_LIBDIR:gsub("\\","/")) | ||
36 | else | ||
37 | assert.are.same(output, site_config.LUA_LIBDIR) | ||
38 | end | ||
30 | end) | 39 | end) |
31 | 40 | ||
32 | it("LuaRocks config lua version", function() | 41 | it("LuaRocks config lua version", function() |
@@ -53,38 +62,61 @@ describe("LuaRocks config tests #blackbox #b_config", function() | |||
53 | end) | 62 | end) |
54 | 63 | ||
55 | describe("LuaRocks config - more complex tests", function() | 64 | describe("LuaRocks config - more complex tests", function() |
65 | local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" | ||
66 | local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" | ||
67 | local scname = scdir .. "/config.lua" | ||
68 | |||
69 | local configfile | ||
70 | if test_env.TEST_TARGET_OS == "windows" then | ||
71 | configfile = versioned_scname | ||
72 | else | ||
73 | configfile = scname | ||
74 | end | ||
75 | |||
56 | it("LuaRocks fail system config", function() | 76 | it("LuaRocks fail system config", function() |
57 | os.remove(testing_paths.testing_lrprefix .. "/etc/luarocks/config.lua") | 77 | os.rename(configfile, configfile .. ".bak") |
58 | assert.is_false(run.luarocks_bool("config --system-config;")) | 78 | assert.is_false(run.luarocks_bool("config --system-config")) |
79 | os.rename(configfile .. ".bak", configfile) | ||
59 | end) | 80 | end) |
60 | 81 | ||
61 | it("LuaRocks system config", function() | 82 | it("LuaRocks system config", function() |
62 | local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" | ||
63 | lfs.mkdir(testing_paths.testing_lrprefix) | 83 | lfs.mkdir(testing_paths.testing_lrprefix) |
64 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") | 84 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") |
65 | lfs.mkdir(scdir) | 85 | lfs.mkdir(scdir) |
66 | 86 | ||
67 | local sysconfig = io.open(scdir .. "/config.lua", "w+") | 87 | if test_env.TEST_TARGET_OS == "windows" then |
68 | sysconfig:write(" ") | 88 | local output = run.luarocks("config --system-config") |
69 | sysconfig:close() | 89 | assert.are.same(output, configfile) |
70 | 90 | else | |
71 | local output = run.luarocks("config --system-config;") | 91 | local sysconfig = io.open(configfile, "w+") |
72 | assert.are.same(output, scdir .. "/config.lua") | 92 | sysconfig:write(" ") |
73 | test_env.remove_dir(testing_paths.testing_lrprefix) | 93 | sysconfig:close() |
94 | |||
95 | local output = run.luarocks("config --system-config") | ||
96 | assert.are.same(output, configfile) | ||
97 | os.remove(configfile) | ||
98 | end | ||
74 | end) | 99 | end) |
75 | 100 | ||
76 | it("LuaRocks fail system config invalid", function() | 101 | it("LuaRocks fail system config invalid", function() |
77 | local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" | ||
78 | lfs.mkdir(testing_paths.testing_lrprefix) | 102 | lfs.mkdir(testing_paths.testing_lrprefix) |
79 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") | 103 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") |
80 | lfs.mkdir(scdir) | 104 | lfs.mkdir(scdir) |
81 | 105 | ||
82 | local sysconfig = io.open(scdir .. "/config.lua", "w+") | 106 | if test_env.TEST_TARGET_OS == "windows" then |
83 | sysconfig:write("if if if") | 107 | test_env.copy(configfile, "configfile_temp") |
84 | sysconfig:close() | 108 | local sysconfig = io.open(configfile, "w+") |
85 | 109 | sysconfig:write("if if if") | |
86 | assert.is_false(run.luarocks_bool("config --system-config;")) | 110 | sysconfig:close() |
87 | test_env.remove_dir(testing_paths.testing_lrprefix) | 111 | assert.is_false(run.luarocks_bool("config --system-config")) |
112 | test_env.copy("configfile_temp", configfile) | ||
113 | else | ||
114 | local sysconfig = io.open(configfile, "w+") | ||
115 | sysconfig:write("if if if") | ||
116 | sysconfig:close() | ||
117 | assert.is_false(run.luarocks_bool("config --system-config")) | ||
118 | os.remove(configfile) | ||
119 | end | ||
88 | end) | 120 | end) |
89 | end) | 121 | end) |
90 | end) | 122 | end) |
diff --git a/spec/deps_spec.lua b/spec/deps_spec.lua index c1bd404d..e453c9a1 100644 --- a/spec/deps_spec.lua +++ b/spec/deps_spec.lua | |||
@@ -8,9 +8,9 @@ test_env.unload_luarocks() | |||
8 | local extra_rocks = { | 8 | local extra_rocks = { |
9 | "/lxsh-0.8.6-2.src.rock", | 9 | "/lxsh-0.8.6-2.src.rock", |
10 | "/lxsh-0.8.6-2.rockspec", | 10 | "/lxsh-0.8.6-2.rockspec", |
11 | "/luasocket-3.0rc1-1.src.rock", | 11 | "/luasocket-3.0rc1-2.src.rock", |
12 | "/luasocket-3.0rc1-1.rockspec", | 12 | "/luasocket-3.0rc1-2.rockspec", |
13 | "/lpeg-0.12-1.src.rock" | 13 | "/lpeg-1.0.0-1.src.rock", |
14 | } | 14 | } |
15 | 15 | ||
16 | describe("LuaRocks deps tests #blackbox #b_deps", function() | 16 | describe("LuaRocks deps tests #blackbox #b_deps", function() |
@@ -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")) | 26 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
28 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh")) | 28 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lxsh")) | 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")) |
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")) | 36 | assert.is.falsy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
38 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh")) | 38 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lxsh")) | 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")) |
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")) | 46 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
48 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh")) | 48 | assert.is.falsy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lxsh")) | 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")) |
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")) | 56 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
58 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh")) | 58 | assert.is.falsy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lxsh")) | 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")) |
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")) | 66 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
68 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh")) | 68 | assert.is.falsy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lxsh")) | 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")) |
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")) | 75 | assert.is.falsy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
77 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh")) | 77 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lxsh")) | 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")) |
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")) | 92 | assert.is.falsy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
94 | assert.is.truthy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh")) | 94 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lxsh")) | 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")) |
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")) | 109 | assert.is.truthy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lpeg")) | 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")) |
111 | assert.is.falsy(lfs.attributes(testing_paths.testing_tree .. "/lib/luarocks/rocks/lxsh")) | 111 | assert.is.falsy(lfs.attributes(testing_paths.testing_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_tree .. "/lib/luarocks/rocks/lxsh")) | 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")) |
113 | end) | 113 | end) |
114 | end) | 114 | end) |
diff --git a/spec/help_spec.lua b/spec/help_spec.lua index 88aa5030..71b1b9f6 100644 --- a/spec/help_spec.lua +++ b/spec/help_spec.lua | |||
@@ -10,7 +10,7 @@ describe("LuaRocks help tests #blackbox #b_help", function() | |||
10 | end) | 10 | end) |
11 | 11 | ||
12 | it("LuaRocks help with no flags/arguments", function() | 12 | it("LuaRocks help with no flags/arguments", function() |
13 | assert.is_true(run.luarocks_bool(test_env.quiet("help"))) | 13 | assert.is_true(run.luarocks_bool("help")) |
14 | end) | 14 | end) |
15 | 15 | ||
16 | it("LuaRocks help invalid argument", function() | 16 | it("LuaRocks help invalid argument", function() |
@@ -18,7 +18,7 @@ describe("LuaRocks help tests #blackbox #b_help", function() | |||
18 | end) | 18 | end) |
19 | 19 | ||
20 | it("LuaRocks help config", function() | 20 | it("LuaRocks help config", function() |
21 | assert.is_true(run.luarocks_bool(test_env.quiet("help config"))) | 21 | assert.is_true(run.luarocks_bool("help config")) |
22 | end) | 22 | end) |
23 | 23 | ||
24 | it("LuaRocks-admin help with no flags/arguments", function() | 24 | it("LuaRocks-admin help with no flags/arguments", function() |
diff --git a/spec/install_spec.lua b/spec/install_spec.lua index bd480c21..8857e4bd 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua | |||
@@ -12,8 +12,8 @@ local extra_rocks = { | |||
12 | "/lpeg-0.12-1.src.rock", | 12 | "/lpeg-0.12-1.src.rock", |
13 | "/luasec-0.6-1.rockspec", | 13 | "/luasec-0.6-1.rockspec", |
14 | "/luassert-1.7.0-1.src.rock", | 14 | "/luassert-1.7.0-1.src.rock", |
15 | "/luasocket-3.0rc1-1.src.rock", | 15 | "/luasocket-3.0rc1-2.src.rock", |
16 | "/luasocket-3.0rc1-1.rockspec", | 16 | "/luasocket-3.0rc1-2.rockspec", |
17 | "/lxsh-0.8.6-2.src.rock", | 17 | "/lxsh-0.8.6-2.src.rock", |
18 | "/lxsh-0.8.6-2.rockspec", | 18 | "/lxsh-0.8.6-2.rockspec", |
19 | "/say-1.2-1.src.rock", | 19 | "/say-1.2-1.src.rock", |
@@ -44,8 +44,8 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
44 | assert.is_false(run.luarocks_bool("install \"invalid.rock\" ")) | 44 | assert.is_false(run.luarocks_bool("install \"invalid.rock\" ")) |
45 | end) | 45 | end) |
46 | 46 | ||
47 | it("LuaRocks install with local flag as root", function() | 47 | it("LuaRocks install with local flag as root #unix", function() |
48 | assert.is_false(run.luarocks_bool("install --local luasocket", { USER = "root" } )) | 48 | assert.is_false(run.luarocks_bool("install --local luasocket ", { USER = "root" } )) |
49 | end) | 49 | end) |
50 | 50 | ||
51 | it("LuaRocks install not a zip file", function() | 51 | it("LuaRocks install not a zip file", function() |
@@ -66,15 +66,15 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
66 | end) | 66 | end) |
67 | 67 | ||
68 | it("LuaRocks install luasec and show luasocket (dependency)", function() | 68 | it("LuaRocks install luasec and show luasocket (dependency)", function() |
69 | assert.is_true(run.luarocks_bool("install luasec")) | 69 | assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) |
70 | assert.is_true(run.luarocks_bool("show luasocket")) | 70 | assert.is_true(run.luarocks_bool("show luasocket")) |
71 | end) | 71 | end) |
72 | end) | 72 | end) |
73 | 73 | ||
74 | describe("LuaRocks install - more complex tests", function() | 74 | describe("LuaRocks install - more complex tests", function() |
75 | it('LuaRocks install luasec with skipping dependency checks', function() | 75 | it('LuaRocks install luasec with skipping dependency checks', function() |
76 | run.luarocks_bool(test_env.quiet(" install luasec --nodeps")) | 76 | assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) |
77 | assert.is_true(run.luarocks_bool(test_env.quiet("show luasec"))) | 77 | assert.is_true(run.luarocks_bool("show luasec")) |
78 | if env_variables.TYPE_TEST_ENV == "minimal" then | 78 | if env_variables.TYPE_TEST_ENV == "minimal" then |
79 | assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) | 79 | assert.is_false(run.luarocks_bool(test_env.quiet("show 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_tree .. "/lib/luarocks/rocks/luasocket")) |
@@ -83,21 +83,21 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
83 | end) | 83 | end) |
84 | 84 | ||
85 | it("LuaRocks install only-deps of luasocket packed rock", function() | 85 | it("LuaRocks install only-deps of luasocket packed rock", function() |
86 | assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-1"))) | 86 | assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket 3.0rc1-2")) |
87 | local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock") | 87 | local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock") |
88 | assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-1") | 88 | assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-2") |
89 | assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | 89 | assert.is_true(os.remove("luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) |
90 | end) | 90 | end) |
91 | 91 | ||
92 | it("LuaRocks install reinstall", function() | 92 | it("LuaRocks install reinstall", function() |
93 | assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-1"))) | 93 | assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket 3.0rc1-2")) |
94 | assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | 94 | assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) |
95 | assert.is_true(run.luarocks_bool("install --deps-mode=none " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | 95 | assert.is_true(run.luarocks_bool("install --deps-mode=none " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) |
96 | assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | 96 | assert.is_true(os.remove("luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) |
97 | end) | 97 | end) |
98 | 98 | ||
99 | it("LuaRocks install binary rock of cprint", function() | 99 | it("LuaRocks install binary rock of cprint", function() |
100 | assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock cprint"))) | 100 | assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) |
101 | assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock")) | 101 | assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock")) |
102 | assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")) | 102 | assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")) |
103 | end) | 103 | end) |
diff --git a/spec/make_manifest_spec.lua b/spec/make_manifest_spec.lua index 1c7f5bf8..3e998cbf 100644 --- a/spec/make_manifest_spec.lua +++ b/spec/make_manifest_spec.lua | |||
@@ -4,7 +4,7 @@ local run = test_env.run | |||
4 | test_env.unload_luarocks() | 4 | test_env.unload_luarocks() |
5 | 5 | ||
6 | describe("LuaRocks make_manifest tests #blackbox #b_make_manifest", function() | 6 | describe("LuaRocks make_manifest tests #blackbox #b_make_manifest", function() |
7 | 7 | ||
8 | before_each(function() | 8 | before_each(function() |
9 | test_env.setup_specs() | 9 | test_env.setup_specs() |
10 | end) | 10 | end) |
diff --git a/spec/make_spec.lua b/spec/make_spec.lua index e684033a..ae79a29c 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua | |||
@@ -6,9 +6,9 @@ local testing_paths = test_env.testing_paths | |||
6 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
7 | 7 | ||
8 | local extra_rocks = { | 8 | local extra_rocks = { |
9 | "/lpeg-0.12-1.src.rock", | 9 | "lpeg-1.0.0-1.rockspec", |
10 | "/luasocket-3.0rc1-1.src.rock", | 10 | "/luasocket-3.0rc1-2.src.rock", |
11 | "/luasocket-3.0rc1-1.rockspec", | 11 | "/luasocket-3.0rc1-2.rockspec", |
12 | "/lxsh-0.8.6-2.src.rock", | 12 | "/lxsh-0.8.6-2.src.rock", |
13 | "/lxsh-0.8.6-2.rockspec" | 13 | "/lxsh-0.8.6-2.rockspec" |
14 | } | 14 | } |
@@ -27,19 +27,19 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
27 | 27 | ||
28 | it("LuaRocks make with rockspec", function() | 28 | it("LuaRocks make with rockspec", function() |
29 | -- make luasocket | 29 | -- make luasocket |
30 | assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-1")) | 30 | assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-2")) |
31 | assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-1.src.rock")) | 31 | assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-2.src.rock")) |
32 | lfs.chdir("luasocket-3.0rc1-1/luasocket-3.0-rc1/") | 32 | lfs.chdir("luasocket-3.0rc1-2/luasocket-3.0-rc1/") |
33 | assert.is_true(run.luarocks_bool(test_env.quiet("make luasocket-3.0rc1-1.rockspec"))) | 33 | assert.is_true(run.luarocks_bool("make luasocket-3.0rc1-2.rockspec")) |
34 | 34 | ||
35 | -- test it | 35 | -- test it |
36 | assert.is_true(run.luarocks_bool(test_env.quiet("show luasocket"))) | 36 | assert.is_true(run.luarocks_bool("show luasocket")) |
37 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 37 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) |
38 | 38 | ||
39 | -- delete downloaded and unpacked files | 39 | -- delete downloaded and unpacked files |
40 | lfs.chdir(testing_paths.luarocks_dir) | 40 | lfs.chdir(testing_paths.luarocks_dir) |
41 | test_env.remove_dir("luasocket-3.0rc1-1") | 41 | test_env.remove_dir("luasocket-3.0rc1-2") |
42 | assert.is_true(os.remove("luasocket-3.0rc1-1.src.rock")) | 42 | assert.is_true(os.remove("luasocket-3.0rc1-2.src.rock")) |
43 | end) | 43 | end) |
44 | 44 | ||
45 | describe("LuaRocks making rockspecs (using lxsh)", function() | 45 | describe("LuaRocks making rockspecs (using lxsh)", function() |
@@ -61,37 +61,40 @@ describe("LuaRocks make tests #blackbox #b_make", function() | |||
61 | assert.is_true(run.luarocks_bool("new_version lxsh-0.8.6-2.rockspec")) | 61 | assert.is_true(run.luarocks_bool("new_version lxsh-0.8.6-2.rockspec")) |
62 | assert.is_true(run.luarocks_bool("make")) | 62 | assert.is_true(run.luarocks_bool("make")) |
63 | 63 | ||
64 | assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) | 64 | assert.is_true(run.luarocks_bool("show lxsh")) |
65 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 65 | 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 | end) | 66 | end) |
67 | 67 | ||
68 | it("LuaRocks make unnamed rockspec", function() | 68 | it("LuaRocks make unnamed rockspec", function() |
69 | os.execute("cp lxsh-0.8.6-2.rockspec rockspec") --rewrite with lfs | 69 | test_env.copy("lxsh-0.8.6-2.rockspec", "rockspec") |
70 | assert.is_true(run.luarocks_bool("make")) | 70 | assert.is_true(run.luarocks_bool("make")) |
71 | 71 | ||
72 | assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) | 72 | assert.is_true(run.luarocks_bool("show lxsh")) |
73 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 73 | 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 | os.remove("rockspec") | ||
74 | end) | 75 | end) |
75 | 76 | ||
76 | it("LuaRocks make ambiguous rockspec", function() | 77 | 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.truthy(os.rename("lxsh-0.8.6-2.rockspec", "lxsh2-0.8.6-2.rockspec")) |
78 | assert.is_false(run.luarocks_bool("make")) | 79 | local output = run.luarocks("make") |
80 | assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) | ||
79 | 81 | ||
80 | assert.is_false(run.luarocks_bool("show lxsh")) | 82 | assert.is_false(run.luarocks_bool("show lxsh")) |
81 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 83 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
82 | end) | 84 | end) |
83 | 85 | ||
84 | it("LuaRocks make ambiguous unnamed rockspec", function() | 86 | it("LuaRocks make ambiguous unnamed rockspec", function() |
85 | assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "1_rockspec")) | 87 | assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "1_rockspec")) |
86 | os.execute("cp 1_rockspec 2_rockspec") --rewrite with lfs | 88 | test_env.copy("1_rockspec", "2_rockspec") |
87 | assert.is_false(run.luarocks_bool("make")) | 89 | local output = run.luarocks("make") |
90 | assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) | ||
88 | 91 | ||
89 | assert.is_false(run.luarocks_bool("show lxsh")) | 92 | assert.is_false(run.luarocks_bool("show lxsh")) |
90 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 93 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) |
91 | end) | 94 | end) |
92 | 95 | ||
93 | it("LuaRocks make pack binary rock", function() | 96 | it("LuaRocks make pack binary rock", function() |
94 | assert.is_true(run.luarocks_bool(test_env.quiet("make --deps-mode=none --pack-binary-rock"))) | 97 | 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")) | 98 | assert.is.truthy(lfs.attributes("lxsh-0.8.6-2.all.rock")) |
96 | end) | 99 | end) |
97 | end) | 100 | end) |
diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 0e5b31c6..0c6dd8f2 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua | |||
@@ -6,9 +6,10 @@ local testing_paths = test_env.testing_paths | |||
6 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
7 | 7 | ||
8 | local extra_rocks = { | 8 | local extra_rocks = { |
9 | "/luasec-0.6-1.rockspec", | 9 | "/luasec-0.6-1.rockspec", |
10 | "/luasocket-3.0rc1-1.src.rock", | 10 | "/luassert-1.7.0-1.src.rock", |
11 | "/luasocket-3.0rc1-1.rockspec", | 11 | "/luasocket-3.0rc1-2.src.rock", |
12 | "/luasocket-3.0rc1-2.rockspec", | ||
12 | "/say-1.2-1.src.rock", | 13 | "/say-1.2-1.src.rock", |
13 | "/say-1.0-1.src.rock" | 14 | "/say-1.0-1.src.rock" |
14 | } | 15 | } |
@@ -24,7 +25,7 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() | |||
24 | end) | 25 | end) |
25 | 26 | ||
26 | it("LuaRocks pack basic", function() | 27 | it("LuaRocks pack basic", function() |
27 | assert.is_true(run.luarocks_bool(test_env.quiet("pack luacov"))) | 28 | assert.is_true(run.luarocks_bool("pack luacov")) |
28 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luacov-")) | 29 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luacov-")) |
29 | end) | 30 | end) |
30 | 31 | ||
@@ -40,18 +41,19 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() | |||
40 | assert.is_false(run.luarocks_bool("pack /non/exist/temp.manif")) | 41 | assert.is_false(run.luarocks_bool("pack /non/exist/temp.manif")) |
41 | end) | 42 | end) |
42 | 43 | ||
43 | it("LuaRocks pack specify which version of rock", function() | 44 | it("LuaRocks pack detects latest version version of rock", function() |
44 | assert.is_true(run.luarocks_bool("install say 1.2")) | 45 | assert.is_true(run.luarocks_bool("install say 1.2")) |
45 | assert.is_true(run.luarocks_bool("install luassert")) | 46 | assert.is_true(run.luarocks_bool("install luassert")) |
46 | assert.is_true(run.luarocks_bool("install say 1.0")) | 47 | assert.is_true(run.luarocks_bool("install say 1.0")) |
47 | 48 | assert.is_true(run.luarocks_bool("pack say")) | |
48 | assert.is_false(run.luarocks_bool("pack say")) | 49 | assert.is_truthy(lfs.attributes("say-1.2-1.all.rock")) |
50 | assert.is_true(test_env.remove_files(lfs.currentdir(), "say-")) | ||
49 | end) | 51 | end) |
50 | 52 | ||
51 | it("LuaRocks pack src", function() | 53 | it("LuaRocks pack src", function() |
52 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) | 54 | assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) |
53 | assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-1")) | 55 | assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-2")) |
54 | assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-1.rockspec")) | 56 | assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-2.rockspec")) |
55 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) | 57 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) |
56 | end) | 58 | end) |
57 | end) | 59 | end) |
diff --git a/spec/refresh_cache_spec.lua b/spec/refresh_cache_spec.lua index c20771ab..09f5645e 100644 --- a/spec/refresh_cache_spec.lua +++ b/spec/refresh_cache_spec.lua | |||
@@ -4,7 +4,7 @@ local run = test_env.run | |||
4 | test_env.unload_luarocks() | 4 | test_env.unload_luarocks() |
5 | 5 | ||
6 | describe("LuaRocks refresh_cache tests #blackbox #b_refresh_cache", function() | 6 | describe("LuaRocks refresh_cache tests #blackbox #b_refresh_cache", function() |
7 | 7 | ||
8 | before_each(function() | 8 | before_each(function() |
9 | test_env.setup_specs() | 9 | test_env.setup_specs() |
10 | end) | 10 | end) |
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua index 7bf1bb10..3d321e30 100644 --- a/spec/remove_spec.lua +++ b/spec/remove_spec.lua | |||
@@ -8,8 +8,8 @@ test_env.unload_luarocks() | |||
8 | local extra_rocks = { | 8 | local extra_rocks = { |
9 | "/abelhas-1.0-1.rockspec", | 9 | "/abelhas-1.0-1.rockspec", |
10 | "/lualogging-1.3.0-1.src.rock", | 10 | "/lualogging-1.3.0-1.src.rock", |
11 | "/luasocket-3.0rc1-1.src.rock", | 11 | "/luasocket-3.0rc1-2.src.rock", |
12 | "/luasocket-3.0rc1-1.rockspec" | 12 | "/luasocket-3.0rc1-2.rockspec" |
13 | } | 13 | } |
14 | 14 | ||
15 | describe("LuaRocks remove tests #blackbox #b_remove", function() | 15 | describe("LuaRocks remove tests #blackbox #b_remove", function() |
@@ -76,7 +76,7 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() | |||
76 | end) | 76 | end) |
77 | 77 | ||
78 | it("LuaRocks-admin remove #ssh", function() | 78 | it("LuaRocks-admin remove #ssh", function() |
79 | assert.is_true(run.luarocks_admin_bool("--server=testing remove luasocket-3.0rc1-1.src.rock")) | 79 | assert.is_true(run.luarocks_admin_bool("--server=testing remove luasocket-3.0rc1-2.src.rock")) |
80 | end) | 80 | end) |
81 | 81 | ||
82 | it("LuaRocks-admin remove missing", function() | 82 | it("LuaRocks-admin remove missing", function() |
diff --git a/spec/search_spec.lua b/spec/search_spec.lua index b31624b8..04f84eeb 100644 --- a/spec/search_spec.lua +++ b/spec/search_spec.lua | |||
@@ -30,7 +30,6 @@ describe("LuaRocks search tests #blackbox #b_search", function() | |||
30 | end) | 30 | end) |
31 | 31 | ||
32 | it("LuaRocks search with flag all", function() | 32 | it("LuaRocks search with flag all", function() |
33 | assert.is_true(run.luarocks_bool(test_env.quiet("search --all"))) | 33 | assert.is_true(run.luarocks_bool("search --all")) |
34 | end) | 34 | end) |
35 | |||
36 | end) | 35 | end) |
diff --git a/spec/show_spec.lua b/spec/show_spec.lua index f528a6de..b2cdc07e 100644 --- a/spec/show_spec.lua +++ b/spec/show_spec.lua | |||
@@ -20,10 +20,12 @@ describe("LuaRocks show tests #blackbox #b_show", function() | |||
20 | 20 | ||
21 | it("LuaRocks show luacov", function() | 21 | it("LuaRocks show luacov", function() |
22 | local output = run.luarocks("show luacov") | 22 | local output = run.luarocks("show luacov") |
23 | assert.is.truthy(output:match("LuaCov")) | ||
23 | end) | 24 | end) |
24 | 25 | ||
25 | it("LuaRocks show modules of luacov", function() | 26 | it("LuaRocks show modules of luacov", function() |
26 | local output = run.luarocks("show --modules luacov") | 27 | local output = run.luarocks("show --modules luacov") |
28 | assert.is.truthy(output:match("luacovluacov.defaultsluacov.reporterluacov.reporter.defaultluacov.runnerluacov.statsluacov.tick")) | ||
27 | end) | 29 | end) |
28 | 30 | ||
29 | it("LuaRocks show dependencies of luacov", function() | 31 | it("LuaRocks show dependencies of luacov", function() |
@@ -32,10 +34,12 @@ describe("LuaRocks show tests #blackbox #b_show", function() | |||
32 | 34 | ||
33 | it("LuaRocks show rockspec of luacov", function() | 35 | it("LuaRocks show rockspec of luacov", function() |
34 | local output = run.luarocks("show --rockspec luacov") | 36 | local output = run.luarocks("show --rockspec luacov") |
37 | assert.is.truthy(output:match("luacov--0.11.0--1.rockspec")) | ||
35 | end) | 38 | end) |
36 | 39 | ||
37 | it("LuaRocks show mversion of luacov", function() | 40 | it("LuaRocks show mversion of luacov", function() |
38 | local output = run.luarocks("show --mversion luacov") | 41 | local output = run.luarocks("show --mversion luacov") |
42 | assert.is.truthy(output:match("0.11.0--1")) | ||
39 | end) | 43 | end) |
40 | 44 | ||
41 | it("LuaRocks show rock tree of luacov", function() | 45 | it("LuaRocks show rock tree of luacov", function() |
@@ -49,6 +53,6 @@ describe("LuaRocks show tests #blackbox #b_show", function() | |||
49 | 53 | ||
50 | it("LuaRocks show old version of luacov", function() | 54 | it("LuaRocks show old version of luacov", function() |
51 | run.luarocks("install luacov 0.11.0") | 55 | run.luarocks("install luacov 0.11.0") |
52 | run.luarocks("show luacov 0.11.0") | 56 | run.luarocks_bool("show luacov 0.11.0") |
53 | end) | 57 | end) |
54 | end) | 58 | end) |
diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua index 8db779c3..a0fc370d 100644 --- a/spec/unpack_spec.lua +++ b/spec/unpack_spec.lua | |||
@@ -1,14 +1,12 @@ | |||
1 | local test_env = require("test/test_environment") | 1 | local test_env = require("test/test_environment") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
4 | local lfs = require("lfs") | ||
5 | 4 | ||
6 | test_env.unload_luarocks() | 5 | test_env.unload_luarocks() |
7 | 6 | ||
8 | local extra_rocks = { | 7 | local extra_rocks = { |
9 | "/cprint-0.1-2.src.rock", | 8 | "/cprint-0.1-2.src.rock", |
10 | "/cprint-0.1-2.rockspec", | 9 | "/cprint-0.1-2.rockspec" |
11 | "/luazip-1.2.4-1.rockspec" | ||
12 | } | 10 | } |
13 | 11 | ||
14 | describe("LuaRocks unpack tests #blackbox #b_unpack", function() | 12 | describe("LuaRocks unpack tests #blackbox #b_unpack", function() |
@@ -21,9 +19,11 @@ describe("LuaRocks unpack tests #blackbox #b_unpack", function() | |||
21 | it("LuaRocks unpack with no flags/arguments", function() | 19 | it("LuaRocks unpack with no flags/arguments", function() |
22 | assert.is_false(run.luarocks_bool("unpack")) | 20 | assert.is_false(run.luarocks_bool("unpack")) |
23 | end) | 21 | end) |
22 | |||
24 | it("LuaRocks unpack with invalid rockspec", function() | 23 | it("LuaRocks unpack with invalid rockspec", function() |
25 | assert.is_false(run.luarocks_bool("unpack invalid.rockspec")) | 24 | assert.is_false(run.luarocks_bool("unpack invalid.rockspec")) |
26 | end) | 25 | end) |
26 | |||
27 | it("LuaRocks unpack with invalid patch", function() | 27 | it("LuaRocks unpack with invalid patch", function() |
28 | assert.is_false(run.luarocks_bool("unpack " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) | 28 | assert.is_false(run.luarocks_bool("unpack " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) |
29 | end) | 29 | end) |
@@ -34,19 +34,22 @@ describe("LuaRocks unpack tests #blackbox #b_unpack", function() | |||
34 | assert.is_true(run.luarocks_bool("unpack cprint")) | 34 | assert.is_true(run.luarocks_bool("unpack cprint")) |
35 | test_env.remove_dir("cprint-0.1-2") | 35 | test_env.remove_dir("cprint-0.1-2") |
36 | end) | 36 | end) |
37 | |||
37 | it("LuaRocks unpack src", function() | 38 | it("LuaRocks unpack src", function() |
38 | assert.is_true(run.luarocks_bool("download --source cprint")) | 39 | assert.is_true(run.luarocks_bool("download --source cprint")) |
39 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock")) | 40 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock")) |
40 | os.remove("cprint-0.1-2.src.rock") | 41 | os.remove("cprint-0.1-2.src.rock") |
41 | test_env.remove_dir("cprint-0.1-2") | 42 | test_env.remove_dir("cprint-0.1-2") |
42 | end) | 43 | end) |
43 | it("LuaRocks unpack rockspec", function() | 44 | |
45 | it("LuaRocks unpack src", function() | ||
44 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) | 46 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) |
45 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) | 47 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) |
46 | os.remove("cprint-0.1-2.rockspec") | 48 | os.remove("cprint-0.1-2.rockspec") |
47 | os.remove("lua-cprint") | 49 | os.remove("lua-cprint") |
48 | test_env.remove_dir("cprint-0.1-2") | 50 | test_env.remove_dir("cprint-0.1-2") |
49 | end) | 51 | end) |
52 | |||
50 | -- #595 luarocks unpack of a git:// rockspec fails to copy the rockspec | 53 | -- #595 luarocks unpack of a git:// rockspec fails to copy the rockspec |
51 | it("LuaRocks unpack git:// rockspec", function() | 54 | it("LuaRocks unpack git:// rockspec", function() |
52 | assert.is_true(run.luarocks_bool("download --rockspec luazip")) | 55 | assert.is_true(run.luarocks_bool("download --rockspec luazip")) |
@@ -54,6 +57,7 @@ describe("LuaRocks unpack tests #blackbox #b_unpack", function() | |||
54 | assert.is_truthy(lfs.attributes("luazip-1.2.4-1/luazip/luazip-1.2.4-1.rockspec")) | 57 | assert.is_truthy(lfs.attributes("luazip-1.2.4-1/luazip/luazip-1.2.4-1.rockspec")) |
55 | test_env.remove_dir("luazip-1.2.4-1") | 58 | test_env.remove_dir("luazip-1.2.4-1") |
56 | end) | 59 | end) |
60 | |||
57 | it("LuaRocks unpack binary", function() | 61 | it("LuaRocks unpack binary", function() |
58 | assert.is_true(run.luarocks_bool("build cprint")) | 62 | assert.is_true(run.luarocks_bool("build cprint")) |
59 | assert.is_true(run.luarocks_bool("pack cprint")) | 63 | assert.is_true(run.luarocks_bool("pack cprint")) |
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index c68a1cdf..ff39cb96 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua | |||
@@ -45,7 +45,7 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() | |||
45 | assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack luacov-0.11.0-1.rockspec")) | 45 | assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack luacov-0.11.0-1.rockspec")) |
46 | end) | 46 | end) |
47 | 47 | ||
48 | it("LuaRocks upload force", function() | 48 | it("LuaRocks upload force #unix", function() |
49 | assert.is_true(run.luarocks_bool("install lua-cjson")) | 49 | assert.is_true(run.luarocks_bool("install lua-cjson")) |
50 | assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force luacov-0.11.0-1.rockspec")) | 50 | assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force luacov-0.11.0-1.rockspec")) |
51 | assert.is_true(run.luarocks_bool("install lua-cjson")) | 51 | assert.is_true(run.luarocks_bool("install lua-cjson")) |
@@ -63,10 +63,10 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() | |||
63 | end) | 63 | end) |
64 | 64 | ||
65 | it("LuaRocks upload rockspec with api-key", function() | 65 | it("LuaRocks upload rockspec with api-key", function() |
66 | assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) | 66 | assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) |
67 | end) | 67 | end) |
68 | it("LuaRocks upload rockspec with api-key and skip-pack", function() | 68 | it("LuaRocks upload rockspec with api-key and skip-pack", function() |
69 | assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) | 69 | assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) |
70 | end) | 70 | end) |
71 | end) | 71 | end) |
72 | end) | 72 | end) |
diff --git a/spec/util_spec.lua b/spec/util_spec.lua index 23e3ebd8..2779b1ce 100644 --- a/spec/util_spec.lua +++ b/spec/util_spec.lua | |||
@@ -27,7 +27,7 @@ describe("Basic tests #blackbox #b_util", function() | |||
27 | assert.is_false(run.luarocks_bool("invalid=5")) | 27 | assert.is_false(run.luarocks_bool("invalid=5")) |
28 | end) | 28 | end) |
29 | 29 | ||
30 | it("LuaRocks execute from not existing directory", function() | 30 | it("LuaRocks execute from not existing directory #unix", function() |
31 | local main_path = lfs.currentdir() | 31 | local main_path = lfs.currentdir() |
32 | assert.is_true(lfs.mkdir("idontexist")) | 32 | assert.is_true(lfs.mkdir("idontexist")) |
33 | assert.is_true(lfs.chdir("idontexist")) | 33 | assert.is_true(lfs.chdir("idontexist")) |
@@ -66,34 +66,109 @@ describe("Basic tests #blackbox #b_util", function() | |||
66 | assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua")) | 66 | assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua")) |
67 | end) | 67 | end) |
68 | 68 | ||
69 | describe("LuaRocks sysconfig fails", function() | 69 | -- Disable versioned config temporarily, because it always takes |
70 | local scdir = "" | 70 | -- precedence over config.lua (config-5.x.lua is installed by default on Windows, |
71 | 71 | -- but not on Unix, so on Unix the os.rename commands below will fail silently, but this is harmless) | |
72 | before_each(function() | 72 | describe("LuaRocks config - more complex tests", function() |
73 | scdir = testing_paths.testing_lrprefix .. "/etc/luarocks/" | 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() | ||
74 | lfs.mkdir(testing_paths.testing_lrprefix) | 92 | lfs.mkdir(testing_paths.testing_lrprefix) |
75 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") | 93 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") |
76 | lfs.mkdir(scdir) | 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) | ||
77 | end) | 103 | end) |
78 | 104 | ||
79 | after_each(function() | 105 | it("LuaRocks fail system config invalid", function() |
80 | test_env.remove_dir(testing_paths.testing_lrprefix) | 106 | lfs.mkdir(testing_paths.testing_lrprefix) |
81 | end) | 107 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") |
108 | lfs.mkdir(scdir) | ||
82 | 109 | ||
83 | it("LuaRocks sysconfig fail", function() | 110 | local sysconfig = io.open(configfile, "w+") |
84 | local sysconfig = io.open(scdir .. "/config.lua", "w+") | 111 | sysconfig:write("if if if") |
85 | sysconfig:write("aoeui") | ||
86 | sysconfig:close() | 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) | ||
118 | end) | ||
87 | 119 | ||
88 | assert.is_false(run.luarocks_bool("list")) | 120 | test_env.unload_luarocks() |
121 | local util = require("luarocks.util") | ||
122 | |||
123 | describe("Luarocks util test #whitebox #w_util", function() | ||
124 | describe("util.sortedpairs", function() | ||
125 | local function collect(iter, state, var) | ||
126 | local collected = {} | ||
127 | |||
128 | while true do | ||
129 | local returns = {iter(state, var)} | ||
130 | |||
131 | if returns[1] == nil then | ||
132 | return collected | ||
133 | else | ||
134 | table.insert(collected, returns) | ||
135 | var = returns[1] | ||
136 | end | ||
137 | end | ||
138 | end | ||
139 | |||
140 | it("default sort", function() | ||
141 | assert.are.same({}, collect(util.sortedpairs({}))) | ||
142 | assert.are.same({ | ||
143 | {1, "v1"}, | ||
144 | {2, "v2"}, | ||
145 | {3, "v3"}, | ||
146 | {"bar", "v5"}, | ||
147 | {"foo", "v4"} | ||
148 | }, collect(util.sortedpairs({"v1", "v2", "v3", foo = "v4", bar = "v5"}))) | ||
89 | end) | 149 | end) |
90 | 150 | ||
91 | it("LuaRocks sysconfig fail", function() | 151 | it("sort by function", function() |
92 | local sysconfig = io.open(scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua", "w+") | 152 | local function compare(a, b) return a > b end |
93 | sysconfig:write("aoeui") | 153 | assert.are.same({}, collect(util.sortedpairs({}, compare))) |
94 | sysconfig:close() | 154 | assert.are.same({ |
155 | {3, "v3"}, | ||
156 | {2, "v2"}, | ||
157 | {1, "v1"} | ||
158 | }, collect(util.sortedpairs({"v1", "v2", "v3"}, compare))) | ||
159 | end) | ||
95 | 160 | ||
96 | assert.is_false(run.luarocks_bool("list")) | 161 | it("sort by priority table", function() |
162 | assert.are.same({}, collect(util.sortedpairs({}, {"k1", "k2"}))) | ||
163 | assert.are.same({ | ||
164 | {"k3", "v3"}, | ||
165 | {"k2", "v2", {"sub order"}}, | ||
166 | {"k1", "v1"}, | ||
167 | {"k4", "v4"}, | ||
168 | {"k5", "v5"}, | ||
169 | }, collect(util.sortedpairs({ | ||
170 | k1 = "v1", k2 = "v2", k3 = "v3", k4 = "v4", k5 = "v5" | ||
171 | }, {"k3", {"k2", {"sub order"}}, "k1"}))) | ||
97 | end) | 172 | end) |
98 | end) | 173 | end) |
99 | end) | 174 | end) |