1
0
mirror of https://github.com/golang/go synced 2024-11-21 18:24:46 -07:00

test: split golden.out into expected output per test

This will permit gccgo to check test output.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5554056
This commit is contained in:
Ian Lance Taylor 2012-01-18 16:12:24 -08:00
parent eaf8295f3d
commit 5e77b009d0
21 changed files with 86 additions and 88 deletions

View File

@ -1,4 +1,4 @@
// $G $D/$F.go && $L $F.$A && ./$A.out // $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
// Copyright 2010 The Go Authors. All rights reserved. // Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

2
test/deferprint.out Normal file
View File

@ -0,0 +1,2 @@
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

View File

@ -10,6 +10,6 @@ var c chan int
func main() { func main() {
c = make(chan int); c = make(chan int);
go func() { print("ok\n"); c <- 0 } (); go func() { c <- 0 } ();
<-c <-c
} }

View File

@ -1,4 +1,4 @@
// $G $D/$F.go && $L $F.$A && ./$A.out // $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
// Copyright 2011 The Go Authors. All rights reserved. // Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

View File

@ -0,0 +1 @@
0x0

View File

@ -1,50 +1,8 @@
== ./ == ./
=========== ./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
=========== ./goprint.go
42 true false true +1.500000e+000 world 0x0 [0/0]0x0 0x0 0x0 255
=========== ./helloworld.go
hello, world
=========== ./printbig.go
-9223372036854775808
9223372036854775807
=========== ./sigchld.go
survived SIGCHLD
== ken/ == ken/
=========== ken/cplx0.go
(+5.000000e+000+6.000000e+000i)
(+5.000000e+000+6.000000e+000i)
(+5.000000e+000+6.000000e+000i)
(+5.000000e+000+6.000000e+000i)
=========== ken/cplx3.go
(+1.292308e+000-1.384615e-001i)
(+1.292308e+000-1.384615e-001i)
=========== ken/cplx5.go
(+5.000000e+000-5.000000e+000i)
(+5.000000e+000-5.000000e+000i)
(+5.000000e+000-5.000000e+000i)
(+5.000000e+000-5.000000e+000i)
(+5.000000e+000-5.000000e+000i)
(+5.000000e+000-5.000000e+000i)
(+5.000000e+000-5.000000e+000i)
=========== ken/intervar.go
print 1 bio 2 file 3 -- abc
=========== ken/string.go
abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
== chan/ == chan/
== interface/ == interface/
@ -55,10 +13,4 @@ abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
== fixedbugs/ == fixedbugs/
=========== fixedbugs/bug067.go
ok
=========== fixedbugs/bug328.go
0x0
== bugs/ == bugs/

View File

@ -1,4 +1,4 @@
// $G $D/$F.go && $L $F.$A && ./$A.out // $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
// Copyright 2011 The Go Authors. All rights reserved. // Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

1
test/goprint.out Normal file
View File

@ -0,0 +1 @@
42 true false true +1.500000e+000 world 0x0 [0/0]0x0 0x0 0x0 255

View File

@ -1,4 +1,4 @@
// $G $F.go && $L $F.$A && ./$A.out // $G $F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
// Copyright 2009 The Go Authors. All rights reserved. // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

1
test/helloworld.out Normal file
View File

@ -0,0 +1 @@
hello, world

View File

@ -1,4 +1,4 @@
// $G $D/$F.go && $L $F.$A && ./$A.out // $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
// Copyright 2010 The Go Authors. All rights reserved. // Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

4
test/ken/cplx0.out Normal file
View File

@ -0,0 +1,4 @@
(+5.000000e+000+6.000000e+000i)
(+5.000000e+000+6.000000e+000i)
(+5.000000e+000+6.000000e+000i)
(+5.000000e+000+6.000000e+000i)

View File

