diff options
| author | Hugo Levy-Falk <hugo@klafyvel.me> | 2026-07-13 22:25:25 +0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2026-07-13 19:50:25 -0300 |
| commit | 539fd9f30c3ac37008de59feb05f742b8f9eaaa9 (patch) | |
| tree | 614d4f758f63a1853fae17811688ea4805defe13 | |
| parent | 0e90c184ef44dae80be747983e27c6940fbea3b9 (diff) | |
| download | luarocks-539fd9f30c3ac37008de59feb05f742b8f9eaaa9.tar.gz luarocks-539fd9f30c3ac37008de59feb05f742b8f9eaaa9.tar.bz2 luarocks-539fd9f30c3ac37008de59feb05f742b8f9eaaa9.zip | |
tests: Add lint pass on the created rockspecs for the init command.
| -rw-r--r-- | spec/init_spec.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 6cc0dd90..ae211706 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua | |||
| @@ -6,7 +6,7 @@ local is_win = test_env.TEST_TARGET_OS == "windows" | |||
| 6 | local write_file = test_env.write_file | 6 | local write_file = test_env.write_file |
| 7 | local lfs = require("lfs") | 7 | local lfs = require("lfs") |
| 8 | 8 | ||
| 9 | describe("luarocks init #integration", function() | 9 | describe("luarocks #init #integration", function() |
| 10 | 10 | ||
| 11 | lazy_setup(function() | 11 | lazy_setup(function() |
| 12 | test_env.setup_specs() | 12 | test_env.setup_specs() |
| @@ -31,6 +31,7 @@ describe("luarocks init #integration", function() | |||
| 31 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) | 31 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) |
| 32 | assert.truthy(lfs.attributes(myproject .. "/.gitignore")) | 32 | assert.truthy(lfs.attributes(myproject .. "/.gitignore")) |
| 33 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) | 33 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) |
| 34 | assert.truthy(run.luarocks_bool("lint " .. myproject .. "/myproject-dev-1.rockspec")) | ||
| 34 | end, finally) | 35 | end, finally) |
| 35 | end) | 36 | end) |
| 36 | 37 | ||
| @@ -53,6 +54,7 @@ describe("luarocks init #integration", function() | |||
| 53 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) | 54 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) |
| 54 | assert.falsy(lfs.attributes(myproject .. "/.gitignore")) | 55 | assert.falsy(lfs.attributes(myproject .. "/.gitignore")) |
| 55 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) | 56 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) |
| 57 | assert.truthy(run.luarocks_bool("lint " .. myproject .. "/myproject-dev-1.rockspec")) | ||
| 56 | end, finally) | 58 | end, finally) |
| 57 | end) | 59 | end) |
| 58 | 60 | ||
| @@ -72,6 +74,7 @@ describe("luarocks init #integration", function() | |||
| 72 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) | 74 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) |
| 73 | assert.truthy(lfs.attributes(myproject .. "/.gitignore")) | 75 | assert.truthy(lfs.attributes(myproject .. "/.gitignore")) |
| 74 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) | 76 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) |
| 77 | assert.truthy(run.luarocks_bool("lint " .. myproject .. "/myproject-dev-1.rockspec")) | ||
| 75 | end, finally) | 78 | end, finally) |
| 76 | end) | 79 | end) |
| 77 | 80 | ||
| @@ -94,6 +97,7 @@ describe("luarocks init #integration", function() | |||
| 94 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) | 97 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) |
| 95 | assert.truthy(lfs.attributes(myproject .. "/.gitignore")) | 98 | assert.truthy(lfs.attributes(myproject .. "/.gitignore")) |
| 96 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) | 99 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) |
| 100 | assert.truthy(run.luarocks_bool("lint " .. myproject .. "/myproject-dev-1.rockspec")) | ||
| 97 | end, finally) | 101 | end, finally) |
| 98 | end) | 102 | end) |
| 99 | 103 | ||
| @@ -144,6 +148,7 @@ describe("luarocks init #integration", function() | |||
| 144 | 148 | ||
| 145 | assert(run.luarocks("init customname 1.0")) | 149 | assert(run.luarocks("init customname 1.0")) |
| 146 | assert.truthy(lfs.attributes(myproject .. "/customname-1.0-1.rockspec")) | 150 | assert.truthy(lfs.attributes(myproject .. "/customname-1.0-1.rockspec")) |
| 151 | assert.truthy(run.luarocks_bool("lint " .. myproject .. "/customname-1.0-1.rockspec")) | ||
| 147 | end, finally) | 152 | end, finally) |
| 148 | end) | 153 | end) |
| 149 | 154 | ||
| @@ -160,6 +165,7 @@ describe("luarocks init #integration", function() | |||
| 160 | local data = fd:read("*a") | 165 | local data = fd:read("*a") |
| 161 | fd:close() | 166 | fd:close() |
| 162 | assert.truthy(data:find("lua >= 5.1, < 5.6", 1, true)) | 167 | assert.truthy(data:find("lua >= 5.1, < 5.6", 1, true)) |
| 168 | assert.truthy(run.luarocks_bool("lint " .. rockspec_name)) | ||
| 163 | end, finally) | 169 | end, finally) |
| 164 | end) | 170 | end) |
| 165 | 171 | ||
| @@ -175,6 +181,7 @@ describe("luarocks init #integration", function() | |||
| 175 | assert.truthy(content:find("summary = \"Test repo\"")) | 181 | assert.truthy(content:find("summary = \"Test repo\"")) |
| 176 | assert.truthy(content:find("detailed = .+Test repo.+")) | 182 | assert.truthy(content:find("detailed = .+Test repo.+")) |
| 177 | assert.truthy(content:find("license = \"MIT\"")) | 183 | assert.truthy(content:find("license = \"MIT\"")) |
| 184 | assert.truthy(run.luarocks_bool("lint " .. myproject .. "/myproject-dev-1.rockspec")) | ||
| 178 | 185 | ||
| 179 | fd = assert(io.open(myproject .. "/.gitignore", "r")) | 186 | fd = assert(io.open(myproject .. "/.gitignore", "r")) |
| 180 | content = assert(fd:read("*a")) | 187 | content = assert(fd:read("*a")) |
