mirror of
https://github.com/golang/go
synced 2024-11-18 15:24:41 -07:00
0ced849c61
The documentation for the testing package states only that "The suffix must start with a lower-case letter." Fixes golang/go#12663 Change-Id: I9b079b105a7c9680325fed442c42adcf3b75055e Reviewed-on: https://go-review.googlesource.com/14760 Reviewed-by: Andrew Gerrand <adg@golang.org>
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
// Test of examples.
|
|
|
|
package testdata
|
|
|
|
// Buf is a ...
|
|
type Buf []byte
|
|
|
|
// Append ...
|
|
func (*Buf) Append([]byte) {}
|
|
|
|
func (Buf) Reset() {}
|
|
|
|
func (Buf) Len() int { return 0 }
|
|
|
|
// DefaultBuf is a ...
|
|
var DefaultBuf Buf
|
|
|
|
func Example() {} // OK because is package-level.
|
|
|
|
func Example_goodSuffix() // OK because refers to suffix annotation.
|
|
|
|
func Example_BadSuffix() // ERROR "Example_BadSuffix has malformed example suffix: BadSuffix"
|
|
|
|
func ExampleBuf() // OK because refers to known top-level type.
|
|
|
|
func ExampleBuf_Append() {} // OK because refers to known method.
|
|
|
|
func ExampleBuf_Clear() {} // ERROR "ExampleBuf_Clear refers to unknown field or method: Buf.Clear"
|
|
|
|
func ExampleBuf_suffix() {} // OK because refers to suffix annotation.
|
|
|
|
func ExampleBuf_Append_Bad() {} // ERROR "ExampleBuf_Append_Bad has malformed example suffix: Bad"
|
|
|
|
func ExampleBuf_Append_suffix() {} // OK because refers to known method with valid suffix.
|
|
|
|
func ExampleDefaultBuf() {} // OK because refers to top-level identifier.
|
|
|
|
func ExampleBuf_Reset() bool { return true } // ERROR "ExampleBuf_Reset should return nothing"
|
|
|
|
func ExampleBuf_Len(i int) {} // ERROR "ExampleBuf_Len should be niladic"
|
|
|
|
// "Puffer" is German for "Buffer".
|
|
|
|
func ExamplePuffer() // ERROR "ExamplePuffer refers to unknown identifier: Puffer"
|
|
|
|
func ExamplePuffer_Append() // ERROR "ExamplePuffer_Append refers to unknown identifier: Puffer"
|
|
|
|
func ExamplePuffer_suffix() // ERROR "ExamplePuffer_suffix refers to unknown identifier: Puffer"
|