diff options
author | George Roman <george.roman.99@gmail.com> | 2018-06-18 18:57:47 +0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-21 23:33:00 -0300 |
commit | bdfe731a601f3d12ffafbf504c9b06d70d5aa819 (patch) | |
tree | b6b94d398ba01fb9345d05b55c0bf2a93801cb2a /spec/lint_spec.lua | |
parent | 48ae1d2e7705af6a7527ca61710fe18ccdb7d0b9 (diff) | |
download | luarocks-bdfe731a601f3d12ffafbf504c9b06d70d5aa819.tar.gz luarocks-bdfe731a601f3d12ffafbf504c9b06d70d5aa819.tar.bz2 luarocks-bdfe731a601f3d12ffafbf504c9b06d70d5aa819.zip |
Tests: replace small fixture files with inline content
Diffstat (limited to 'spec/lint_spec.lua')
-rw-r--r-- | spec/lint_spec.lua | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/spec/lint_spec.lua b/spec/lint_spec.lua index e7af97fa..4bc93e95 100644 --- a/spec/lint_spec.lua +++ b/spec/lint_spec.lua | |||
@@ -1,8 +1,11 @@ | |||
1 | local test_env = require("spec.util.test_env") | 1 | local test_env = require("spec.util.test_env") |
2 | local run = test_env.run | 2 | local run = test_env.run |
3 | local get_tmp_path = test_env.get_tmp_path | ||
3 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
5 | local write_file = test_env.write_file | ||
4 | 6 | ||
5 | test_env.unload_luarocks() | 7 | test_env.unload_luarocks() |
8 | local lfs = require("lfs") | ||
6 | 9 | ||
7 | local extra_rocks = { | 10 | local extra_rocks = { |
8 | "/validate-args-1.5.4-1.rockspec" | 11 | "/validate-args-1.5.4-1.rockspec" |
@@ -30,20 +33,66 @@ describe("LuaRocks lint tests #integration", function() | |||
30 | end) | 33 | end) |
31 | 34 | ||
32 | describe("LuaRocks lint mismatch set", function() | 35 | describe("LuaRocks lint mismatch set", function() |
36 | local tmpdir | ||
37 | local olddir | ||
38 | |||
39 | before_each(function() | ||
40 | tmpdir = get_tmp_path() | ||
41 | olddir = lfs.currentdir() | ||
42 | lfs.mkdir(tmpdir) | ||
43 | lfs.chdir(tmpdir) | ||
44 | end) | ||
45 | |||
46 | after_each(function() | ||
47 | if olddir then | ||
48 | lfs.chdir(olddir) | ||
49 | if tmpdir then | ||
50 | lfs.rmdir(tmpdir) | ||
51 | end | ||
52 | end | ||
53 | end) | ||
54 | |||
33 | it("LuaRocks lint mismatch string", function() | 55 | it("LuaRocks lint mismatch string", function() |
34 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.fixtures_dir .. "/type_mismatch_string-1.0-1.rockspec")) | 56 | write_file("type_mismatch_string-1.0-1.rockspec", [[ |
57 | package="type_mismatch_version" | ||
58 | version=1.0 | ||
59 | ]], finally) | ||
60 | assert.is_false(run.luarocks_bool("lint type_mismatch_string-1.0-1.rockspec")) | ||
35 | end) | 61 | end) |
36 | 62 | ||
37 | it("LuaRocks lint mismatch version", function() | 63 | it("LuaRocks lint mismatch version", function() |
38 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.fixtures_dir .. "/type_mismatch_version-1.0-1.rockspec")) | 64 | write_file("type_mismatch_version-1.0-1.rockspec", [[ |
65 | package="type_mismatch_version" | ||
66 | version="1.0" | ||
67 | ]], finally) | ||
68 | assert.is_false(run.luarocks_bool("lint type_mismatch_version-1.0-1.rockspec")) | ||
39 | end) | 69 | end) |
40 | 70 | ||
41 | it("LuaRocks lint mismatch table", function() | 71 | it("LuaRocks lint mismatch table", function() |
42 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.fixtures_dir .. "/type_mismatch_table-1.0-1.rockspec")) | 72 | write_file("type_mismatch_table-1.0-1.rockspec", [[ |
73 | package="type_mismatch_table" | ||
74 | version="1.0-1" | ||
75 | |||
76 | source = "not a table" | ||
77 | ]], finally) | ||
78 | assert.is_false(run.luarocks_bool("lint type_mismatch_table-1.0-1.rockspec")) | ||
43 | end) | 79 | end) |
44 | 80 | ||
45 | it("LuaRocks lint mismatch no build table", function() | 81 | it("LuaRocks lint mismatch no build table", function() |
46 | assert.is_false(run.luarocks_bool("lint " .. testing_paths.fixtures_dir .. "/no_build_table-1.0-1.rockspec")) | 82 | write_file("no_build_table-1.0-1.rockspec", [[ |
83 | package = "no_build_table" | ||
84 | version = "0.1-1" | ||
85 | source = { | ||
86 | url = "http://example.com/foo/tar.gz" | ||
87 | } | ||
88 | description = { | ||
89 | summary = "A rockspec with no build field", | ||
90 | } | ||
91 | dependencies = { | ||
92 | "lua >= 5.1" | ||
93 | } | ||
94 | ]], finally) | ||
95 | assert.is_false(run.luarocks_bool("lint no_build_table-1.0-1.rockspec")) | ||
47 | end) | 96 | end) |
48 | end) | 97 | end) |
49 | end) | 98 | end) |