Debian Codegraph @

test/fixedbugs/issue19040.go

raw
1 // run
2
3 // Copyright 2017 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Check the text of the panic that comes from
8 // a nil pointer passed to automatically generated method wrapper.
9
10 package main
11
12 import "fmt"
13
14 type T int
15
16 type I interface {
17 F()
18 }
19
20 func (t T) F() {}
21
22 var (
23 t *T
24 i I = t
25 )
26
27 func main() {
28 defer func() {
29 got := recover().(error).Error()
30 want := "value method main.T.F called using nil *T pointer"
31 if got != want {
32 fmt.Printf("panicwrap error text:\n\t%q\nwant:\n\t%q\n", got, want)
33 }
34 }()
35 i.F()
36 }