Dan Willemsen | f3f2eb6 | 2018-08-28 11:28:58 -0700 | [diff] [blame] | 1 | // run |
2 | |||||
3 | // Copyright 2018 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 that calling a nil func causes a proper panic. | ||||
8 | |||||
9 | package main | ||||
10 | |||||
11 | func main() { | ||||
12 | defer func() { | ||||
13 | err := recover() | ||||
14 | if err == nil { | ||||
15 | panic("panic expected") | ||||
16 | } | ||||
17 | }() | ||||
18 | |||||
19 | var f func() | ||||
20 | f() | ||||
21 | } |