diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2016-07-10 21:34:07 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-10 21:34:07 -0300 |
| commit | 77b41dd05a870feeb519e930472133f63cf94317 (patch) | |
| tree | a7731fcbb567a469cd2ad907bf6cb85ecdbec88e | |
| parent | 8e55688c191827a9b2e9c499a95c888078979e8c (diff) | |
| parent | b8334ea38536b7db031dac925d426fb5e4783407 (diff) | |
| download | luarocks-77b41dd05a870feeb519e930472133f63cf94317.tar.gz luarocks-77b41dd05a870feeb519e930472133f63cf94317.tar.bz2 luarocks-77b41dd05a870feeb519e930472133f63cf94317.zip | |
Merge pull request #585 from robooo/new-tests
New tests
| -rw-r--r-- | spec/doc_spec.lua | 19 | ||||
| -rw-r--r-- | spec/new_version_spec.lua | 15 |
2 files changed, 32 insertions, 2 deletions
diff --git a/spec/doc_spec.lua b/spec/doc_spec.lua index 9dbeaab8..a04d3c14 100644 --- a/spec/doc_spec.lua +++ b/spec/doc_spec.lua | |||
| @@ -1,10 +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 | 4 | ||
| 4 | test_env.unload_luarocks() | 5 | test_env.unload_luarocks() |
| 5 | 6 | ||
| 6 | local extra_rocks = { | 7 | local extra_rocks = { |
| 7 | "/luarepl-0.4-1.src.rock" | 8 | "/luarepl-0.4-1.src.rock", |
| 9 | "/c3-1.0-1.src.rock" | ||
| 8 | } | 10 | } |
| 9 | 11 | ||
| 10 | describe("LuaRocks doc tests #blackbox #b_doc", function() | 12 | describe("LuaRocks doc tests #blackbox #b_doc", function() |
| @@ -20,6 +22,21 @@ describe("LuaRocks doc tests #blackbox #b_doc", function() | |||
| 20 | it("LuaRocks doc with invalid argument", function() | 22 | it("LuaRocks doc with invalid argument", function() |
| 21 | assert.is_false(run.luarocks_bool("doc invalid")) | 23 | assert.is_false(run.luarocks_bool("doc invalid")) |
| 22 | end) | 24 | end) |
| 25 | it("LuaRocks doc with no homepage", function() | ||
| 26 | assert.is_true(run.luarocks_bool("install c3")) | ||
| 27 | assert.is_false(run.luarocks_bool("doc c3 --home")) | ||
| 28 | end) | ||
| 29 | it("LuaRocks doc with no home page and no doc folder", function() | ||
| 30 | assert.is_true(run.luarocks_bool("install c3")) | ||
| 31 | test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/c3/1.0-1/doc") | ||
| 32 | assert.is_false(run.luarocks_bool("doc c3")) | ||
| 33 | end) | ||
| 34 | it("LuaRocks doc with no doc folder opening descript.homepage", function() | ||
| 35 | assert.is_true(run.luarocks_bool("install luarepl")) | ||
| 36 | test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/doc") | ||
| 37 | local output = run.luarocks("doc luarepl") | ||
| 38 | assert.is.truthy(output:find("Local documentation directory not found")) | ||
| 39 | end) | ||
| 23 | end) | 40 | end) |
| 24 | 41 | ||
| 25 | describe("LuaRocks doc tests with flags", function() | 42 | describe("LuaRocks doc tests with flags", function() |
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua index 2274bce3..4e4d5d27 100644 --- a/spec/new_version_spec.lua +++ b/spec/new_version_spec.lua | |||
| @@ -6,7 +6,8 @@ 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 | "/abelhas-1.0-1.rockspec" | 9 | "/abelhas-1.0-1.rockspec", |
| 10 | "/lpeg-0.12-1.rockspec" | ||
| 10 | } | 11 | } |
| 11 | 12 | ||
| 12 | describe("LuaRocks new_version tests #blackbox #b_new_version", function() | 13 | describe("LuaRocks new_version tests #blackbox #b_new_version", function() |
| @@ -25,6 +26,12 @@ describe("LuaRocks new_version tests #blackbox #b_new_version", function() | |||
| 25 | it("LuaRocks new version invalid", function() | 26 | it("LuaRocks new version invalid", function() |
| 26 | assert.is_false(run.luarocks_bool("new_version invalid")) | 27 | assert.is_false(run.luarocks_bool("new_version invalid")) |
| 27 | end) | 28 | end) |
| 29 | |||
| 30 | it("LuaRocks new version invalid url", function() | ||
| 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")) | ||
| 33 | test_env.remove_files(lfs.currentdir(), "abelhas--") | ||
| 34 | end) | ||
| 28 | end) | 35 | end) |
| 29 | 36 | ||
| 30 | describe("LuaRocks new_version more complex tests", function() | 37 | describe("LuaRocks new_version more complex tests", function() |
| @@ -48,5 +55,11 @@ describe("LuaRocks new_version tests #blackbox #b_new_version", function() | |||
| 48 | assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec")) | 55 | assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec")) |
| 49 | test_env.remove_files(lfs.currentdir(), "luacov--") | 56 | test_env.remove_files(lfs.currentdir(), "luacov--") |
| 50 | end) | 57 | end) |
| 58 | |||
| 59 | it("LuaRocks new version updating md5", function() | ||
| 60 | assert.is_true(run.luarocks_bool("download --rockspec lpeg 0.12")) | ||
| 61 | assert.is_true(run.luarocks_bool("new_version lpeg-0.12-1.rockspec 0.2 https://luarocks.org/manifests/gvvaughan/lpeg-1.0.0-1.rockspec")) | ||
| 62 | test_env.remove_files(lfs.currentdir(), "lpeg--") | ||
| 63 | end) | ||
| 51 | end) | 64 | end) |
| 52 | end) | 65 | end) |
