diff options
| author | robooo <robo.karasek@gmail.com> | 2016-07-07 21:58:19 +0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2016-07-07 16:58:19 -0300 |
| commit | 5af7e0d7c2dcf65e41ae8523f3771e9528be32a7 (patch) | |
| tree | bcd14624e0566a23da2e708675197d212cecf35d /spec/download_spec.lua | |
| parent | b5b285a678fe78b80d452cc9eb7565b8bf087b81 (diff) | |
| download | luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.gz luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.bz2 luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.zip | |
New test-suite for LuaRocks (#581)
First version of new test-suite, using Busted framework based on Google Summer of Code project:
https://summerofcode.withgoogle.com/projects/#5695811874717696
* Rewritten from Bash to Lua
* Tests now check if they did what they were supposed to, beyond only checking success or failure of the `luarocks` command
* Support for black-box (launching `luarocks` as an external command) and white-box (testing functions in modules directly) testing
Diffstat (limited to 'spec/download_spec.lua')
| -rw-r--r-- | spec/download_spec.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/download_spec.lua b/spec/download_spec.lua new file mode 100644 index 00000000..9b5d9e2e --- /dev/null +++ b/spec/download_spec.lua | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | local test_env = require("test/test_environment") | ||
| 2 | local lfs = require("lfs") | ||
| 3 | |||
| 4 | test_env.unload_luarocks() | ||
| 5 | local download = require("luarocks.download") | ||
| 6 | |||
| 7 | local extra_rocks = { | ||
| 8 | "/validate-args-1.5.4-1.rockspec" | ||
| 9 | } | ||
| 10 | |||
| 11 | expose("LuaRocks download tests #blackbox #b_download", function() | ||
| 12 | |||
| 13 | before_each(function() | ||
| 14 | test_env.setup_specs(extra_rocks) | ||
| 15 | run = test_env.run | ||
| 16 | end) | ||
| 17 | |||
| 18 | it("LuaRocks download with no flags/arguments", function() | ||
| 19 | assert.is_false(run.luarocks_bool("download")) | ||
| 20 | end) | ||
| 21 | |||
| 22 | it("LuaRocks download invalid", function() | ||
| 23 | assert.is_false(run.luarocks_bool("download invalid")) | ||
| 24 | end) | ||
| 25 | |||
| 26 | it("LuaRocks download all with delete downloaded files", function() --TODO maybe download --all more rocks | ||
| 27 | assert.is_true(run.luarocks_bool("download --all validate-args")) | ||
| 28 | assert.is.truthy(lfs.attributes("validate-args-1.5.4-1.rockspec")) | ||
| 29 | test_env.remove_files(lfs.currentdir(), "validate--args--") | ||
| 30 | end) | ||
| 31 | |||
| 32 | it("LuaRocks download rockspec version", function() | ||
| 33 | assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) | ||
| 34 | assert.is.truthy(lfs.attributes("validate-args-1.5.4-1.rockspec")) | ||
| 35 | test_env.remove_files(lfs.currentdir(), "validate--args--") | ||
| 36 | end) | ||
| 37 | end) | ||
