diff options
author | Russ Cox <rsc@golang.org> | 2011-09-26 19:35:21 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-09-26 19:35:21 -0400 |
commit | 4bdf1fc02bd44d539301d19c2781411d2c745b64 (patch) | |
tree | 072f4355df4fe675870f32f40136513be28d7869 /test/interface | |
parent | 4c462e6fd719861e03cab1a7c5c892b7db7baa11 (diff) | |
download | go-4bdf1fc02bd44d539301d19c2781411d2c745b64.tar.gz go-4bdf1fc02bd44d539301d19c2781411d2c745b64.zip |
test: silence/coalesce some tests
Add copyright notice to nilptr.go.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5139048
Diffstat (limited to 'test/interface')
-rw-r--r-- | test/interface/fail.go | 16 | ||||
-rw-r--r-- | test/interface/returntype.go | 15 |
2 files changed, 28 insertions, 3 deletions
diff --git a/test/interface/fail.go b/test/interface/fail.go index 3e741d3f91..0c20bcf756 100644 --- a/test/interface/fail.go +++ b/test/interface/fail.go @@ -1,4 +1,4 @@ -// $G $D/$F.go && $L $F.$A && ! ./$A.out +// $G $D/$F.go && $L $F.$A && ./$A.out // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -13,6 +13,10 @@ type I interface { } func main() { + shouldPanic(p1) +} + +func p1() { var s *S var i I var e interface {} @@ -21,6 +25,14 @@ func main() { _ = i } -// hide S down here to avoid static warning type S struct { } + +func shouldPanic(f func()) { + defer func() { + if recover() == nil { + panic("function should panic") + } + }() + f() +} diff --git a/test/interface/returntype.go b/test/interface/returntype.go index c526b3b0ec..5cf0836178 100644 --- a/test/interface/returntype.go +++ b/test/interface/returntype.go @@ -1,4 +1,4 @@ -// $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not succeed) +// $G $D/$F.go && $L $F.$A && ./$A.out // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -18,8 +18,21 @@ type I1 interface { Name() int8 } type I2 interface { Name() int64 } func main() { + shouldPanic(p1) +} + +func p1() { var i1 I1 var s *S i1 = s print(i1.(I2).Name()) } + +func shouldPanic(f func()) { + defer func() { + if recover() == nil { + panic("function should panic") + } + }() + f() +} |