forked from jmhodges/copyfighter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_test.go
25 lines (22 loc) · 827 Bytes
/
check_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
package main
import (
"bytes"
"testing"
)
func TestGoldenPath(t *testing.T) {
sites, fset, err := check("./testdata", 16, 8, 8)
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
b := &bytes.Buffer{}
printSites(sites, fset, b)
actual := string(b.Bytes())
if goldenData != actual {
t.Errorf("output doesn't match, want:\n%s\n=============\ngot:\n%s", goldenData, actual)
}
}
const goldenData = `testdata/inner.go:24:6: parameter 'f' at index 0 should be made into a pointer (func CallsFoo(f Foo))
testdata/inner.go:28:14: receiver, and parameter 'o' at index 0 should be made into pointers (func (Foo).OnOtherToo(o other))
testdata/inner.go:32:16: receiver should be made into a pointer (func (other).OnStruct())
testdata/inner.go:35:16: receiver should be made into a pointer (func (other).OnStruct2())
`