Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / go / analysis / passes / tests / testdata / src / a / a_test.go
1 package a
2
3 import (
4         "testing"
5 )
6
7 // Buf is a ...
8 type Buf []byte
9
10 // Append ...
11 func (*Buf) Append([]byte) {}
12
13 func (Buf) Reset() {}
14
15 func (Buf) Len() int { return 0 }
16
17 // DefaultBuf is a ...
18 var DefaultBuf Buf
19
20 func Example() {} // OK because is package-level.
21
22 func Example_goodSuffix() {} // OK because refers to suffix annotation.
23
24 func Example_BadSuffix() {} // want "Example_BadSuffix has malformed example suffix: BadSuffix"
25
26 func ExampleBuf() {} // OK because refers to known top-level type.
27
28 func ExampleBuf_Append() {} // OK because refers to known method.
29
30 func ExampleBuf_Clear() {} // want "ExampleBuf_Clear refers to unknown field or method: Buf.Clear"
31
32 func ExampleBuf_suffix() {} // OK because refers to suffix annotation.
33
34 func ExampleBuf_Append_Bad() {} // want "ExampleBuf_Append_Bad has malformed example suffix: Bad"
35
36 func ExampleBuf_Append_suffix() {} // OK because refers to known method with valid suffix.
37
38 func ExampleDefaultBuf() {} // OK because refers to top-level identifier.
39
40 func ExampleBuf_Reset() bool { return true } // want "ExampleBuf_Reset should return nothing"
41
42 func ExampleBuf_Len(i int) {} // want "ExampleBuf_Len should be niladic"
43
44 // "Puffer" is German for "Buffer".
45
46 func ExamplePuffer() {} // want "ExamplePuffer refers to unknown identifier: Puffer"
47
48 func ExamplePuffer_Append() {} // want "ExamplePuffer_Append refers to unknown identifier: Puffer"
49
50 func ExamplePuffer_suffix() {} // want "ExamplePuffer_suffix refers to unknown identifier: Puffer"
51
52 func ExampleFoo() {} // OK because a.Foo exists
53
54 func ExampleBar() {} // want "ExampleBar refers to unknown identifier: Bar"
55
56 func nonTest() {} // OK because it doesn't start with "Test".
57
58 func (Buf) TesthasReceiver() {} // OK because it has a receiver.
59
60 func TestOKSuffix(*testing.T) {} // OK because first char after "Test" is Uppercase.
61
62 func TestÜnicodeWorks(*testing.T) {} // OK because the first char after "Test" is Uppercase.
63
64 func TestbadSuffix(*testing.T) {} // want "first letter after 'Test' must not be lowercase"
65
66 func TestemptyImportBadSuffix(*testing.T) {} // want "first letter after 'Test' must not be lowercase"
67
68 func Test(*testing.T) {} // OK "Test" on its own is considered a test.
69
70 func Testify() {} // OK because it takes no parameters.
71
72 func TesttooManyParams(*testing.T, string) {} // OK because it takes too many parameters.
73
74 func TesttooManyNames(a, b *testing.T) {} // OK because it takes too many names.
75
76 func TestnoTParam(string) {} // OK because it doesn't take a *testing.T
77
78 func BenchmarkbadSuffix(*testing.B) {} // want "first letter after 'Benchmark' must not be lowercase"