From 3d7e4d3b874b1a22e03bae112096918808473536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Tr=C4=85tnowiecki?= Date: Tue, 24 Feb 2026 19:21:33 +0100 Subject: [PATCH 1/3] fix: Do not accept latest as version name in dummy repo fixture --- test/fixtures/dummy_plugin/bin/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/dummy_plugin/bin/install b/test/fixtures/dummy_plugin/bin/install index 1d511dafe..850e2edd3 100755 --- a/test/fixtures/dummy_plugin/bin/install +++ b/test/fixtures/dummy_plugin/bin/install @@ -2,7 +2,7 @@ # We want certain versions to fail installation for various reasons in the tests check_dummy_versions() { - local bad_versions=" other-dummy " + local bad_versions=" other-dummy latest " if [[ "$bad_versions" == *" $ASDF_INSTALL_VERSION "* ]]; then echo "Dummy couldn't install version: $ASDF_INSTALL_VERSION (on purpose)" exit 1 From f133ba70321c7cc7f0047d3fad6c55297bcb0c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Tr=C4=85tnowiecki?= Date: Tue, 24 Feb 2026 19:24:28 +0100 Subject: [PATCH 2/3] fix: Add test case for plugin test resolving latest version --- test/plugin_test_command.bats | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/plugin_test_command.bats b/test/plugin_test_command.bats index 389f8bb2d..2e66ac74f 100644 --- a/test/plugin_test_command.bats +++ b/test/plugin_test_command.bats @@ -32,3 +32,8 @@ teardown() { run asdf plugin test dummy "${BASE_DIR}/repo-dummy" --asdf-tool-version 1.0.0 --asdf-plugin-gitref master [ "$status" -eq 0 ] } + +@test "plugin_test_command resolves latest version when --asdf-tool-version latest is provided" { + run asdf plugin test dummy "${BASE_DIR}/repo-dummy" --asdf-tool-version latest + [ "$status" -eq 0 ] +} From 4585b6f42c2784c1d69e97f36a8067925d6bbdd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Tr=C4=85tnowiecki?= Date: Tue, 24 Feb 2026 18:44:40 +0100 Subject: [PATCH 3/3] fix: Make plugin test resolve latest version --- internal/cli/cli.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 7dd074017..8085f22b3 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -1028,10 +1028,18 @@ func pluginTestCommand(l *log.Logger, args []string, toolVersion, ref string) { failTest(l, "list-all did not return any version") } - // grab first version returned by list-all callback if no version provided as - // a CLI argument + // Resolve version: if empty use first from list-all; if "latest" or + // "latest:" resolve via the plugin's latest-stable callback. if toolVersion == "" { toolVersion = allVersions[0] + } else if toolVersion == "latest" || strings.HasPrefix(toolVersion, "latest:") { + query := strings.TrimPrefix(toolVersion, "latest") + query = strings.TrimPrefix(query, ":") + resolved, err := versions.Latest(plugin, query) + if err != nil || resolved == "" { + failTest(l, "could not get latest version") + } + toolVersion = resolved } err = versions.InstallOneVersion(conf, plugin, toolVersion, false, os.Stdout, os.Stderr)