buildx/util/gitutil/path_unix_test.go

21 lines
438 B
Go
Raw Normal View History

//go:build !windows
// +build !windows
package gitutil
import (
"testing"
"github.com/docker/buildx/util/osutil"
"github.com/stretchr/testify/assert"
)
func TestSanitizePathUnix(t *testing.T) {
assert.Equal(t, "/home/foobar", osutil.SanitizePath("/home/foobar"))
}
func TestSanitizePathWSL(t *testing.T) {
t.Setenv("WSL_DISTRO_NAME", "Ubuntu")
assert.Equal(t, "/mnt/c/Users/foobar", osutil.SanitizePath("C:\\Users\\foobar"))
}