@ -19,10 +19,29 @@ const (
func main() { func main() {
c0 := C1 c0 := C1
c0 = (c0 + c0 + c0) / (c0 + c0 + 3i) c0 = (c0 + c0 + c0) / (c0 + c0 + 3i)
println(c0) r, i := real(c0), imag(c0)
d := r - 1.292308
if d < 0 {
d = - d
}
if d > 1e-6 {
println(r, "!= 1.292308")
panic(0)
}
d = i + 0.1384615
if d < 0 {
d = - d
}
if d > 1e-6 {
println(i, "!= -0.1384615")
panic(0)
}
c := *(*complex128)(unsafe.Pointer(&c0)) c := *(*complex128)(unsafe.Pointer(&c0))
println(c) if c != c0 {
println(c, "!=", c)
panic(0)
}
var a interface{} var a interface{}
switch c := reflect.ValueOf(a); c.Kind() { switch c := reflect.ValueOf(a); c.Kind() {

View File

@ -19,36 +19,52 @@ func main() {
for i := 0; i < len(a); i++ { for i := 0; i < len(a); i++ {
a[i] = complex(float64(i), float64(-i)) a[i] = complex(float64(i), float64(-i))
} }
println(a[5]) if a[5] != 5-5i {
panic(a[5])
}
// slice of complex128 // slice of complex128
s = make([]complex128, len(a)) s = make([]complex128, len(a))
for i := 0; i < len(s); i++ { for i := 0; i < len(s); i++ {
s[i] = a[i] s[i] = a[i]
} }
println(s[5]) if s[5] != 5-5i {
panic(s[5])
}
// chan // chan
c = make(chan complex128) c = make(chan complex128)
go chantest(c) go chantest(c)
println(<-c) vc := <-c
if vc != 5-5i {
panic(vc)
}
// pointer of complex128 // pointer of complex128
v := a[5] v := a[5]
pv := &v pv := &v
println(*pv) if *pv != 5-5i {
panic(*pv)
}
// field of complex128 // field of complex128
f.c = a[5] f.c = a[5]
println(f.c) if f.c != 5-5i {
panic(f.c)
}
// map of complex128 // map of complex128
m = make(map[complex128]complex128) m = make(map[complex128]complex128)
for i := 0; i < len(s); i++ { for i := 0; i < len(s); i++ {
m[-a[i]] = a[i] m[-a[i]] = a[i]
} }
println(m[5i-5]) if m[5i-5] != 5-5i {
println(m[complex(-5, 5)]) panic(m[5i-5])
}
vm := m[complex(-5, 5)]
if vm != 5-5i {
panic(vm)
}
} }
func chantest(c chan complex128) { c <- a[5] } func chantest(c chan complex128) { c <- a[5] }

View File

@ -7,7 +7,7 @@
package main package main
type Iputs interface { type Iputs interface {
puts (s string); puts (s string) string;
} }
// --------- // ---------
@ -17,9 +17,9 @@ type Print struct {
put Iputs; put Iputs;
} }
func (p *Print) dop() { func (p *Print) dop() string {
print(" print ", p.whoami); r := " print " + string(p.whoami + '0')
p.put.puts("abc"); return r + p.put.puts("abc");
} }
// --------- // ---------
@ -29,9 +29,9 @@ type Bio struct {
put Iputs; put Iputs;
} }
func (b *Bio) puts(s string) { func (b *Bio) puts(s string) string {
print(" bio ", b.whoami); r := " bio " + string(b.whoami + '0')
b.put.puts(s); return r + b.put.puts(s);
} }
// --------- // ---------
@ -41,8 +41,8 @@ type File struct {
put Iputs; put Iputs;
} }
func (f *File) puts(s string) { func (f *File) puts(s string) string {
print(" file ", f.whoami, " -- ", s); return " file " + string(f.whoami + '0') + " -- " + s
} }
func func
@ -59,6 +59,9 @@ main() {
f.whoami = 3; f.whoami = 3;
p.dop(); r := p.dop();
print("\n"); expected := " print 1 bio 2 file 3 -- abc"
if r != expected {
panic(r + " != " + expected)
}
} }

View File

@ -1,4 +1,4 @@
// $G $D/$F.go && $L $F.$A && ./$A.out // $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
// Copyright 2009 The Go Authors. All rights reserved. // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
@ -71,16 +71,14 @@ func main() {
/* create string with integer constant */ /* create string with integer constant */
c = string('x') c = string('x')
if c != "x" { if c != "x" {
print("create int ", c) panic("create int " + c)
panic("fail")
} }
/* create string with integer variable */ /* create string with integer variable */
v := 'x' v := 'x'
c = string(v) c = string(v)
if c != "x" { if c != "x" {
print("create int ", c) panic("create int " + c)
panic("fail")
} }
/* create string with byte array */ /* create string with byte array */
@ -90,8 +88,7 @@ func main() {
z1[2] = 'c' z1[2] = 'c'
c = string(z1[0:]) c = string(z1[0:])
if c != "abc" { if c != "abc" {
print("create byte array ", c) panic("create byte array " + c)
panic("fail")
} }
/* create string with int array */ /* create string with int array */
@ -101,8 +98,7 @@ func main() {
z2[2] = 'c' z2[2] = 'c'
c = string(z2[0:]) c = string(z2[0:])
if c != "a\u1234c" { if c != "a\u1234c" {
print("create int array ", c) panic("create int array " + c)
panic("fail")
} }
/* create string with byte array pointer */ /* create string with byte array pointer */
@ -112,7 +108,6 @@ func main() {
z3[2] = 'c' z3[2] = 'c'
c = string(z3[0:]) c = string(z3[0:])
if c != "abc" { if c != "abc" {
print("create array pointer ", c) panic("create array pointer " + c)
panic("fail")
} }
} }

1
test/ken/string.out Normal file
View File

@ -0,0 +1 @@
abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz

View File

@ -1,4 +1,4 @@
// $G $F.go && $L $F.$A && ./$A.out // $G $F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
// Copyright 2009 The Go Authors. All rights reserved. // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

2
test/printbig.out Normal file
View File

@ -0,0 +1,2 @@
-9223372036854775808
9223372036854775807

View File

@ -1,5 +1,5 @@
// ([ "$GOOS" = windows ] && echo survived SIGCHLD) || // [ "$GOOS" == windows ] ||
// ($G $D/$F.go && $L $F.$A && ./$A.out) // ($G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out)
// Copyright 2009 The Go Authors. All rights reserved. // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style

1
test/sigchld.out Normal file
View File

@ -0,0 +1 @@
survived SIGCHLD