test(link): compare canonical paths for the option terminator case

macOS temp directories live under /var, a symlink to /private/var, so
EvalSymlinks on the created link returns the /private form while the test
compared it with the raw t.TempDir() path. Canonicalize the expected path
as well so the integration test passes on macOS runners.
This commit is contained in:
Willie
2026-10-05 22:58:13 +08:00
parent 9db36b472a
commit ecb410ff95
+7 -2
View File
@@ -141,8 +141,13 @@ func TestLink_OptionTerminatorPath(t *testing.T) {
checkout := filepath.Join(sb.Root, "-checkout")
sb.WriteFile(filepath.Join(checkout, "foo", "SKILL.md"), "---\nname: foo\n---\n# foo")
sb.RunCLIInDir(sb.Root, "link", "--global", "--", "-checkout").AssertSuccess(t)
if got, err := filepath.EvalSymlinks(filepath.Join(sb.SourcePath, "_-checkout")); err != nil || got != checkout {
t.Fatalf("link target = %q, %v; want %s", got, err, checkout)
// macOS temp dirs live under /var -> /private/var, so compare canonical paths.
want, err := filepath.EvalSymlinks(checkout)
if err != nil {
t.Fatal(err)
}
if got, err := filepath.EvalSymlinks(filepath.Join(sb.SourcePath, "_-checkout")); err != nil || got != want {
t.Fatalf("link target = %q, %v; want %s", got, err, want)
}
}