test: silence/coalesce some tests

Add copyright notice to nilptr.go.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5139048
This commit is contained in:
Russ Cox 2011-09-26 19:35:21 -04:00
parent 4c462e6fd7
commit 4bdf1fc02b
14 changed files with 106 additions and 101 deletions

View File

@ -82,5 +82,4 @@ func main() {
// However, the result of the bug linked to at the top is that we'll
// end up panicking with: "throw: bad g->status in ready".
recver(cmux)
print("PASS\n")
}

View File

@ -279,5 +279,4 @@ func main() {
<-sync
}
}
print("PASS\n")
}

View File

@ -127,4 +127,44 @@ func main() {
istrue(z == x)
isfalse(z == y)
}
shouldPanic(p1)
shouldPanic(p2)
shouldPanic(p3)
shouldPanic(p4)
}
func p1() {
var a []int
var ia interface{} = a
use(ia == ia)
}
func p2() {
var b []int
var ib interface{} = b
use(ib == ib)
}
func p3() {
var a []int
var ia interface{} = a
var m = make(map[interface{}] int)
m[ia] = 1
}
func p4() {
var b []int
var ib interface{} = b
var m = make(map[interface{}] int)
m[ib] = 1
}
func shouldPanic(f func()) {
defer func() {
if recover() == nil {
panic("function should panic")
}
}()
f()
}

View File

@ -1,15 +0,0 @@
// $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
// license that can be found in the LICENSE file.
package main
func use(bool) { }
func main() {
var a []int
var ia interface{} = a
use(ia == ia)
}

View File

@ -1,15 +0,0 @@
// $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
// license that can be found in the LICENSE file.
package main
func use(bool) { }
func main() {
var b []int
var ib interface{} = b
use(ib == ib)
}

View File

@ -1,14 +0,0 @@
// $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
// license that can be found in the LICENSE file.
package main
func main() {
var a []int
var ia interface{} = a
var m = make(map[interface{}] int)
m[ia] = 1
}

View File

@ -1,14 +0,0 @@
// $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
// license that can be found in the LICENSE file.
package main
func main() {
var b []int
var ib interface{} = b
var m = make(map[interface{}] int)
m[ib] = 1
}

View File

@ -10,7 +10,6 @@ type S struct {
}
func (p *S) M() {
print("M\n");
}
type I interface {

View File

@ -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
@ -21,8 +21,24 @@ func main() {
if foo2(v2) != 1 {
panic(2)
}
shouldPanic(p1)
}
func p1() {
var i I
i = 1
var v3 = i.(int32) // This type conversion should fail at runtime.
if foo2(v3) != 1 {
panic(3)
}
}
func shouldPanic(f func()) {
defer func() {
if recover() == nil {
panic("function should panic")
}
}()
f()
}

View File

@ -1,4 +1,4 @@
// $G $D/$F.go && $L $F.$A && ! ./$A.out || echo BUG: should crash
// $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
@ -8,6 +8,8 @@ package main
type T struct {a, b int};
func println(x, y int) { }
func f(x interface{}) interface{} {
type T struct {a, b int};
@ -24,16 +26,29 @@ func main() {
inner_T := f(nil);
f(inner_T);
shouldPanic(p1)
}
func p1() {
outer_T := T{5, 7};
f(outer_T);
}
func shouldPanic(f func()) {
defer func() {
if recover() == nil {
panic("function should panic")
}
}()
f()
}
/*
This prints:
2 3
5 7
but it should crash: The type assertion on line 14 should fail
but it should crash: The type assertion on line 18 should fail
for the 2nd call to f with outer_T.
*/

View File

@ -1,18 +1,6 @@
== ./
=========== ./cmp2.go
panic: runtime error: comparing uncomparable type []int
=========== ./cmp3.go
panic: runtime error: comparing uncomparable type []int
=========== ./cmp4.go
panic: runtime error: hash of unhashable type []int
=========== ./cmp5.go
panic: runtime error: hash of unhashable type []int
=========== ./deferprint.go
printing: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
42 true false true +1.500000e+000 world 0x0 [0/0]0x0 0x0 0x0 255
@ -97,20 +85,8 @@ abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
== chan/
=========== chan/doubleselect.go
PASS
=========== chan/nonblock.go
PASS
== interface/
=========== interface/fail.go
panic: interface conversion: *main.S is not main.I: missing method Foo
=========== interface/returntype.go
panic: interface conversion: *main.S is not main.I2: missing method Name
== syntax/
== dwarf/
@ -139,16 +115,6 @@ inner loop top i 0
do break
broke
=========== fixedbugs/bug093.go
M
=========== fixedbugs/bug113.go
panic: interface conversion: interface is int, not int32
=========== fixedbugs/bug148.go
2 3
panic: interface conversion: interface is main.T, not main.T
=========== fixedbugs/bug328.go
0x0

View File

@ -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()
}

View File

@ -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()
}

View File

@ -1,5 +1,9 @@
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2011 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.
package main
import "unsafe"