forked from 3JoB/vfs
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
path_test.go
28 lines (26 loc) · 902 Bytes
/
path_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package vfs
import (
"reflect"
"testing"
)
func TestSplitPath(t *testing.T) {
const PathSeperator = "/"
if p := SplitPath("/", PathSeperator); !reflect.DeepEqual(p, []string{""}) {
t.Errorf("Invalid path: %q", p)
}
if p := SplitPath("./test", PathSeperator); !reflect.DeepEqual(p, []string{".", "test"}) {
t.Errorf("Invalid path: %q", p)
}
if p := SplitPath(".", PathSeperator); !reflect.DeepEqual(p, []string{"."}) {
t.Errorf("Invalid path: %q", p)
}
if p := SplitPath("test", PathSeperator); !reflect.DeepEqual(p, []string{".", "test"}) {
t.Errorf("Invalid path: %q", p)
}
if p := SplitPath("/usr/src/linux/", PathSeperator); !reflect.DeepEqual(p, []string{"", "usr", "src", "linux"}) {
t.Errorf("Invalid path: %q", p)
}
if p := SplitPath("usr/src/linux/", PathSeperator); !reflect.DeepEqual(p, []string{".", "usr", "src", "linux"}) {
t.Errorf("Invalid path: %q", p)
}
}