Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / unused / testdata / src / exported_method_test / exported_method_test.go
1 package pkg
2
3 import (
4         "bytes"
5         "io"
6         "io/ioutil"
7         "testing"
8 )
9
10 type countReadSeeker struct {
11         io.ReadSeeker
12         N int64
13 }
14
15 func (rs *countReadSeeker) Read(buf []byte) (int, error) {
16         n, err := rs.ReadSeeker.Read(buf)
17         rs.N += int64(n)
18         return n, err
19 }
20
21 func TestFoo(t *testing.T) {
22         r := bytes.NewReader([]byte("Hello, world!"))
23         cr := &countReadSeeker{ReadSeeker: r}
24         ioutil.ReadAll(cr)
25         if cr.N != 13 {
26                 t.Errorf("got %d, want 13", cr.N)
27         }
28 }
29
30 var sink int
31
32 func BenchmarkFoo(b *testing.B) {
33         for i := 0; i < b.N; i++ {
34                 sink = fn()
35         }
36 }
37
38 func fn() int { return 0 }