-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparent_test.go
64 lines (54 loc) · 1.25 KB
/
parent_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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package runpath
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
)
func Test_parentNamespace_Path(t *testing.T) {
t.Log(PARENT.Path())
}
func Test_parentNamespace_Name(t *testing.T) {
name := PARENT.Name()
t.Log(name)
require.Equal(t, "runpath", name)
}
func Test_parentNamespace_Skip(t *testing.T) {
t.Log(PARENT.Skip(0))
}
func Test_parentNamespace_Join(t *testing.T) {
t.Log(PARENT.Join("example.json"))
}
func Test_parentNamespace_Join1(t *testing.T) {
name := Name()
t.Log(name)
root := DIR.Path() // perhaps this variable should be named "dir", but "dir" is too ugly, more ugly than "ugly". so I prefer to use "root" to clean code.
t.Log(root)
path := filepath.Join(root, name)
t.Log(path)
want := Path()
t.Log(want)
require.Equal(t, want, path)
}
func Test_parentNamespace_Join2(t *testing.T) {
name := Name()
t.Log(name)
path := DIR.Join(name)
t.Log(path)
want := Path()
t.Log(want)
require.Equal(t, want, path)
}
func Test_parentNamespace_Up(t *testing.T) {
for depth := 0; depth < 10; depth++ {
t.Log(DIR.Up(depth))
}
}
func Test_parentNamespace_UpTo(t *testing.T) {
name := DIR.Name()
t.Log(name)
path := DIR.UpTo(1, name)
t.Log(path)
want := DIR.Path()
t.Log(want)
require.Equal(t, want, path)
}