diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 14:55:11 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-19 13:15:53 -0300 |
| commit | 2efec770b1b1b27a4b15c3b06a2f5fcadc0b546d (patch) | |
| tree | f7c2e34abe3314658df0970dde6e1bc346c1e627 /spec | |
| parent | 08ae98e309c3f09be00b547bab74a5fd875bfa36 (diff) | |
| download | luarocks-2efec770b1b1b27a4b15c3b06a2f5fcadc0b546d.tar.gz luarocks-2efec770b1b1b27a4b15c3b06a2f5fcadc0b546d.tar.bz2 luarocks-2efec770b1b1b27a4b15c3b06a2f5fcadc0b546d.zip | |
repos: double-check that all files from a rock are installed
Ensure that `luarocks` fails if an installation does not successfully
deploy all files registered in the `rock_manifest`.
See #1276.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/remove_spec.lua | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua index 91b6a460..21a39696 100644 --- a/spec/remove_spec.lua +++ b/spec/remove_spec.lua | |||
| @@ -2,6 +2,7 @@ local test_env = require("spec.util.test_env") | |||
| 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 | 6 | ||
| 6 | test_env.unload_luarocks() | 7 | test_env.unload_luarocks() |
| 7 | 8 | ||
| @@ -9,7 +10,9 @@ local extra_rocks = { | |||
| 9 | "/abelhas-1.1-1.src.rock", | 10 | "/abelhas-1.1-1.src.rock", |
| 10 | "/copas-2.0.1-1.src.rock", | 11 | "/copas-2.0.1-1.src.rock", |
| 11 | "/coxpcall-1.16.0-1.src.rock", | 12 | "/coxpcall-1.16.0-1.src.rock", |
| 12 | "/coxpcall-1.16.0-1.rockspec" | 13 | "/coxpcall-1.16.0-1.rockspec", |
| 14 | "/luafilesystem-1.7.0-1.src.rock", | ||
| 15 | "/luafilesystem-1.6.3-2.src.rock", | ||
| 13 | } | 16 | } |
| 14 | 17 | ||
| 15 | describe("luarocks remove #integration", function() | 18 | describe("luarocks remove #integration", function() |
| @@ -80,6 +83,36 @@ describe("luarocks remove #integration", function() | |||
| 80 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/coxpcall")) | 83 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/coxpcall")) |
| 81 | assert.is.falsy(output:find("Checking stability of dependencies")) | 84 | assert.is.falsy(output:find("Checking stability of dependencies")) |
| 82 | end) | 85 | end) |
| 86 | |||
| 87 | it("restores old versions", function() | ||
| 88 | assert.is_true(run.luarocks_bool("install luafilesystem 1.6.3")) | ||
| 89 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) | ||
| 90 | |||
| 91 | if test_env.TEST_TARGET_OS ~= "windows" then | ||
| 92 | local fd = io.open(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension, "r") | ||
| 93 | assert(fd:read("*a"):match("LuaFileSystem 1.6.3", 1, true)) | ||
| 94 | fd:close() | ||
| 95 | end | ||
| 96 | |||
| 97 | assert.is_true(run.luarocks_bool("install luafilesystem 1.7.0 --keep")) | ||
| 98 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) | ||
| 99 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/luafilesystem_1_6_3_2-lfs."..test_env.lib_extension)) | ||
| 100 | |||
| 101 | if test_env.TEST_TARGET_OS ~= "windows" then | ||
| 102 | local fd = io.open(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension, "r") | ||
| 103 | assert(fd:read("*a"):match("LuaFileSystem 1.7.0", 1, true)) | ||
| 104 | fd:close() | ||
| 105 | end | ||
| 106 | |||
| 107 | assert.is_true(run.luarocks_bool("remove luafilesystem 1.7.0")) | ||
| 108 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) | ||
| 109 | |||
| 110 | if test_env.TEST_TARGET_OS ~= "windows" then | ||
| 111 | local fd = io.open(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension, "r") | ||
| 112 | assert(fd:read("*a"):match("LuaFileSystem 1.6.3", 1, true)) | ||
| 113 | fd:close() | ||
| 114 | end | ||
| 115 | end) | ||
| 83 | end) | 116 | end) |
| 84 | 117 | ||
| 85 | it("#admin remove #ssh", function() | 118 | it("#admin remove #ssh", function() |
