diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/fixedbugs/bug229.go | 20 | ||||
-rw-r--r-- | test/fixedbugs/bug230.go | 25 | ||||
-rw-r--r-- | test/fixedbugs/bug231.go | 22 |
3 files changed, 67 insertions, 0 deletions
diff --git a/test/fixedbugs/bug229.go b/test/fixedbugs/bug229.go new file mode 100644 index 000000000..fe0f0d8c7 --- /dev/null +++ b/test/fixedbugs/bug229.go @@ -0,0 +1,20 @@ +// errchk $G -e $D/$F.go + +// 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 + +import "testing" + +func main() { + var t testing.T + + // make sure error mentions that + // ch is unexported, not just "ch not found". + + t.ch = nil // ERROR "unexported" + + println(testing.anyLowercaseName("asdf")) // ERROR "unexported" +} diff --git a/test/fixedbugs/bug230.go b/test/fixedbugs/bug230.go new file mode 100644 index 000000000..81b256e31 --- /dev/null +++ b/test/fixedbugs/bug230.go @@ -0,0 +1,25 @@ +// $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 + +type S string +type I int +type F float + +func (S) m() {} +func (I) m() {} +func (F) m() {} + +func main() { + c := make(chan interface { m() }, 10) + c <- I(0) + c <- F(1) + c <- S("hi") + <-c + <-c + <-c +} diff --git a/test/fixedbugs/bug231.go b/test/fixedbugs/bug231.go new file mode 100644 index 000000000..e11200b9c --- /dev/null +++ b/test/fixedbugs/bug231.go @@ -0,0 +1,22 @@ +// errchk $G -e $D/$F.go + +// 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 + +type I interface { m() } +type T struct { m func() } +type M struct {} +func (M) m() {} + +func main() { + var t T + var m M + var i I + + i = m + i = t // ERROR "not a method" + _ = i +} |