diff options
| author | Renato Maia <maia.renato@gmail.com> | 2025-04-21 11:16:38 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2025-05-19 11:30:51 -0300 |
| commit | 4d7b546602b906f924ac91a01276cd3b2569ca9f (patch) | |
| tree | 6bf4b9927c543723d42c8777459e02e278d37896 /spec/build_spec.lua | |
| parent | 9b4ab564387e925a830e24b35dee46621a842f39 (diff) | |
| download | luarocks-4d7b546602b906f924ac91a01276cd3b2569ca9f.tar.gz luarocks-4d7b546602b906f924ac91a01276cd3b2569ca9f.tar.bz2 luarocks-4d7b546602b906f924ac91a01276cd3b2569ca9f.zip | |
feat: add LUA_VERSION build variable for rockspecs
Diffstat (limited to 'spec/build_spec.lua')
| -rw-r--r-- | spec/build_spec.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 034c70d7..ad6f4d42 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua | |||
| @@ -373,6 +373,52 @@ describe("LuaRocks build #integration", function() | |||
| 373 | end) | 373 | end) |
| 374 | end) | 374 | end) |
| 375 | 375 | ||
| 376 | describe("rockspec format 3.1", function() | ||
| 377 | it("version of Lua is not provided for old format", function() | ||
| 378 | test_env.run_in_tmp(function(tmpdir) | ||
| 379 | write_file("verify_argument.lua", string.format("assert(arg[1] == %q)", test_env.lua_version)) | ||
| 380 | write_file("uses_luaversion_variable-3.1-11.rockspec", [[ | ||
| 381 | package = "uses_luaversion_variable" | ||
| 382 | version = "3.1-11" | ||
| 383 | source = { | ||
| 384 | url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/verify_argument.lua" | ||
| 385 | } | ||
| 386 | dependencies = { | ||
| 387 | "lua >= 5.1" | ||
| 388 | } | ||
| 389 | build = { | ||
| 390 | type = "command", | ||
| 391 | build_command = "$(LUA) verify_argument.lua $(LUA_VERSION)", | ||
| 392 | } | ||
| 393 | ]]) | ||
| 394 | assert.is_false(run.luarocks_bool("build uses_luaversion_variable-3.1-11.rockspec")) | ||
| 395 | end, finally) | ||
| 396 | end) | ||
| 397 | |||
| 398 | it("version of Lua is provided as variable", function() | ||
| 399 | test_env.run_in_tmp(function(tmpdir) | ||
| 400 | write_file("verify_argument.lua", string.format("assert(arg[1] == %q)", test_env.lua_version)) | ||
| 401 | write_file("uses_luaversion_variable-3.1-11.rockspec", [[ | ||
| 402 | rockspec_format = "3.1" | ||
| 403 | package = "uses_luaversion_variable" | ||
| 404 | version = "3.1-11" | ||
| 405 | source = { | ||
| 406 | url = "file://]] .. tmpdir:gsub("\\", "/") .. [[/verify_argument.lua" | ||
| 407 | } | ||
| 408 | dependencies = { | ||
| 409 | "lua >= 5.1" | ||
| 410 | } | ||
| 411 | build = { | ||
| 412 | type = "command", | ||
| 413 | build_command = "$(LUA) verify_argument.lua $(LUA_VERSION)", | ||
| 414 | } | ||
| 415 | ]]) | ||
| 416 | assert.is_truthy(run.luarocks_bool("build uses_luaversion_variable-3.1-11.rockspec")) | ||
| 417 | assert.is.truthy(run.luarocks("show uses_luaversion_variable")) | ||
| 418 | end, finally) | ||
| 419 | end) | ||
| 420 | end) | ||
| 421 | |||
| 376 | describe("#mock external dependencies", function() | 422 | describe("#mock external dependencies", function() |
| 377 | lazy_setup(function() | 423 | lazy_setup(function() |
| 378 | test_env.setup_specs(nil, "mock") | 424 | test_env.setup_specs(nil, "mock") |
