-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter_test.go
More file actions
63 lines (53 loc) · 1.38 KB
/
Copy pathfilter_test.go
File metadata and controls
63 lines (53 loc) · 1.38 KB
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
package main
import "testing"
func TestFilterNoFile(t *testing.T) {
files := []string{"testdata/cover_1.out"}
profiles, err := loadProfilesForFiles(files)
if err != nil {
t.Fatal("fatal profile read", err)
}
if len(profiles) != 1 {
t.Fatal("profile len not 1", len(profiles))
}
ret, err := filterProfiles(profiles, "nofile")
if err != nil {
t.Fatal("unexpected error", err)
}
if len(ret) != len(profiles) {
t.Fatal("len wrong", len(profiles), len(ret))
}
}
func TestFilterIncludeAll(t *testing.T) {
files := []string{"testdata/cover_1.out"}
profiles, err := loadProfilesForFiles(files)
if err != nil {
t.Fatal("fatal profile read", err)
}
if len(profiles) != 1 {
t.Fatal("profile len not 1", len(profiles))
}
ret, err := filterProfiles(profiles, "testdata/filter")
if err != nil {
t.Fatal("unexpected error", err)
}
if len(ret) != len(profiles) {
t.Fatal("len wrong", len(profiles), len(ret))
}
}
func TestFilterIncludeNoAlt(t *testing.T) {
files := []string{"testdata/cover_multi.out"}
profiles, err := loadProfilesForFiles(files)
if err != nil {
t.Fatal("fatal profile read", err)
}
if len(profiles) != 3 {
t.Fatal("profile len not 3", len(profiles))
}
ret, err := filterProfiles(profiles, "testdata/filter")
if err != nil {
t.Fatal("unexpected error", err)
}
if len(ret) != 1 {
t.Fatal("len wrong alt still in?", len(profiles), len(ret))
}
}