diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-29 00:46:06 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-29 15:46:16 +0000 |
| commit | f76b7a2b13e411df2e696146bb0a6396781acd92 (patch) | |
| tree | 38ed32f81f05f6eacd03f36eacd5341e7b1d17dd /spec/install_spec.lua | |
| parent | 0ca8c460e867356342180bb625760ed9201a5503 (diff) | |
| download | luarocks-f76b7a2b13e411df2e696146bb0a6396781acd92.tar.gz luarocks-f76b7a2b13e411df2e696146bb0a6396781acd92.tar.bz2 luarocks-f76b7a2b13e411df2e696146bb0a6396781acd92.zip | |
tests: speed up and simplify
Diffstat (limited to 'spec/install_spec.lua')
| -rw-r--r-- | spec/install_spec.lua | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/spec/install_spec.lua b/spec/install_spec.lua index b4b064f0..66000c36 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua | |||
| @@ -142,41 +142,6 @@ describe("luarocks install #integration", function() | |||
| 142 | assert.is_true(os.remove("luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) | 142 | assert.is_true(os.remove("luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) |
| 143 | end) | 143 | end) |
| 144 | 144 | ||
| 145 | it("installation rolls back on failure", function() | ||
| 146 | if test_env.TYPE_TEST_ENV ~= "full" then | ||
| 147 | assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket ${LUASOCKET}")) | ||
| 148 | local luadir = testing_paths.testing_sys_tree .. "/share/lua/"..env_variables.LUA_VERSION | ||
| 149 | lfs.mkdir(luadir) | ||
| 150 | |||
| 151 | run.luarocks_bool("remove " .. "luasocket") | ||
| 152 | |||
| 153 | -- create a file where a folder should be | ||
| 154 | local fd = io.open(luadir .. "/socket", "w") | ||
| 155 | fd:write("\n") | ||
| 156 | fd:close() | ||
| 157 | |||
| 158 | -- try to install and fail | ||
| 159 | assert.is_false(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) | ||
| 160 | |||
| 161 | -- file is still there | ||
| 162 | assert.is.truthy(lfs.attributes(luadir .. "/socket")) | ||
| 163 | -- no left overs from failed installation | ||
| 164 | assert.is.falsy(lfs.attributes(luadir .. "/mime.lua")) | ||
| 165 | |||
| 166 | -- remove file | ||
| 167 | assert.is_true(os.remove(luadir .. "/socket")) | ||
| 168 | |||
| 169 | -- try again and succeed | ||
| 170 | assert.is_true(run.luarocks_bool("install " .. "luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) | ||
| 171 | |||
| 172 | -- files installed successfully | ||
| 173 | assert.is.truthy(lfs.attributes(luadir .. "/socket/ftp.lua")) | ||
| 174 | assert.is.truthy(lfs.attributes(luadir .. "/mime.lua")) | ||
| 175 | |||
| 176 | assert.is_true(os.remove("luasocket-${LUASOCKET}." .. test_env.platform .. ".rock")) | ||
| 177 | end | ||
| 178 | end) | ||
| 179 | |||
| 180 | it("binary rock of cprint", function() | 145 | it("binary rock of cprint", function() |
| 181 | assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) | 146 | assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) |
| 182 | assert.is_true(run.luarocks_bool("install cprint-${CPRINT}." .. test_env.platform .. ".rock")) | 147 | assert.is_true(run.luarocks_bool("install cprint-${CPRINT}." .. test_env.platform .. ".rock")) |
