summaryrefslogtreecommitdiff
path: root/spec/lint_spec.lua
diff options
context:
space:
mode:
authorrobooo <robo.karasek@gmail.com>2016-07-07 21:58:19 +0200
committerHisham Muhammad <hisham@gobolinux.org>2016-07-07 16:58:19 -0300
commit5af7e0d7c2dcf65e41ae8523f3771e9528be32a7 (patch)
treebcd14624e0566a23da2e708675197d212cecf35d /spec/lint_spec.lua
parentb5b285a678fe78b80d452cc9eb7565b8bf087b81 (diff)
downloadluarocks-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/lint_spec.lua')
-rw-r--r--spec/lint_spec.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/lint_spec.lua b/spec/lint_spec.lua
new file mode 100644
index 00000000..cba80a3e
--- /dev/null
+++ b/spec/lint_spec.lua
@@ -0,0 +1,51 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3
4test_env.unload_luarocks()
5local lint = require("luarocks.lint")
6
7local extra_rocks = {
8 "/validate-args-1.5.4-1.rockspec"
9}
10
11expose("LuaRocks lint tests #blackbox #b_lint", function()
12
13 before_each(function()
14 test_env.setup_specs(extra_rocks)
15 testing_paths = test_env.testing_paths
16 run = test_env.run
17 end)
18
19 it("LuaRocks lint with no flags/arguments", function()
20 assert.is_false(run.luarocks_bool("lint"))
21 end)
22
23 it("LuaRocks lint invalid argument", function()
24 assert.is_false(run.luarocks_bool("lint invalid"))
25 end)
26
27 it("LuaRocks lint OK", function()
28 assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1"))
29 local output = run.luarocks("lint validate-args-1.5.4-1.rockspec")
30 assert.are.same(output, "")
31 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec"))
32 end)
33
34 describe("LuaRocks lint mismatch set", function()
35 it("LuaRocks lint mismatch string", function()
36 assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_string-1.0-1.rockspec"))
37 end)
38
39 it("LuaRocks lint mismatch version", function()
40 assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_version-1.0-1.rockspec"))
41 end)
42
43 it("LuaRocks lint mismatch table", function()
44 assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_table-1.0-1.rockspec"))
45 end)
46
47 it("LuaRocks lint mismatch no build table", function()
48 assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/no_build_table-1.0-1.rockspec"))
49 end)
50 end)
51end) \ No newline at end of file