1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:47:56 -07:00

move invalid method uses to new test

R=iant
DELTA=24  (13 added, 10 deleted, 1 changed)
OCL=18424
CL=18439
This commit is contained in:
Russ Cox 2008-11-04 09:45:27 -08:00
parent 7cd11c1c09
commit d289e6344f
3 changed files with 18 additions and 11 deletions

View File

@ -37,6 +37,9 @@ Faulting address: 0x0
pc: xxx pc: xxx
=========== ./method2.go
BUG: errchk: command succeeded unexpectedly: 6g ./method2.go
=========== ./peano.go =========== ./peano.go
0! = 1 0! = 1
1! = 1 1! = 1
@ -121,7 +124,7 @@ BUG: fails incorrectly
=========== bugs/bug095.go =========== bugs/bug095.go
found 2, expected 1 found 2, expected 1
panic on line 74 PC=xxx panic on line 77 PC=xxx
BUG wrong result BUG wrong result
=========== bugs/bug098.go =========== bugs/bug098.go

View File

@ -10,8 +10,6 @@ type S string
type S1 string type S1 string
type I int type I int
type I1 int type I1 int
type P *int
type P1 *int
type T struct { x int } type T struct { x int }
type T1 T type T1 T
@ -19,8 +17,6 @@ func (s S) val() int { return 1 }
func (s *S1) val() int { return 2 } func (s *S1) val() int { return 2 }
func (i I) val() int { return 3 } func (i I) val() int { return 3 }
func (i *I1) val() int { return 4 } func (i *I1) val() int { return 4 }
func (p P) val() int { return 5 }
func (p *P1) val() int { return 6 }
//func (t T) val() int { return 7 } //func (t T) val() int { return 7 }
func (t *T1) val() int { return 8 } func (t *T1) val() int { return 8 }
@ -37,8 +33,6 @@ func main() {
var ps *S1; var ps *S1;
var i I; var i I;
var pi *I1; var pi *I1;
var p P;
var pp *P1;
var t T; var t T;
var pt *T1; var pt *T1;
@ -46,8 +40,6 @@ func main() {
if ps.val() != 2 { panicln("ps.val:", ps.val()) } if ps.val() != 2 { panicln("ps.val:", ps.val()) }
if i.val() != 3 { panicln("i.val:", i.val()) } if i.val() != 3 { panicln("i.val:", i.val()) }
if pi.val() != 4 { panicln("pi.val:", pi.val()) } if pi.val() != 4 { panicln("pi.val:", pi.val()) }
if p.val() != 5 { panicln("p.val:", p.val()) }
if pp.val() != 6 { panicln("pp.val:", pp.val()) }
// if t.val() != 7 { panicln("t.val:", t.val()) } // if t.val() != 7 { panicln("t.val:", t.val()) }
if pt.val() != 8 { panicln("pt.val:", pt.val()) } if pt.val() != 8 { panicln("pt.val:", pt.val()) }
@ -55,8 +47,6 @@ func main() {
if val(ps) != 2 { panicln("ps.val:", val(ps)) } if val(ps) != 2 { panicln("ps.val:", val(ps)) }
if val(i) != 3 { panicln("i.val:", val(i)) } if val(i) != 3 { panicln("i.val:", val(i)) }
if val(pi) != 4 { panicln("pi.val:", val(pi)) } if val(pi) != 4 { panicln("pi.val:", val(pi)) }
if val(p) != 5 { panicln("p.val:", val(p)) }
if val(pp) != 6 { panicln("pp.val:", val(pp)) }
// if val(t) != 7 { panicln("t.val:", val(t)) } // if val(t) != 7 { panicln("t.val:", val(t)) }
if val(pt) != 8 { panicln("pt.val:", val(pt)) } if val(pt) != 8 { panicln("pt.val:", val(pt)) }

14
test/method2.go Normal file
View File

@ -0,0 +1,14 @@
// errchk $G $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 T struct {a int}
type P *T
type P1 *T
func (p P) val() int { return 1 } // ERROR "receiver"
func (p *P1) val() int { return 1 } // ERROR "receiver"