test(install): build the localhost file URL from a slash path

On Windows the temp path starts with a drive letter, so prefixing it onto
file://localhost produced file://localhostC:\... instead of a valid URL and
the case failed on the Windows runner. Convert to slashes and add the
separator explicitly.
This commit is contained in:
Willie
2026-10-10 00:31:36 +08:00
parent e9ea9a8e07
commit 9da5f9bf1d
+1 -1
View File
@@ -325,7 +325,7 @@ func TestInstallTrackedRepo_RefusesLocalSourceInsideTheDestination(t *testing.T)
{"same path", "", func(p string) string { return p }, false},
{"nested path", "nested", func(p string) string { return p }, false},
{"explicit file URL", "nested", func(p string) string { return fileURL(p) }, false},
{"localhost file URL", "nested", func(p string) string { return "file://localhost" + p }, false},
{"localhost file URL", "nested", func(p string) string { return "file://localhost/" + strings.TrimPrefix(filepath.ToSlash(p), "/") }, false},
{"dry run", "nested", func(p string) string { return p }, true},
}
for _, tc := range cases {