初始化
This commit is contained in:
25
platform/path_test.go
Normal file
25
platform/path_test.go
Normal 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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user