forked from extrame/goblet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hide_test.go
36 lines (31 loc) · 920 Bytes
/
hide_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
package goblet
import (
"fmt"
"testing"
)
type ShouldHidden struct {
Hidden string `goblet:"hide"`
NoHidden string
}
func TestHide(t *testing.T) {
var tested ShouldHidden
tested.Hidden = "1"
tested.NoHidden = "2"
fmt.Println(autoHide(&tested, nil))
}
func TestHideSlice(t *testing.T) {
var tested ShouldHidden
var testedArr = []ShouldHidden{tested}
tested.Hidden = "1"
tested.NoHidden = "2"
fmt.Println(autoHide(testedArr, nil))
}
func TestHideMatcher(t *testing.T) {
fmt.Println(hideMatcher.FindStringSubmatch("hide(/1/2/3,/4/5/6)"))
fmt.Println(hideMatcher.MatchString("hide(/1/2/3,/4/5/6)"))
fmt.Println(hideMatcher.FindStringSubmatch("hide/1/2/3,/4/5/6)"))
fmt.Println(hideMatcher.MatchString("hide/1/2/3,/4/5/6)"))
fmt.Println(hideMatcher.FindAllStringSubmatch("hide(/1/2/3)", -1))
fmt.Println(hideMatcher.FindAllStringSubmatch("hide", -1))
fmt.Println(hideMatcher.MatchString("hide"))
}