-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils_test.go
More file actions
37 lines (34 loc) · 786 Bytes
/
utils_test.go
File metadata and controls
37 lines (34 loc) · 786 Bytes
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
package iip
import "testing"
// func TestValidatePath(t *testing.T) {
// pathOk := "/hello_abc-xx-dd1211234//"
// if !ValidatePath(pathOk) {
// t.Fatalf("fail")
// }
// pathNotOk := "/hello_abc-xx-d^d1211$234//"
// if ValidatePath(pathNotOk) {
// t.Fatalf("fail")
// }
// }
func TestDefaultContext(t *testing.T) {
ctx := &DefaultContext{}
if ctx.GetCtxData("testkey") != nil {
t.Fatalf("fail")
}
ctx.SetCtxData("testkey", ctx)
if ctx.GetCtxData("testkey") != ctx {
t.Fatalf("fail")
}
ctx.SetCtxData("testkey", nil)
if ctx.GetCtxData("testkey") != nil {
t.Fatalf("fail")
}
ctx.SetCtxData("testkey", ctx)
if ctx.GetCtxData("testkey") != ctx {
t.Fatalf("fail")
}
ctx.RemoveCtxData("testkey")
if ctx.GetCtxData("testkey") != nil {
t.Fatalf("fail")
}
}