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).
25 lines
525 B
Go
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")
|
|
}
|
|
}
|