summaryrefslogtreecommitdiff
path: root/tests/actions/addon
diff options
context:
space:
mode:
authorruki <[email protected]>2026-08-15 22:52:26 +0800
committerruki <[email protected]>2026-08-15 22:52:26 +0800
commit2f9993a333a820006b4cf6a18f6dd753cfe48eec (patch)
tree6cd8c1fdb40cb91ed23551943d6a35db0fd3a1b2 /tests/actions/addon
parent65854acd5e7080dae4cac3e3b3ec1ce01e902ae7 (diff)
add addon test
Diffstat (limited to 'tests/actions/addon')
-rw-r--r--tests/actions/addon/projects/autofetch-lockmiss/xmake-addons.lock9
-rw-r--r--tests/actions/addon/projects/autofetch-lockmiss/xmake-addons.lua1
-rw-r--r--tests/actions/addon/projects/autofetch-lockmiss/xmake.lua2
-rw-r--r--tests/actions/addon/test.lua14
4 files changed, 26 insertions, 0 deletions
diff --git a/tests/actions/addon/projects/autofetch-lockmiss/xmake-addons.lock b/tests/actions/addon/projects/autofetch-lockmiss/xmake-addons.lock
new file mode 100644
index 000000000..750a8e609
--- /dev/null
+++ b/tests/actions/addon/projects/autofetch-lockmiss/xmake-addons.lock
@@ -0,0 +1,9 @@
+{
+ __meta__ = {
+ version = "1.0"
+ },
+ -- this version is not installed, we only install `latest` from the local directory
+ ["custom-include"] = {
+ version = "v9.9.9"
+ }
+}
diff --git a/tests/actions/addon/projects/autofetch-lockmiss/xmake-addons.lua b/tests/actions/addon/projects/autofetch-lockmiss/xmake-addons.lua
new file mode 100644
index 000000000..a85e0fe11
--- /dev/null
+++ b/tests/actions/addon/projects/autofetch-lockmiss/xmake-addons.lua
@@ -0,0 +1 @@
+add_addons("custom-include")
diff --git a/tests/actions/addon/projects/autofetch-lockmiss/xmake.lua b/tests/actions/addon/projects/autofetch-lockmiss/xmake.lua
new file mode 100644
index 000000000..0d94cf61c
--- /dev/null
+++ b/tests/actions/addon/projects/autofetch-lockmiss/xmake.lua
@@ -0,0 +1,2 @@
+target("test")
+ set_kind("phony")
diff --git a/tests/actions/addon/test.lua b/tests/actions/addon/test.lua
index 192230b08..74b733b21 100644
--- a/tests/actions/addon/test.lua
+++ b/tests/actions/addon/test.lua
@@ -357,6 +357,20 @@ function test_autofetch_build(t)
end)
end
+-- a locked version which is not installed must not hide the addon
+--
+-- @note the auto-fetch installs the locked version, but the commands which do not load
+-- the project content only pin it, e.g. `xmake lua`, @see project._pin_addons()
+--
+function test_autofetch_lock_missing_version(t)
+ _with_addons({"custom-include"}, function ()
+ _with_project("autofetch-lockmiss", function ()
+ local script = "import(\"core.package.addon\"); print(addon.addons()[\"custom-include\"] ~= nil)"
+ t:require(os.iorunv("xmake", {"lua", "-c", script}):find("true", 1, true))
+ end)
+ end)
+end
+
-- the addons file only declares the addons, it cannot reference them
function test_autofetch_invalid(t)
for _, name in ipairs({"autofetch-badinclude", "autofetch-badname"}) do