Files
dingtalk-workspace-cli/internal/upgrade/skill_path_move_windows_test.go
玉澜 f14332f143 fix(skills): guard pruneSkillBackups against non-DWS directories
Restrict backup pruning to directories whose names match the DWS stamp
format (YYYYmmdd-HHMMSS with optional -N suffix) across all 8 installer
surfaces (Go, npm, 4 shell, 2 PowerShell). Unknown directories in
~/.dws/skill-backups are now preserved. Also fixes Windows coverage test
portability and covers the remaining macOS changed-code gap (retire
warning loop in runUpgrade).
2026-08-17 20:20:32 +08:00

25 lines
525 B
Go

//go:build windows
package upgrade
import (
"os"
"testing"
"golang.org/x/sys/windows"
)
func testCrossDeviceError() error {
return &os.LinkError{Op: "rename", Old: "src", New: "dst", Err: windows.ERROR_NOT_SAME_DEVICE}
}
func testNoReplaceUnsupportedErrors() []error {
return []error{errNoReplaceRenameUnsupported}
}
func TestCrossPlatformCoverageWindowsCrossDeviceError(t *testing.T) {
if !isCrossDeviceError(testCrossDeviceError()) {
t.Fatal("ERROR_NOT_SAME_DEVICE must enter the cross-device fallback")
}
}