...
1 package name
2
3 import (
4 "runtime"
5 "testing"
6
7 "github.com/stretchr/testify/require"
8 )
9
10 func Test_Ident_FilePathJoin(t *testing.T) {
11 table := map[string]string{
12 "foo/bar/baz": "foo/bar/baz/boo",
13 "foo\\bar\\baz": "foo/bar/baz/boo",
14 }
15
16 if runtime.GOOS == "windows" {
17 table = ident_FilePathJoin_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, FilePathJoin(in, "boo"))
24 })
25 }
26 }
27
28 func ident_FilePathJoin_Windows_Table() map[string]string {
29 return map[string]string{
30 "foo/bar/baz": "foo\\bar\\baz\\boo",
31 "foo\\bar\\baz": "foo\\bar\\baz\\boo",
32 }
33 }
34
View as plain text