forked from kisielk/errcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
excludes_test.go
39 lines (35 loc) · 830 Bytes
/
excludes_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
package errcheck
import (
"reflect"
"testing"
)
func TestReadExcludes(t *testing.T) {
expectedExcludes := []string{
"hello()",
"world()",
}
t.Logf("expectedExcludes: %#v", expectedExcludes)
excludes, err := ReadExcludes("testdata/excludes.txt")
if err != nil {
t.Fatal(err)
}
t.Logf("excludes: %#v", excludes)
if !reflect.DeepEqual(expectedExcludes, excludes) {
t.Fatal("excludes did not match expectedExcludes")
}
}
func TestReadEmptyExcludes(t *testing.T) {
excludes, err := ReadExcludes("testdata/empty_excludes.txt")
if err != nil {
t.Fatal(err)
}
if len(excludes) != 0 {
t.Fatalf("expected empty excludes, got %#v", excludes)
}
}
func TestReadExcludesMissingFile(t *testing.T) {
_, err := ReadExcludes("testdata/missing_file")
if err == nil {
t.Fatal("expected non-nil err, got nil")
}
}