2023-12-15 22:33:10 +08:00
|
|
|
//go:build !windows
|
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package gitutil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-02-01 02:59:26 +08:00
|
|
|
"github.com/docker/buildx/util/osutil"
|
2023-12-15 22:33:10 +08:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSanitizePathUnix(t *testing.T) {
|
2024-02-01 02:59:26 +08:00
|
|
|
assert.Equal(t, "/home/foobar", osutil.SanitizePath("/home/foobar"))
|
2023-12-15 22:33:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestSanitizePathWSL(t *testing.T) {
|
|
|
|
t.Setenv("WSL_DISTRO_NAME", "Ubuntu")
|
2024-02-01 02:59:26 +08:00
|
|
|
assert.Equal(t, "/mnt/c/Users/foobar", osutil.SanitizePath("C:\\Users\\foobar"))
|
2023-12-15 22:33:10 +08:00
|
|
|
}
|