| // Copyright 2016 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Test that an interface conversion error panics with an "interface |
| // conversion" run-time error. It was (incorrectly) panicking with a |
| // "nil pointer dereference." |
| re, ok := r.(runtime.Error) |
| panic(fmt.Sprintf("got %T, expected runtime.Error", r)) |
| if !strings.Contains(re.Error(), "interface conversion") { |
| panic(fmt.Sprintf("got %q, expected interface conversion error", re.Error())) |
| panic("unexpected interface conversion success") |
| panic("unexpected interface conversion success") |