From 5af7e0d7c2dcf65e41ae8523f3771e9528be32a7 Mon Sep 17 00:00:00 2001 From: robooo Date: Thu, 7 Jul 2016 21:58:19 +0200 Subject: 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 --- spec/download_spec.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 spec/download_spec.lua (limited to 'spec/download_spec.lua') 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 @@ +local test_env = require("test/test_environment") +local lfs = require("lfs") + +test_env.unload_luarocks() +local download = require("luarocks.download") + +local extra_rocks = { + "/validate-args-1.5.4-1.rockspec" +} + +expose("LuaRocks download tests #blackbox #b_download", function() + + before_each(function() + test_env.setup_specs(extra_rocks) + run = test_env.run + end) + + it("LuaRocks download with no flags/arguments", function() + assert.is_false(run.luarocks_bool("download")) + end) + + it("LuaRocks download invalid", function() + assert.is_false(run.luarocks_bool("download invalid")) + end) + + it("LuaRocks download all with delete downloaded files", function() --TODO maybe download --all more rocks + assert.is_true(run.luarocks_bool("download --all validate-args")) + assert.is.truthy(lfs.attributes("validate-args-1.5.4-1.rockspec")) + test_env.remove_files(lfs.currentdir(), "validate--args--") + end) + + it("LuaRocks download rockspec version", function() + assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) + assert.is.truthy(lfs.attributes("validate-args-1.5.4-1.rockspec")) + test_env.remove_files(lfs.currentdir(), "validate--args--") + end) +end) -- cgit v1.2.3-55-g6feb