...
1 package name
2
3 import (
4 "runtime"
5 "testing"
6
7 "github.com/stretchr/testify/require"
8 )
9
10 func Test_Ident_OsPath(t *testing.T) {
11 table := map[string]string{
12 "foo/bar/baz": "foo/bar/baz",
13 "foo\\bar\\baz": "foo/bar/baz",
14 }
15
16 if runtime.GOOS == "windows" {
17 table = ident_OsPath_Windows_Table()
18 }
19
20 for in, out := range table {
21 t.Run(in, func(st *testing.T) {
22 r := require.New(st)
23 r.Equal(out, OsPath(in))
24 })
25 }
26 }
27
28 func ident_OsPath_Windows_Table() map[string]string {
29 return map[string]string{
30 "foo/bar/baz": "foo\\bar\\baz",
31 "foo\\bar\\baz": "foo\\bar\\baz",
32 }
33 }
34
View as plain text