From 09fc5d993dd35ffcc29eb4914b3deece92b6cde8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=89=E6=BE=9C?= Date: Fri, 14 Aug 2026 10:32:20 +0800 Subject: [PATCH] test(skills): cover Windows chmod failure branch --- internal/upgrade/skill_path_move_errors_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/upgrade/skill_path_move_errors_test.go b/internal/upgrade/skill_path_move_errors_test.go index ca3c959d..b9d00850 100644 --- a/internal/upgrade/skill_path_move_errors_test.go +++ b/internal/upgrade/skill_path_move_errors_test.go @@ -171,6 +171,19 @@ func TestCrossPlatformCoverageSkillPathPermissionRestorationErrors(t *testing.T) } }) + t.Run("writable mode preparation chmod error", func(t *testing.T) { + entry := skillPathModeDirEntry{mode: os.ModeDir | 0o500} + testseam.Swap(t, &skillPathWalkDir, func(root string, fn fs.WalkDirFunc) error { + return fn(root, entry, nil) + }) + testseam.Swap(t, &skillPathChmod, func(string, os.FileMode) error { + return errors.New("chmod failed") + }) + if _, err := prepareSkillPathTreeRemoval("source"); err == nil || !strings.Contains(err.Error(), "chmod failed") { + t.Fatalf("error = %v", err) + } + }) + t.Run("entry info error", func(t *testing.T) { testseam.Swap(t, &skillPathWalkDir, func(root string, fn fs.WalkDirFunc) error { return fn(root, skillPathErrorDirEntry{}, nil)