diff options
| author | roboo <robo.karasek@gmail.com> | 2016-08-21 21:50:38 +0200 |
|---|---|---|
| committer | roboo <robo.karasek@gmail.com> | 2016-08-21 21:50:38 +0200 |
| commit | 2f3c8648289bb4e22eee5f8ff8d27afca6592fa4 (patch) | |
| tree | 5d4f17b5d949e67edde281e6dbe7142a24b57260 /spec | |
| parent | 5cdc22fb3c3a85160cd7c2d49ba10ab113e4a784 (diff) | |
| download | luarocks-2f3c8648289bb4e22eee5f8ff8d27afca6592fa4.tar.gz luarocks-2f3c8648289bb4e22eee5f8ff8d27afca6592fa4.tar.bz2 luarocks-2f3c8648289bb4e22eee5f8ff8d27afca6592fa4.zip | |
Windows and appveyor support for tests
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/add_spec.lua | 16 | ||||
| -rw-r--r-- | spec/build_spec.lua | 89 | ||||
| -rw-r--r-- | spec/config_spec.lua | 70 | ||||
| -rw-r--r-- | spec/deps_spec.lua | 70 | ||||
| -rw-r--r-- | spec/install_spec.lua | 36 | ||||
| -rw-r--r-- | spec/make_manifest_spec.lua | 2 | ||||
| -rw-r--r-- | spec/make_spec.lua | 43 | ||||
| -rw-r--r-- | spec/pack_spec.lua | 18 | ||||
| -rw-r--r-- | spec/refresh_cache_spec.lua | 2 | ||||
| -rw-r--r-- | spec/remove_spec.lua | 6 | ||||
| -rw-r--r-- | spec/search_spec.lua | 1 | ||||
| -rw-r--r-- | spec/show_spec.lua | 6 | ||||
| -rw-r--r-- | spec/unpack_spec.lua | 18 | ||||
| -rw-r--r-- | spec/upload_spec.lua | 14 | ||||
| -rw-r--r-- | spec/util_spec.lua | 59 |
15 files changed, 277 insertions, 173 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..b4f838ca 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,27 +58,35 @@ 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 | ||
| @@ -88,32 +97,47 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 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(test_env.quiet("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 | if test_env.APPVEYOR then |
| 111 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) | 124 | assert.is_true(run.luarocks_bool("build luasec " .. test_env.APPVEYOR_OPENSSL .. " --nodeps")) |
| 125 | else | ||
| 126 | assert.is_true(run.luarocks_bool("build luasec --nodeps")) | ||
| 127 | end | ||
| 128 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) | ||
| 112 | end) | 129 | end) |
| 113 | 130 | ||
| 114 | it("LuaRocks build lmathx deps partial match", function() | 131 | it("LuaRocks build lmathx deps partial match", function() |
| 115 | assert.is_true(run.luarocks_bool("build lmathx")) | 132 | assert.is_true(run.luarocks_bool("build lmathx")) |
| 116 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx")) | 133 | |
| 134 | if test_env.LUA_V == "5.1" or test_env.LUAJIT_V then | ||
| 135 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20120430.51-1/lmathx-20120430.51-1.rockspec")) | ||
| 136 | elseif test_env.LUA_V == "5.2" then | ||
| 137 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20120430.52-1/lmathx-20120430.52-1.rockspec")) | ||
| 138 | elseif test_env.LUA_V == "5.3" then | ||
| 139 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lmathx/20150505-1/lmathx-20150505-1.rockspec")) | ||
| 140 | end | ||
| 117 | end) | 141 | end) |
| 118 | end) | 142 | end) |
| 119 | 143 | ||
| @@ -126,17 +150,21 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 126 | end | 150 | end |
| 127 | 151 | ||
| 128 | it("LuaRocks build luasec only deps", function() | 152 | it("LuaRocks build luasec only deps", function() |
| 129 | assert.is_true(run.luarocks_bool(test_env.quiet("build luasec --only-deps"))) | 153 | if test_env.APPVEYOR then |
| 154 | assert.is_true(run.luarocks_bool(test_env.quiet("build luasec " .. test_env.APPVEYOR_OPENSSL .. " --only-deps"))) | ||
| 155 | else | ||
| 156 | assert.is_true(run.luarocks_bool(test_env.quiet("build luasec --only-deps"))) | ||
| 157 | end | ||
| 130 | assert.is_false(run.luarocks_bool("show luasec")) | 158 | assert.is_false(run.luarocks_bool("show luasec")) |
| 131 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec")) | 159 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) |
| 132 | end) | 160 | end) |
| 133 | 161 | ||
| 134 | it("LuaRocks build only deps of downloaded rockspec of lxsh", function() | 162 | 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")) | 163 | 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")) | 164 | assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.rockspec --only-deps")) |
| 137 | assert.is_false(run.luarocks_bool("show lxsh")) | 165 | assert.is_false(run.luarocks_bool("show lxsh")) |
| 138 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 166 | 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")) | 167 | 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")) | 168 | assert.is_true(os.remove("lxsh-0.8.6-2.rockspec")) |
| 141 | end) | 169 | end) |
| 142 | 170 | ||
| @@ -144,8 +172,8 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 144 | assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2")) | 172 | 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")) | 173 | assert.is.truthy(run.luarocks("build lxsh-0.8.6-2.src.rock --only-deps")) |
| 146 | assert.is_false(run.luarocks_bool("show lxsh")) | 174 | assert.is_false(run.luarocks_bool("show lxsh")) |
| 147 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) | 175 | 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")) | 176 | 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")) | 177 | assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) |
| 150 | end) | 178 | end) |
| 151 | 179 | ||
| @@ -154,19 +182,22 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 154 | assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) | 182 | assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) |
| 155 | 183 | ||
| 156 | assert.is.truthy(run.luarocks("show validate-args")) | 184 | assert.is.truthy(run.luarocks("show validate-args")) |
| 157 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args")) | 185 | 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 | 186 | ||
| 159 | assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) | 187 | assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) |
| 160 | end) | 188 | end) |
| 161 | 189 | ||
| 162 | it("LuaRocks build with https", function() | 190 | it("LuaRocks build with https", function() |
| 163 | assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) | 191 | 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"))) | 192 | |
| 193 | if test_env.APPVEYOR then | ||
| 194 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) | ||
| 195 | else | ||
| 196 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) | ||
| 197 | end | ||
| 165 | assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) | 198 | assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) |
| 166 | |||
| 167 | assert.is.truthy(run.luarocks("show validate-args")) | 199 | assert.is.truthy(run.luarocks("show validate-args")) |
| 168 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args")) | 200 | 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")) | 201 | assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) |
| 171 | end) | 202 | end) |
| 172 | 203 | ||
diff --git a/spec/config_spec.lua b/spec/config_spec.lua index 0dee8620..439d0493 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(versioned_scname, versioned_scname .. ".bak") |
| 58 | assert.is_false(run.luarocks_bool("config --system-config;")) | 78 | assert.is_false(run.luarocks_bool("config --system-config")) |
| 79 | os.rename(versioned_scname .. ".bak", versioned_scname) | ||
| 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, versioned_scname) |
| 70 | 90 | else | |
| 71 | local output = run.luarocks("config --system-config;") | 91 | sysconfig = io.open(scname, "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, scname) | ||
| 97 | os.remove(scname) | ||
| 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(versioned_scname, "versioned_scname_temp") |
| 84 | sysconfig:close() | 108 | sysconfig = io.open(versioned_scname, "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("versioned_scname_temp", versioned_scname) | ||
| 113 | else | ||
| 114 | sysconfig = io.open(scname, "w+") | ||
| 115 | sysconfig:write("if if if") | ||
| 116 | sysconfig:close() | ||
| 117 | assert.is_false(run.luarocks_bool("config --system-config")) | ||
| 118 | os.remove(scname) | ||
| 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/install_spec.lua b/spec/install_spec.lua index bd480c21..2b6cb77f 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,14 +66,22 @@ 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 | if test_env.APPVEYOR then |
| 70 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) | ||
| 71 | else | ||
| 72 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) | ||
| 73 | end | ||
| 70 | assert.is_true(run.luarocks_bool("show luasocket")) | 74 | assert.is_true(run.luarocks_bool("show luasocket")) |
| 71 | end) | 75 | end) |
| 72 | end) | 76 | end) |
| 73 | 77 | ||
| 74 | describe("LuaRocks install - more complex tests", function() | 78 | describe("LuaRocks install - more complex tests", function() |
| 75 | it('LuaRocks install luasec with skipping dependency checks', function() | 79 | it('LuaRocks install luasec with skipping dependency checks', function() |
| 76 | run.luarocks_bool(test_env.quiet(" install luasec --nodeps")) | 80 | if test_env.APPVEYOR then |
| 81 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL .. " --nodeps"))) | ||
| 82 | else | ||
| 83 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec --nodeps"))) | ||
| 84 | end | ||
| 77 | assert.is_true(run.luarocks_bool(test_env.quiet("show luasec"))) | 85 | assert.is_true(run.luarocks_bool(test_env.quiet("show luasec"))) |
| 78 | if env_variables.TYPE_TEST_ENV == "minimal" then | 86 | if env_variables.TYPE_TEST_ENV == "minimal" then |
| 79 | assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) | 87 | assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) |
| @@ -83,17 +91,17 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
| 83 | end) | 91 | end) |
| 84 | 92 | ||
| 85 | it("LuaRocks install only-deps of luasocket packed rock", function() | 93 | 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"))) | 94 | assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-2"))) |
| 87 | local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock") | 95 | 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") | 96 | 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")) | 97 | assert.is_true(os.remove("luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) |
| 90 | end) | 98 | end) |
| 91 | 99 | ||
| 92 | it("LuaRocks install reinstall", function() | 100 | it("LuaRocks install reinstall", function() |
| 93 | assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-1"))) | 101 | assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-2"))) |
| 94 | assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | 102 | 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")) | 103 | 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")) | 104 | assert.is_true(os.remove("luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) |
| 97 | end) | 105 | end) |
| 98 | 106 | ||
| 99 | it("LuaRocks install binary rock of cprint", function() | 107 | it("LuaRocks install binary rock of cprint", function() |
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..624badff 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(test_env.quiet("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(test_env.quiet("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,33 +61,36 @@ 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(test_env.quiet("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() |
diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 0e5b31c6..21f33b02 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 | } |
| @@ -44,14 +45,17 @@ describe("LuaRocks pack tests #blackbox #b_pack", 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_false(run.luarocks_bool("pack say")) | 48 | assert.is_false(run.luarocks_bool("pack say")) |
| 49 | end) | 49 | end) |
| 50 | 50 | ||
| 51 | it("LuaRocks pack src", function() | 51 | it("LuaRocks pack src", function() |
| 52 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) | 52 | if test_env.APPVEYOR then |
| 53 | assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-1")) | 53 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) |
| 54 | assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-1.rockspec")) | 54 | else |
| 55 | assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) | ||
| 56 | end | ||
| 57 | assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-2")) | ||
| 58 | assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-2.rockspec")) | ||
| 55 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) | 59 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) |
| 56 | end) | 60 | end) |
| 57 | end) | 61 | 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..f75bc3c1 100644 --- a/spec/search_spec.lua +++ b/spec/search_spec.lua | |||
| @@ -32,5 +32,4 @@ describe("LuaRocks search tests #blackbox #b_search", function() | |||
| 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(test_env.quiet("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..915129ae 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..220ef00d 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,26 +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) |
| 50 | -- #595 luarocks unpack of a git:// rockspec fails to copy the rockspec | 52 | |
| 51 | it("LuaRocks unpack git:// rockspec", function() | ||
| 52 | assert.is_true(run.luarocks_bool("download --rockspec luazip")) | ||
| 53 | assert.is_true(run.luarocks_bool("unpack luazip-1.2.4-1.rockspec")) | ||
| 54 | 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") | ||
| 56 | end) | ||
| 57 | it("LuaRocks unpack binary", function() | 53 | it("LuaRocks unpack binary", function() |
| 58 | assert.is_true(run.luarocks_bool("build cprint")) | 54 | assert.is_true(run.luarocks_bool("build cprint")) |
| 59 | assert.is_true(run.luarocks_bool("pack cprint")) | 55 | assert.is_true(run.luarocks_bool("pack cprint")) |
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index c68a1cdf..af4c36d3 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,18 @@ 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 | if test_env.APPVEYOR then |
| 67 | assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.APPVEYOR_OPENSSL .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) | ||
| 68 | else | ||
| 69 | 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"})) | ||
| 70 | end | ||
| 67 | end) | 71 | end) |
| 68 | it("LuaRocks upload rockspec with api-key and skip-pack", function() | 72 | 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"})) | 73 | if test_env.APPVEYOR then |
| 74 | assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.APPVEYOR_OPENSSL .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) | ||
| 75 | else | ||
| 76 | 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"})) | ||
| 77 | end | ||
| 70 | end) | 78 | end) |
| 71 | end) | 79 | end) |
| 72 | end) | 80 | end) |
diff --git a/spec/util_spec.lua b/spec/util_spec.lua index 23e3ebd8..e6776e4b 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,53 @@ 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) |
| 77 | end) | ||
| 78 | |||
| 79 | after_each(function() | ||
| 80 | test_env.remove_dir(testing_paths.testing_lrprefix) | ||
| 81 | end) | ||
| 82 | 95 | ||
| 83 | it("LuaRocks sysconfig fail", function() | 96 | local sysconfig = io.open(configfile, "w+") |
| 84 | local sysconfig = io.open(scdir .. "/config.lua", "w+") | 97 | sysconfig:write(" ") |
| 85 | sysconfig:write("aoeui") | ||
| 86 | sysconfig:close() | 98 | sysconfig:close() |
| 87 | 99 | ||
| 88 | assert.is_false(run.luarocks_bool("list")) | 100 | local output = run.luarocks("config --system-config") |
| 101 | os.remove(configfile) | ||
| 102 | assert.are.same(output, configfile) | ||
| 89 | end) | 103 | end) |
| 90 | 104 | ||
| 91 | it("LuaRocks sysconfig fail", function() | 105 | it("LuaRocks fail system config invalid", function() |
| 92 | local sysconfig = io.open(scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua", "w+") | 106 | lfs.mkdir(testing_paths.testing_lrprefix) |
| 93 | sysconfig:write("aoeui") | 107 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") |
| 94 | sysconfig:close() | 108 | lfs.mkdir(scdir) |
| 95 | 109 | ||
| 96 | assert.is_false(run.luarocks_bool("list")) | 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) | ||
| 97 | end) | 116 | end) |
| 98 | end) | 117 | end) |
| 99 | end) | 118 | end) |
