diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-06 14:28:27 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-14 14:06:51 -0300 |
| commit | c905deaa146dcd285b5b6a0edf0d569c52ea1e5a (patch) | |
| tree | e8dc97eb52ee4ebccaa9d4160c136c8c7e957fde /spec | |
| parent | f8c877d486af39fc563b8a4107092682d49e4ae9 (diff) | |
| download | luarocks-c905deaa146dcd285b5b6a0edf0d569c52ea1e5a.tar.gz luarocks-c905deaa146dcd285b5b6a0edf0d569c52ea1e5a.tar.bz2 luarocks-c905deaa146dcd285b5b6a0edf0d569c52ea1e5a.zip | |
builtin: auto-detect modules when build.modules (or build!) is absent
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/build_spec.lua | 42 | ||||
| -rw-r--r-- | spec/fixtures/autodetect/bla.lua | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua index b703478e..af2dfe38 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua | |||
| @@ -269,6 +269,48 @@ describe("LuaRocks build tests #integration", function() | |||
| 269 | assert.truthy(run.luarocks_bool("build " .. rockspec)) | 269 | assert.truthy(run.luarocks_bool("build " .. rockspec)) |
| 270 | assert.is.truthy(run.luarocks("show a_rock")) | 270 | assert.is.truthy(run.luarocks("show a_rock")) |
| 271 | end) | 271 | end) |
| 272 | |||
| 273 | it("'builtin' detects lua files if modules are not given", function() | ||
| 274 | local rockspec = "autodetect-1.0-1.rockspec" | ||
| 275 | test_env.write_file(rockspec, [[ | ||
| 276 | rockspec_format = "3.0" | ||
| 277 | package = "autodetect" | ||
| 278 | version = "1.0-1" | ||
| 279 | source = { | ||
| 280 | url = "file://]] .. testing_paths.fixtures_dir .. [[/autodetect/bla.lua" | ||
| 281 | } | ||
| 282 | description = { | ||
| 283 | summary = "An example rockspec", | ||
| 284 | } | ||
| 285 | dependencies = { | ||
| 286 | "lua >= 5.1" | ||
| 287 | } | ||
| 288 | build = { | ||
| 289 | } | ||
| 290 | ]], finally) | ||
| 291 | assert.truthy(run.luarocks_bool("build " .. rockspec)) | ||
| 292 | assert.match("bla.lua", run.luarocks("show autodetect")) | ||
| 293 | end) | ||
| 294 | |||
| 295 | it("'builtin' detects lua files if build is not given", function() | ||
| 296 | local rockspec = "autodetect-1.0-1.rockspec" | ||
| 297 | test_env.write_file(rockspec, [[ | ||
| 298 | rockspec_format = "3.0" | ||
| 299 | package = "autodetect" | ||
| 300 | version = "1.0-1" | ||
| 301 | source = { | ||
| 302 | url = "file://]] .. testing_paths.fixtures_dir .. [[/autodetect/bla.lua" | ||
| 303 | } | ||
| 304 | description = { | ||
| 305 | summary = "An example rockspec", | ||
| 306 | } | ||
| 307 | dependencies = { | ||
| 308 | "lua >= 5.1" | ||
| 309 | } | ||
| 310 | ]], finally) | ||
| 311 | assert.truthy(run.luarocks_bool("build " .. rockspec)) | ||
| 312 | assert.match("bla.lua", run.luarocks("show autodetect")) | ||
| 313 | end) | ||
| 272 | end) | 314 | end) |
| 273 | 315 | ||
| 274 | describe("#mock external dependencies", function() | 316 | describe("#mock external dependencies", function() |
diff --git a/spec/fixtures/autodetect/bla.lua b/spec/fixtures/autodetect/bla.lua new file mode 100644 index 00000000..a5647075 --- /dev/null +++ b/spec/fixtures/autodetect/bla.lua | |||
| @@ -0,0 +1 @@ | |||
| return {} | |||
