diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2022-04-11 19:16:10 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2022-04-12 13:19:12 -0300 |
| commit | 238ba6b21cfcb1af56f1e70dd50de201fc3482a7 (patch) | |
| tree | c948b6d3e12e3a518a69d0c844e016c590b31825 /spec/make_spec.lua | |
| parent | df8a3cd3c957db337bfc3ab4d404c33066a24923 (diff) | |
| download | luarocks-238ba6b21cfcb1af56f1e70dd50de201fc3482a7.tar.gz luarocks-238ba6b21cfcb1af56f1e70dd50de201fc3482a7.tar.bz2 luarocks-238ba6b21cfcb1af56f1e70dd50de201fc3482a7.zip | |
tests: avoid repeated hardcoded package version numbers all over
Diffstat (limited to 'spec/make_spec.lua')
| -rw-r--r-- | spec/make_spec.lua | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/spec/make_spec.lua b/spec/make_spec.lua index e14eb66b..626d84df 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua | |||
| @@ -8,11 +8,11 @@ local write_file = test_env.write_file | |||
| 8 | test_env.unload_luarocks() | 8 | test_env.unload_luarocks() |
| 9 | 9 | ||
| 10 | local extra_rocks = { | 10 | local extra_rocks = { |
| 11 | "/luasocket-3.0rc1-2.src.rock", | 11 | "/luasocket-${LUASOCKET}.src.rock", |
| 12 | "/luasocket-3.0rc1-2.rockspec", | 12 | "/luasocket-${LUASOCKET}.rockspec", |
| 13 | "/lpeg-0.12-1.src.rock", | 13 | "/lpeg-${LPEG}.src.rock", |
| 14 | "/lxsh-0.8.6-2.src.rock", | 14 | "/lxsh-${LXSH}.src.rock", |
| 15 | "/lxsh-0.8.6-2.rockspec" | 15 | "/lxsh-${LXSH}.rockspec" |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | describe("luarocks make #integration", function() | 18 | describe("luarocks make #integration", function() |
| @@ -35,35 +35,35 @@ describe("luarocks make #integration", function() | |||
| 35 | finally(function() | 35 | finally(function() |
| 36 | -- delete downloaded and unpacked files | 36 | -- delete downloaded and unpacked files |
| 37 | lfs.chdir(testing_paths.testrun_dir) | 37 | lfs.chdir(testing_paths.testrun_dir) |
| 38 | test_env.remove_dir("luasocket-3.0rc1-2") | 38 | test_env.remove_dir("luasocket-${LUASOCKET}") |
| 39 | os.remove("luasocket-3.0rc1-2.src.rock") | 39 | os.remove("luasocket-${LUASOCKET}.src.rock") |
| 40 | end) | 40 | end) |
| 41 | 41 | ||
| 42 | -- make luasocket | 42 | -- make luasocket |
| 43 | assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-2")) | 43 | assert.is_true(run.luarocks_bool("download --source luasocket ${LUASOCKET}")) |
| 44 | assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-2.src.rock")) | 44 | assert.is_true(run.luarocks_bool("unpack luasocket-${LUASOCKET}.src.rock")) |
| 45 | lfs.chdir("luasocket-3.0rc1-2/luasocket-3.0-rc1/") | 45 | lfs.chdir("luasocket-${LUASOCKET}/luasocket/") |
| 46 | assert.is_true(run.luarocks_bool("make luasocket-3.0rc1-2.rockspec")) | 46 | assert.is_true(run.luarocks_bool("make luasocket-${LUASOCKET}.rockspec")) |
| 47 | 47 | ||
| 48 | -- test it | 48 | -- test it |
| 49 | assert.is_true(run.luarocks_bool("show luasocket")) | 49 | assert.is_true(run.luarocks_bool("show luasocket")) |
| 50 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) | 50 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket/${LUASOCKET}/luasocket-${LUASOCKET}.rockspec")) |
| 51 | end) | 51 | end) |
| 52 | 52 | ||
| 53 | it("--no-doc", function() | 53 | it("--no-doc", function() |
| 54 | finally(function() | 54 | finally(function() |
| 55 | lfs.chdir(testing_paths.testrun_dir) | 55 | lfs.chdir(testing_paths.testrun_dir) |
| 56 | test_env.remove_dir("luasocket-3.0rc1-2") | 56 | test_env.remove_dir("luasocket-${LUASOCKET}") |
| 57 | os.remove("luasocket-3.0rc1-2.src.rock") | 57 | os.remove("luasocket-${LUASOCKET}.src.rock") |
| 58 | end) | 58 | end) |
| 59 | 59 | ||
| 60 | assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-2")) | 60 | assert.is_true(run.luarocks_bool("download --source luasocket ${LUASOCKET}")) |
| 61 | assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-2.src.rock")) | 61 | assert.is_true(run.luarocks_bool("unpack luasocket-${LUASOCKET}.src.rock")) |
| 62 | lfs.chdir("luasocket-3.0rc1-2/luasocket-3.0-rc1/") | 62 | lfs.chdir("luasocket-${LUASOCKET}/luasocket") |
| 63 | assert.is_true(run.luarocks_bool("make --no-doc luasocket-3.0rc1-2.rockspec")) | 63 | assert.is_true(run.luarocks_bool("make --no-doc luasocket-${LUASOCKET}.rockspec")) |
| 64 | 64 | ||
| 65 | assert.is_true(run.luarocks_bool("show luasocket")) | 65 | assert.is_true(run.luarocks_bool("show luasocket")) |
| 66 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket/3.0rc1-2/doc")) | 66 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/luasocket/${LUASOCKET}/doc")) |
| 67 | end) | 67 | end) |
| 68 | 68 | ||
| 69 | it("--only-deps", function() | 69 | it("--only-deps", function() |
| @@ -82,24 +82,24 @@ describe("luarocks make #integration", function() | |||
| 82 | describe("LuaRocks making rockspecs (using lxsh)", function() | 82 | describe("LuaRocks making rockspecs (using lxsh)", function() |
| 83 | --download lxsh and unpack it | 83 | --download lxsh and unpack it |
| 84 | before_each(function() | 84 | before_each(function() |
| 85 | assert.is_true(run.luarocks_bool("download --source lxsh 0.8.6-2")) | 85 | assert.is_true(run.luarocks_bool("download --source lxsh ${LXSH}")) |
| 86 | assert.is_true(run.luarocks_bool("unpack lxsh-0.8.6-2.src.rock")) | 86 | assert.is_true(run.luarocks_bool("unpack lxsh-${LXSH}.src.rock")) |
| 87 | assert.is_true(lfs.chdir("lxsh-0.8.6-2/lxsh-0.8.6-1/")) | 87 | assert.is_true(lfs.chdir("lxsh-${LXSH}/lxsh-${LXSH_V}-1/")) |
| 88 | end) | 88 | end) |
| 89 | 89 | ||
| 90 | -- delete downloaded and unpacked files | 90 | -- delete downloaded and unpacked files |
| 91 | after_each(function() | 91 | after_each(function() |
| 92 | assert(lfs.chdir(testing_paths.testrun_dir)) | 92 | assert(lfs.chdir(testing_paths.testrun_dir)) |
| 93 | test_env.remove_dir("lxsh-0.8.6-2") | 93 | test_env.remove_dir("lxsh-${LXSH}") |
| 94 | assert.is_true(os.remove("lxsh-0.8.6-2.src.rock")) | 94 | assert.is_true(os.remove("lxsh-${LXSH}.src.rock")) |
| 95 | end) | 95 | end) |
| 96 | 96 | ||
| 97 | it("default rockspec", function() | 97 | it("default rockspec", function() |
| 98 | assert.is_true(run.luarocks_bool("new_version lxsh-0.8.6-2.rockspec")) | 98 | assert.is_true(run.luarocks_bool("new_version lxsh-${LXSH}.rockspec")) |
| 99 | assert.is_true(run.luarocks_bool("make")) | 99 | assert.is_true(run.luarocks_bool("make")) |
| 100 | 100 | ||
| 101 | assert.is_true(run.luarocks_bool("show lxsh")) | 101 | assert.is_true(run.luarocks_bool("show lxsh")) |
| 102 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec")) | 102 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/${LXSH_V}-3/lxsh-${LXSH_V}-3.rockspec")) |
| 103 | end) | 103 | end) |
| 104 | 104 | ||
| 105 | it("unnamed rockspec", function() | 105 | it("unnamed rockspec", function() |
| @@ -107,35 +107,35 @@ describe("luarocks make #integration", function() | |||
| 107 | os.remove("rockspec") | 107 | os.remove("rockspec") |
| 108 | end) | 108 | end) |
| 109 | 109 | ||
| 110 | test_env.copy("lxsh-0.8.6-2.rockspec", "rockspec") | 110 | test_env.copy("lxsh-${LXSH}.rockspec", "rockspec") |
| 111 | assert.is_true(run.luarocks_bool("make")) | 111 | assert.is_true(run.luarocks_bool("make")) |
| 112 | 112 | ||
| 113 | assert.is_true(run.luarocks_bool("show lxsh")) | 113 | assert.is_true(run.luarocks_bool("show lxsh")) |
| 114 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 114 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/${LXSH}/lxsh-${LXSH}.rockspec")) |
| 115 | end) | 115 | end) |
| 116 | 116 | ||
| 117 | it("ambiguous rockspec", function() | 117 | it("ambiguous rockspec", function() |
| 118 | assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "lxsh2-0.8.6-2.rockspec")) | 118 | assert.is.truthy(os.rename("lxsh-${LXSH}.rockspec", "lxsh2-${LXSH}.rockspec")) |
| 119 | local output = run.luarocks("make") | 119 | local output = run.luarocks("make") |
| 120 | assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) | 120 | assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) |
| 121 | 121 | ||
| 122 | assert.is_false(run.luarocks_bool("show lxsh")) | 122 | assert.is_false(run.luarocks_bool("show lxsh")) |
| 123 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 123 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/${LXSH}/lxsh-${LXSH}.rockspec")) |
| 124 | end) | 124 | end) |
| 125 | 125 | ||
| 126 | it("ambiguous unnamed rockspec", function() | 126 | it("ambiguous unnamed rockspec", function() |
| 127 | assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "1_rockspec")) | 127 | assert.is.truthy(os.rename("lxsh-${LXSH}.rockspec", "1_rockspec")) |
| 128 | test_env.copy("1_rockspec", "2_rockspec") | 128 | test_env.copy("1_rockspec", "2_rockspec") |
| 129 | local output = run.luarocks("make") | 129 | local output = run.luarocks("make") |
| 130 | assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) | 130 | assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) |
| 131 | 131 | ||
| 132 | assert.is_false(run.luarocks_bool("show lxsh")) | 132 | assert.is_false(run.luarocks_bool("show lxsh")) |
| 133 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) | 133 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/lxsh/${LXSH}/lxsh-${LXSH}.rockspec")) |
| 134 | end) | 134 | end) |
| 135 | 135 | ||
| 136 | it("pack binary rock", function() | 136 | it("pack binary rock", function() |
| 137 | assert.is_true(run.luarocks_bool("make --deps-mode=none --pack-binary-rock")) | 137 | assert.is_true(run.luarocks_bool("make --deps-mode=none --pack-binary-rock")) |
| 138 | assert.is.truthy(lfs.attributes("lxsh-0.8.6-2.all.rock")) | 138 | assert.is.truthy(lfs.attributes("lxsh-${LXSH}.all.rock")) |
| 139 | end) | 139 | end) |
| 140 | end) | 140 | end) |
| 141 | 141 | ||
