diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2016-07-14 14:43:42 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-14 14:43:42 -0300 |
| commit | 36388709d628a76c450eed20b67f008faefc36cb (patch) | |
| tree | e9e8a6959ecafcd8355b8b9614f65a613fe6ddb4 /spec | |
| parent | 0f63a95e991435c769584abd01b16bd748a1434b (diff) | |
| parent | 48b98f0c099dc621e1f93cccf9a9e03ff75649b6 (diff) | |
| download | luarocks-36388709d628a76c450eed20b67f008faefc36cb.tar.gz luarocks-36388709d628a76c450eed20b67f008faefc36cb.tar.bz2 luarocks-36388709d628a76c450eed20b67f008faefc36cb.zip | |
Merge pull request #588 from robooo/new-tests
New tests
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/build_spec.lua | 2 | ||||
| -rw-r--r-- | spec/install_spec.lua | 21 | ||||
| -rw-r--r-- | spec/new_version_spec.lua | 8 | ||||
| -rw-r--r-- | spec/pack_spec.lua | 5 | ||||
| -rw-r--r-- | spec/remove_spec.lua | 7 |
5 files changed, 28 insertions, 15 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 1ce99089..682c6dcf 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua | |||
| @@ -169,12 +169,10 @@ describe("LuaRocks build tests #blackbox #b_build", function() | |||
| 169 | end) | 169 | end) |
| 170 | 170 | ||
| 171 | it("LuaRocks build missing external", function() | 171 | it("LuaRocks build missing external", function() |
| 172 | assert.is_true(test_env.need_luasocket()) | ||
| 173 | assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\"")) | 172 | assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/missing_external-0.1-1.rockspec INEXISTENT_INCDIR=\"/invalid/dir\"")) |
| 174 | end) | 173 | end) |
| 175 | 174 | ||
| 176 | it("LuaRocks build invalid patch", function() | 175 | it("LuaRocks build invalid patch", function() |
| 177 | assert.is_true(test_env.need_luasocket()) | ||
| 178 | assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) | 176 | assert.is_false(run.luarocks_bool("build " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec")) |
| 179 | end) | 177 | end) |
| 180 | end) | 178 | end) |
diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 0e406e22..0b2ffb53 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua | |||
| @@ -83,23 +83,24 @@ 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(test_env.need_luasocket()) | 86 | assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket")) |
| 87 | local output = run.luarocks("install --only-deps " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock") | 87 | local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-1." .. 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-1") |
| 89 | assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | ||
| 90 | end) | ||
| 91 | |||
| 92 | it("LuaRocks install reinstall", function() | ||
| 93 | assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket")) | ||
| 94 | assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | ||
| 95 | assert.is_true(run.luarocks_bool("install --deps-mode=none " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | ||
| 96 | assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | ||
| 89 | end) | 97 | end) |
| 90 | 98 | ||
| 91 | it("LuaRocks install binary rock of cprint", function() | 99 | it("LuaRocks install binary rock of cprint", function() |
| 92 | assert.is_true(test_env.need_luasocket()) | ||
| 93 | assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) | 100 | assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) |
| 94 | 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")) |
| 95 | 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")) |
| 96 | end) | 103 | end) |
| 97 | |||
| 98 | it("LuaRocks install reinstall", function() | ||
| 99 | assert.is_true(test_env.need_luasocket()) | ||
| 100 | assert.is_true(run.luarocks_bool("install " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | ||
| 101 | assert.is_true(run.luarocks_bool("install --deps-mode=none " .. testing_paths.testing_cache .. "/luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) | ||
| 102 | end) | ||
| 103 | end) | 104 | end) |
| 104 | 105 | ||
| 105 | describe("New install functionality based on pull request 552", function() | 106 | describe("New install functionality based on pull request 552", function() |
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua index 4e4d5d27..c4185b1d 100644 --- a/spec/new_version_spec.lua +++ b/spec/new_version_spec.lua | |||
| @@ -30,11 +30,19 @@ describe("LuaRocks new_version tests #blackbox #b_new_version", function() | |||
| 30 | it("LuaRocks new version invalid url", function() | 30 | it("LuaRocks new version invalid url", function() |
| 31 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) | 31 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) |
| 32 | assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luainvalid")) | 32 | assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luainvalid")) |
| 33 | assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) | ||
| 33 | test_env.remove_files(lfs.currentdir(), "abelhas--") | 34 | test_env.remove_files(lfs.currentdir(), "abelhas--") |
| 34 | end) | 35 | end) |
| 35 | end) | 36 | end) |
| 36 | 37 | ||
| 37 | describe("LuaRocks new_version more complex tests", function() | 38 | describe("LuaRocks new_version more complex tests", function() |
| 39 | it("LuaRocks new version with remote spec", function() | ||
| 40 | assert.is_true(run.luarocks_bool("new_version https://luarocks.org/manifests/luarocks/luasocket-2.0.2-6.rockspec")) | ||
| 41 | assert.is.truthy(lfs.attributes("luasocket-2.0.2-6.rockspec")) | ||
| 42 | assert.is.truthy(lfs.attributes("luasocket-2.0.2-7.rockspec")) | ||
| 43 | test_env.remove_files(lfs.currentdir(), "luasocket--") | ||
| 44 | end) | ||
| 45 | |||
| 38 | it("LuaRocks new_version of luacov", function() | 46 | it("LuaRocks new_version of luacov", function() |
| 39 | assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) | 47 | assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) |
| 40 | assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec 0.2")) | 48 | assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec 0.2")) |
diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 416184a8..aa827682 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | local test_env = require("test/test_environment") | 1 | 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 | 5 | ||
| 5 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
| 6 | 7 | ||
| @@ -21,6 +22,10 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() | |||
| 21 | assert.is_true(run.luarocks_bool("pack luacov")) | 22 | assert.is_true(run.luarocks_bool("pack luacov")) |
| 22 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luacov-")) | 23 | assert.is_true(test_env.remove_files(lfs.currentdir(), "luacov-")) |
| 23 | end) | 24 | end) |
| 25 | |||
| 26 | it("LuaRocks pack invalid rockspec", function() | ||
| 27 | assert.is_false(run.luarocks_bool("pack " .. testing_paths.testing_dir .. "/testfiles/invaild_validate-args-1.5.4-1.rockspec")) | ||
| 28 | end) | ||
| 24 | 29 | ||
| 25 | it("LuaRocks pack src", function() | 30 | it("LuaRocks pack src", function() |
| 26 | assert.is_true(run.luarocks_bool("install luasec")) | 31 | assert.is_true(run.luarocks_bool("install luasec")) |
diff --git a/spec/remove_spec.lua b/spec/remove_spec.lua index 41c6348a..c7f83b95 100644 --- a/spec/remove_spec.lua +++ b/spec/remove_spec.lua | |||
| @@ -44,8 +44,11 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() | |||
| 44 | end) | 44 | end) |
| 45 | 45 | ||
| 46 | describe("LuaRocks remove more complex tests", function() | 46 | describe("LuaRocks remove more complex tests", function() |
| 47 | before_each(function() | ||
| 48 | assert.is_true(test_env.need_rock("luasocket")) | ||
| 49 | end) | ||
| 50 | |||
| 47 | it("LuaRocks remove fail, break dependencies", function() | 51 | it("LuaRocks remove fail, break dependencies", function() |
| 48 | assert.is_true(test_env.need_luasocket()) | ||
| 49 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 52 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) |
| 50 | assert.is_true(run.luarocks_bool("build lualogging")) | 53 | assert.is_true(run.luarocks_bool("build lualogging")) |
| 51 | 54 | ||
| @@ -54,7 +57,6 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() | |||
| 54 | end) | 57 | end) |
| 55 | 58 | ||
| 56 | it("LuaRocks remove force", function() | 59 | it("LuaRocks remove force", function() |
| 57 | assert.is_true(test_env.need_luasocket()) | ||
| 58 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 60 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) |
| 59 | assert.is_true(run.luarocks_bool("build lualogging")) | 61 | assert.is_true(run.luarocks_bool("build lualogging")) |
| 60 | 62 | ||
| @@ -64,7 +66,6 @@ describe("LuaRocks remove tests #blackbox #b_remove", function() | |||
| 64 | end) | 66 | end) |
| 65 | 67 | ||
| 66 | it("LuaRocks remove force fast", function() | 68 | it("LuaRocks remove force fast", function() |
| 67 | assert.is_true(test_env.need_luasocket()) | ||
| 68 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) | 69 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) |
| 69 | assert.is_true(run.luarocks_bool("build lualogging")) | 70 | assert.is_true(run.luarocks_bool("build lualogging")) |
| 70 | 71 | ||
