diff options
| author | ruki <[email protected]> | 2026-08-15 00:51:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-15 00:51:42 +0800 |
| commit | cd3721d7fbd63387383050b6d345b69822b75ce1 (patch) | |
| tree | a8c67180b968976db95dcf449a9ef6d66fb4b0bc /tests/actions/addon/test.lua | |
| parent | fe6b792385a0b56716d703be3fd024380e1baea0 (diff) | |
improve project.load
Diffstat (limited to 'tests/actions/addon/test.lua')
| -rw-r--r-- | tests/actions/addon/test.lua | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/actions/addon/test.lua b/tests/actions/addon/test.lua index 4db9c0ddf..a14b7b3a5 100644 --- a/tests/actions/addon/test.lua +++ b/tests/actions/addon/test.lua @@ -258,8 +258,11 @@ function test_autofetch(t) _remove("custom-include") _with_project("autofetch", function (projectdir) - -- it should be installed when loading the project, so that its includes file can be found - t:require(os.iorunv("xmake", {"config", "-y"}):find("custom-include: includes check is loaded", 1, true)) + -- it should be installed when loading the project, so that its includes file can be found, + -- and we should tell the user why we install something, it may need to confirm and download + local output = os.iorunv("xmake", {"config", "-y"}) + t:require(output:find("custom-include: includes check is loaded", 1, true)) + t:require(output:find("this project needs the addons", 1, true)) -- and it should be locked local lockfile = path.join(projectdir, "xmake-addons.lock") @@ -272,6 +275,20 @@ function test_autofetch(t) end) end +-- every command builds the option menu, which merges the project tasks in a best-effort way, +-- so the commands which need not the project should never install its addons +function test_autofetch_skipped_for_option_menu(t) + local recipes = {["custom-include"] = ("set_sourcedir(%q)"):format(_addondir("custom-include"))} + _with_repo(recipes, function () + _remove("custom-include") + _with_project("autofetch", function (projectdir) + os.runv("xmake", {"addon", "--list"}) + os.runv("xmake", {"lua", "-c", "print(\"hello\")"}) + t:require_not(os.isfile(path.join(projectdir, "xmake-addons.lock"))) + 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 |
