1 // Test of examples with divergent packages. 2 3 package buf_test 4 5 func Example() {} // OK because is package-level. 6 7 func Example_suffix() {} // OK because refers to suffix annotation. 8 9 func Example_BadSuffix() {} // ERROR "Example_BadSuffix has malformed example suffix: BadSuffix" 10 11 func ExampleBuf() {} // OK because refers to known top-level type. 12 13 func ExampleBuf_Append() {} // OK because refers to known method. 14 15 func ExampleBuf_Clear() {} // ERROR "ExampleBuf_Clear refers to unknown field or method: Buf.Clear" 16 17 func ExampleBuf_suffix() {} // OK because refers to suffix annotation. 18 19 func ExampleBuf_Append_Bad() {} // ERROR "ExampleBuf_Append_Bad has malformed example suffix: Bad" 20 21 func ExampleBuf_Append_suffix() {} // OK because refers to known method with valid suffix. 22 23 func ExampleDefaultBuf() {} // OK because refers to top-level identifier. 24 25 func ExampleBuf_Reset() bool { return true } // ERROR "ExampleBuf_Reset should return nothing" 26 27 func ExampleBuf_Len(i int) {} // ERROR "ExampleBuf_Len should be niladic" 28 29 // "Puffer" is German for "Buffer". 30 31 func ExamplePuffer() {} // ERROR "ExamplePuffer refers to unknown identifier: Puffer" 32 33 func ExamplePuffer_Append() {} // ERROR "ExamplePuffer_Append refers to unknown identifier: Puffer" 34 35 func ExamplePuffer_suffix() {} // ERROR "ExamplePuffer_suffix refers to unknown identifier: Puffer" 36