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.lua19
1 files changed, 9 insertions, 10 deletions
diff --git a/spec/lint_spec.lua b/spec/lint_spec.lua
index 75774061..ff7a03e9 100644
--- a/spec/lint_spec.lua
+++ b/spec/lint_spec.lua
@@ -1,7 +1,6 @@
1local test_env = require("spec.util.test_env") 1local test_env = require("spec.util.test_env")
2local run = test_env.run 2local run = test_env.run
3local get_tmp_path = test_env.get_tmp_path 3local get_tmp_path = test_env.get_tmp_path
4local testing_paths = test_env.testing_paths
5local write_file = test_env.write_file 4local write_file = test_env.write_file
6 5
7test_env.unload_luarocks() 6test_env.unload_luarocks()
@@ -12,7 +11,7 @@ local extra_rocks = {
12} 11}
13 12
14describe("luarocks lint #integration", function() 13describe("luarocks lint #integration", function()
15 14
16 before_each(function() 15 before_each(function()
17 test_env.setup_specs(extra_rocks) 16 test_env.setup_specs(extra_rocks)
18 end) 17 end)
@@ -24,25 +23,25 @@ describe("luarocks lint #integration", function()
24 it("invalid argument", function() 23 it("invalid argument", function()
25 assert.is_false(run.luarocks_bool("lint invalid")) 24 assert.is_false(run.luarocks_bool("lint invalid"))
26 end) 25 end)
27 26
28 it("OK", function() 27 it("OK", function()
29 assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) 28 assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1"))
30 local output = run.luarocks("lint validate-args-1.5.4-1.rockspec") 29 local output = run.luarocks("lint validate-args-1.5.4-1.rockspec")
31 assert.are.same(output, "") 30 assert.are.same(output, "")
32 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec")) 31 assert.is_true(os.remove("validate-args-1.5.4-1.rockspec"))
33 end) 32 end)
34 33
35 describe("mismatch set", function() 34 describe("mismatch set", function()
36 local tmpdir 35 local tmpdir
37 local olddir 36 local olddir
38 37
39 before_each(function() 38 before_each(function()
40 tmpdir = get_tmp_path() 39 tmpdir = get_tmp_path()
41 olddir = lfs.currentdir() 40 olddir = lfs.currentdir()
42 lfs.mkdir(tmpdir) 41 lfs.mkdir(tmpdir)
43 lfs.chdir(tmpdir) 42 lfs.chdir(tmpdir)
44 end) 43 end)
45 44
46 after_each(function() 45 after_each(function()
47 if olddir then 46 if olddir then
48 lfs.chdir(olddir) 47 lfs.chdir(olddir)
@@ -51,7 +50,7 @@ describe("luarocks lint #integration", function()
51 end 50 end
52 end 51 end
53 end) 52 end)
54 53
55 it("mismatch string", function() 54 it("mismatch string", function()
56 write_file("type_mismatch_string-1.0-1.rockspec", [[ 55 write_file("type_mismatch_string-1.0-1.rockspec", [[
57 package="type_mismatch_version" 56 package="type_mismatch_version"
@@ -59,7 +58,7 @@ describe("luarocks lint #integration", function()
59 ]], finally) 58 ]], finally)
60 assert.is_false(run.luarocks_bool("lint type_mismatch_string-1.0-1.rockspec")) 59 assert.is_false(run.luarocks_bool("lint type_mismatch_string-1.0-1.rockspec"))
61 end) 60 end)
62 61
63 it("mismatch version", function() 62 it("mismatch version", function()
64 write_file("type_mismatch_version-1.0-1.rockspec", [[ 63 write_file("type_mismatch_version-1.0-1.rockspec", [[
65 package="type_mismatch_version" 64 package="type_mismatch_version"
@@ -67,7 +66,7 @@ describe("luarocks lint #integration", function()
67 ]], finally) 66 ]], finally)
68 assert.is_false(run.luarocks_bool("lint type_mismatch_version-1.0-1.rockspec")) 67 assert.is_false(run.luarocks_bool("lint type_mismatch_version-1.0-1.rockspec"))
69 end) 68 end)
70 69
71 it("mismatch table", function() 70 it("mismatch table", function()
72 write_file("type_mismatch_table-1.0-1.rockspec", [[ 71 write_file("type_mismatch_table-1.0-1.rockspec", [[
73 package="type_mismatch_table" 72 package="type_mismatch_table"
@@ -77,7 +76,7 @@ describe("luarocks lint #integration", function()
77 ]], finally) 76 ]], finally)
78 assert.is_false(run.luarocks_bool("lint type_mismatch_table-1.0-1.rockspec")) 77 assert.is_false(run.luarocks_bool("lint type_mismatch_table-1.0-1.rockspec"))
79 end) 78 end)
80 79
81 it("mismatch no build table", function() 80 it("mismatch no build table", function()
82 write_file("no_build_table-1.0-1.rockspec", [[ 81 write_file("no_build_table-1.0-1.rockspec", [[
83 package = "no_build_table" 82 package = "no_build_table"