Codebase list golang-github-gobuffalo-packr / de5e7b37-512d-4c4f-9df9-fc59296f94bc/upstream v2 / file / resolver / ident_test.go
de5e7b37-512d-4c4f-9df9-fc59296f94bc/upstream

Tree @de5e7b37-512d-4c4f-9df9-fc59296f94bc/upstream (Download .tar.gz)

ident_test.go @de5e7b37-512d-4c4f-9df9-fc59296f94bc/upstreamraw · history · blame

package resolver

import (
	"runtime"
	"testing"

	"github.com/stretchr/testify/require"
)

func Test_Ident_OsPath(t *testing.T) {
	table := map[string]string{
		"foo/bar/baz":   "foo/bar/baz",
		"foo\\bar\\baz": "foo/bar/baz",
	}

	if runtime.GOOS == "windows" {
		table = ident_OsPath_Windows_Table()
	}

	for in, out := range table {
		t.Run(in, func(st *testing.T) {
			r := require.New(st)
			r.Equal(out, OsPath(in))
		})
	}
}

func ident_OsPath_Windows_Table() map[string]string {
	return map[string]string{
		"foo/bar/baz":   "foo\\bar\\baz",
		"foo\\bar\\baz": "foo\\bar\\baz",
	}
}