@@ -10,7 +10,7 @@ import (
10
10
func TestHandler_FilterItems (t * testing.T ) {
11
11
now := time .Now ()
12
12
var h * handler
13
- var infos []os.FileInfo
13
+ var items []os.FileInfo
14
14
var ok bool
15
15
16
16
re2 := regexp .MustCompile ("2" )
@@ -24,76 +24,76 @@ func TestHandler_FilterItems(t *testing.T) {
24
24
file2 := dummyFileInfo {"file2" , 0 , now , false }
25
25
file3 := dummyFileInfo {"file3" , 0 , now , false }
26
26
27
- originInfos := []os.FileInfo {dir1 , dir2 , dir3 , file1 , file2 , file3 }
27
+ originalItems := []os.FileInfo {dir1 , dir2 , dir3 , file1 , file2 , file3 }
28
28
29
29
h = & handler {shows : re2 }
30
- infos = h .FilterItems (originInfos )
31
- ok = expectInfos ( infos , dir2 , file2 )
30
+ items = h .FilterItems (originalItems )
31
+ ok = expectItems ( items , dir2 , file2 )
32
32
if ! ok {
33
- t .Errorf ("%+v\n " , infos )
33
+ t .Errorf ("%+v\n " , items )
34
34
}
35
35
36
36
h = & handler {showDirs : re2 }
37
- infos = h .FilterItems (originInfos )
38
- ok = expectInfos ( infos , dir2 , file1 , file2 , file3 )
37
+ items = h .FilterItems (originalItems )
38
+ ok = expectItems ( items , dir2 , file1 , file2 , file3 )
39
39
if ! ok {
40
- t .Errorf ("%+v\n " , infos )
40
+ t .Errorf ("%+v\n " , items )
41
41
}
42
42
43
43
h = & handler {showFiles : re2 }
44
- infos = h .FilterItems (originInfos )
45
- ok = expectInfos ( infos , dir1 , dir2 , dir3 , file2 )
44
+ items = h .FilterItems (originalItems )
45
+ ok = expectItems ( items , dir1 , dir2 , dir3 , file2 )
46
46
if ! ok {
47
- t .Errorf ("%+v\n " , infos )
47
+ t .Errorf ("%+v\n " , items )
48
48
}
49
49
50
50
h = & handler {hides : re2 }
51
- infos = h .FilterItems (originInfos )
52
- ok = expectInfos ( infos , dir1 , dir3 , file1 , file3 )
51
+ items = h .FilterItems (originalItems )
52
+ ok = expectItems ( items , dir1 , dir3 , file1 , file3 )
53
53
if ! ok {
54
- t .Errorf ("%+v\n " , infos )
54
+ t .Errorf ("%+v\n " , items )
55
55
}
56
56
57
57
h = & handler {hideDirs : re2 }
58
- infos = h .FilterItems (originInfos )
59
- ok = expectInfos ( infos , dir1 , dir3 , file1 , file2 , file3 )
58
+ items = h .FilterItems (originalItems )
59
+ ok = expectItems ( items , dir1 , dir3 , file1 , file2 , file3 )
60
60
if ! ok {
61
- t .Errorf ("%+v\n " , infos )
61
+ t .Errorf ("%+v\n " , items )
62
62
}
63
63
64
64
h = & handler {hideFiles : re2 }
65
- infos = h .FilterItems (originInfos )
66
- ok = expectInfos ( infos , dir1 , dir2 , dir3 , file1 , file3 )
65
+ items = h .FilterItems (originalItems )
66
+ ok = expectItems ( items , dir1 , dir2 , dir3 , file1 , file3 )
67
67
if ! ok {
68
- t .Errorf ("%+v\n " , infos )
68
+ t .Errorf ("%+v\n " , items )
69
69
}
70
70
71
71
h = & handler {shows : re2 , hides : re3 }
72
- infos = h .FilterItems (originInfos )
73
- ok = expectInfos ( infos , dir2 , file2 )
72
+ items = h .FilterItems (originalItems )
73
+ ok = expectItems ( items , dir2 , file2 )
74
74
if ! ok {
75
- t .Errorf ("%+v\n " , infos )
75
+ t .Errorf ("%+v\n " , items )
76
76
}
77
77
78
78
h = & handler {shows : re2 , hides : re2 }
79
- infos = h .FilterItems (originInfos )
80
- ok = expectInfos ( infos )
79
+ items = h .FilterItems (originalItems )
80
+ ok = expectItems ( items )
81
81
if ! ok {
82
- t .Errorf ("%+v\n " , infos )
82
+ t .Errorf ("%+v\n " , items )
83
83
}
84
84
85
85
h = & handler {shows : re2 , hideDirs : re2 }
86
- infos = h .FilterItems (originInfos )
87
- ok = expectInfos ( infos , file2 )
86
+ items = h .FilterItems (originalItems )
87
+ ok = expectItems ( items , file2 )
88
88
if ! ok {
89
- t .Errorf ("%+v\n " , infos )
89
+ t .Errorf ("%+v\n " , items )
90
90
}
91
91
92
92
h = & handler {shows : re2 , hideFiles : re2 }
93
- infos = h .FilterItems (originInfos )
94
- ok = expectInfos ( infos , dir2 )
93
+ items = h .FilterItems (originalItems )
94
+ ok = expectItems ( items , dir2 )
95
95
if ! ok {
96
- t .Errorf ("%+v\n " , infos )
96
+ t .Errorf ("%+v\n " , items )
97
97
}
98
98
99
99
}
0 commit comments