diff options
Diffstat (limited to 'spec/lint_spec.lua')
| -rw-r--r-- | spec/lint_spec.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/lint_spec.lua b/spec/lint_spec.lua new file mode 100644 index 00000000..f7496037 --- /dev/null +++ b/spec/lint_spec.lua | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | local test_env = require("test/test_environment") | ||
| 2 | local run = test_env.run | ||
| 3 | local testing_paths = test_env.testing_paths | ||
| 4 | |||
| 5 | test_env.unload_luarocks() | ||
| 6 | |||
| 7 | local extra_rocks = { | ||
| 8 | "/validate-args-1.5.4-1.rockspec" | ||
| 9 | } | ||
| 10 | |||
| 11 | describe("LuaRocks lint tests #blackbox #b_lint", function() | ||
| 12 | |||
| 13 | before_each(function() | ||
| 14 | test_env.setup_specs(extra_rocks) | ||
| 15 | end) | ||
| 16 | |||
| 17 | it("LuaRocks lint with no flags/arguments", function() | ||
| 18 | assert.is_false(run.luarocks_bool("lint")) | ||
| 19 | end) | ||
| 20 | |||
| 21 | it("LuaRocks lint invalid argument", function() | ||
| 22 | assert.is_false(run.luarocks_bool("lint invalid")) | ||
| 23 | end) | ||
| 24 | |||
| 25 | it("LuaRocks lint OK", function() | ||
| 26 | assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) | ||
| 27 | local output = run.luarocks("lint validate-args-1.5.4-1.rockspec") | ||
| 28 | assert.are.same(output, "") | ||
| 29 | assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) | ||
| 30 | end) | ||
| 31 | |||
| 32 | describe("LuaRocks lint mismatch set", function() | ||
| 33 | it("LuaRocks lint mismatch string", function() | ||
| 34 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_string-1.0-1.rockspec")) | ||
| 35 | end) | ||
| 36 | |||
| 37 | it("LuaRocks lint mismatch version", function() | ||
| 38 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_version-1.0-1.rockspec")) | ||
| 39 | end) | ||
| 40 | |||
| 41 | it("LuaRocks lint mismatch table", function() | ||
| 42 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/type_mismatch_table-1.0-1.rockspec")) | ||
| 43 | end) | ||
| 44 | |||
| 45 | it("LuaRocks lint mismatch no build table", function() | ||
| 46 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.testing_dir .. "/testfiles/no_build_table-1.0-1.rockspec")) | ||
| 47 | end) | ||
| 48 | end) | ||
| 49 | end) | ||
