aboutsummaryrefslogtreecommitdiff
path: root/spec/lint_spec.lua
diff options
context:
space:
mode:
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