初始化

This commit is contained in:
李琦
2026-08-11 19:07:05 +08:00
commit d2aeb13a09
94 changed files with 8704 additions and 0 deletions

25
platform/path_test.go Normal file
View File

@@ -0,0 +1,25 @@
package platform
import "testing"
func TestResolveWSLPaths(t *testing.T) {
cases := []struct{ input, distro, linux string }{{`\\wsl.localhost\Ubuntu-24.04\home\lee\app`, "Ubuntu-24.04", "/home/lee/app"}, {`\\wsl$\Debian\opt\site`, "Debian", "/opt/site"}}
for _, c := range cases {
d, e := ResolvePath(c.input)
if e != nil {
t.Fatal(e)
}
if !d.WSL || d.Distro != c.distro || d.LinuxPath != c.linux {
t.Fatalf("%q => %#v", c.input, d)
}
}
}
func TestResolveWindowsPath(t *testing.T) {
d, e := ResolvePath(`D:\code\app`)
if e != nil {
t.Fatal(e)
}
if d.WSL {
t.Fatal("windows path detected as WSL")
}
}