]> Cypherpunks repositories - gostls13.git/commitdiff
test: split golden.out into expected output per test
authorIan Lance Taylor <iant@golang.org>
Thu, 19 Jan 2012 00:12:24 +0000 (16:12 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 19 Jan 2012 00:12:24 +0000 (16:12 -0800)
This will permit gccgo to check test output.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5554056

21 files changed:
test/deferprint.go
test/deferprint.out [new file with mode: 0644]
test/fixedbugs/bug067.go
test/fixedbugs/bug328.go
test/fixedbugs/bug328.out [new file with mode: 0644]
test/golden.out
test/goprint.go
test/goprint.out [new file with mode: 0644]
test/helloworld.go
test/helloworld.out [new file with mode: 0644]
test/ken/cplx0.go
test/ken/cplx0.out [new file with mode: 0644]
test/ken/cplx3.go
test/ken/cplx5.go
test/ken/intervar.go
test/ken/string.go
test/ken/string.out [new file with mode: 0644]
test/printbig.go
test/printbig.out [new file with mode: 0644]
test/sigchld.go
test/sigchld.out [new file with mode: 0644]

index f1e75266f785d3c8cd85eff72c6d534ddbec0cfb..0e0c618216809f40df15c9948550b6eaed7bee55 100644 (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.
 // Use of this source code is governed by a BSD-style
diff --git a/test/deferprint.out b/test/deferprint.out
new file mode 100644 (file)
index 0000000..a71cfce
--- /dev/null
@@ -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
index b812f01169c817f6f485aea6587de6c6ad49b921..328d191bb423d02728a99579cc3fce9e0b700951 100644 (file)
@@ -10,6 +10,6 @@ var c chan int
 
 func main() {
        c = make(chan int);
-       go func() { print("ok\n"); c <- 0 } ();
+       go func() { c <- 0 } ();
        <-c
 }
index 64041f41290732b9b4f3359197d046b8b7c29f01..825298371f969d03ab2e48e1ece03fb335f3afff 100644 (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.
 // Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/bug328.out b/test/fixedbugs/bug328.out
new file mode 100644 (file)
index 0000000..9982566
--- /dev/null
@@ -0,0 +1 @@
+0x0
index 58a0df2854c80072c40dae13197f3338d25b3424..d7ecbdc8783658ecc24c1d95f746d6c0b376fce1 100644 (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/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/
 
 == interface/
@@ -55,10 +13,4 @@ abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
 
 == fixedbugs/
 
-=========== fixedbugs/bug067.go
-ok
-
-=========== fixedbugs/bug328.go
-0x0
-
 == bugs/
index c0e34c750e39971d41c30504b93b0493e2e594c1..53ed055a070abc94f8d386ba0201a5e5d1c4227d 100644 (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.
 // Use of this source code is governed by a BSD-style
diff --git a/test/goprint.out b/test/goprint.out
new file mode 100644 (file)
index 0000000..da3919e
--- /dev/null
@@ -0,0 +1 @@
+42 true false true +1.500000e+000 world 0x0 [0/0]0x0 0x0 0x0 255
index e55a74bbd364063586f8c033475e6c6f2f5dd0a7..16c95f00686e6669f609946a073d0cd6c621d637 100644 (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.
 // Use of this source code is governed by a BSD-style
diff --git a/test/helloworld.out b/test/helloworld.out
new file mode 100644 (file)
index 0000000..4b5fa63
--- /dev/null
@@ -0,0 +1 @@
+hello, world
index ba1fa196fd6874b23e27fb162d4afd8032954af6..f38ce5b65d11007b3ba071ec8365bbbe427ca381 100644 (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.
 // Use of this source code is governed by a BSD-style
diff --git a/test/ken/cplx0.out b/test/ken/cplx0.out
new file mode 100644 (file)
index 0000000..7627c28
--- /dev/null
@@ -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)
index fa6ff1d52ee6ba625c41991728260d02e369cae6..048c93eef67fb5a24fa42e626294fc39a29fd62a 100644 (file)
@@ -19,10 +19,29 @@ const (
 func main() {
        c0 := C1
        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))
-       println(c)
+       if c != c0 {
+               println(c, "!=", c)
+               panic(0)
+       }
 
        var a interface{}
        switch c := reflect.ValueOf(a); c.Kind() {
index d425a7c4c04da9b29ec34ac4213b0056a6f1be94..e6696674b0a5670185501128d63367a4f8d4154e 100644 (file)
@@ -19,36 +19,52 @@ func main() {
        for i := 0; i < len(a); i++ {
                a[i] = complex(float64(i), float64(-i))
        }
-       println(a[5])
+       if a[5] != 5-5i {
+               panic(a[5])
+       }
 
        // slice of complex128
        s = make([]complex128, len(a))
        for i := 0; i < len(s); i++ {
                s[i] = a[i]
        }
-       println(s[5])
+       if s[5] != 5-5i {
+               panic(s[5])
+       }
 
        // chan
        c = make(chan complex128)
        go chantest(c)
-       println(<-c)
+       vc := <-c
+       if vc != 5-5i {
+               panic(vc)
+       }
 
        // pointer of complex128
        v := a[5]
        pv := &v
-       println(*pv)
+       if *pv != 5-5i {
+               panic(*pv)
+       }
 
        // field of complex128
        f.c = a[5]
-       println(f.c)
+       if f.c != 5-5i {
+               panic(f.c)
+       }
 
        // map of complex128
        m = make(map[complex128]complex128)
        for i := 0; i < len(s); i++ {
                m[-a[i]] = a[i]
        }
-       println(m[5i-5])
-       println(m[complex(-5, 5)])
+       if m[5i-5] != 5-5i {
+               panic(m[5i-5])
+       }
+       vm := m[complex(-5, 5)]
+       if vm != 5-5i {
+               panic(vm)
+       }
 }
 
 func chantest(c chan complex128) { c <- a[5] }
index c2aaaa870517601a7e24d9f785a18daed56a4918..73d1b0660bd7666e610c3c1ef61c1bce21afc271 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 type   Iputs   interface {
-       puts    (s string);
+       puts    (s string) string;
 }
 
 // ---------
@@ -17,9 +17,9 @@ type  Print   struct {
        put     Iputs;
 }
 
-func (p *Print) dop() {
-       print(" print ", p.whoami);
-       p.put.puts("abc");
+func (p *Print) dop() string {
+       r := " print " + string(p.whoami + '0')
+       return r + p.put.puts("abc");
 }
 
 // ---------
@@ -29,9 +29,9 @@ type  Bio     struct {
        put     Iputs;
 }
 
-func (b *Bio) puts(s string) {
-       print(" bio ", b.whoami);
-       b.put.puts(s);
+func (b *Bio) puts(s string) string {
+       r := " bio " + string(b.whoami + '0')
+       return r + b.put.puts(s);
 }
 
 // ---------
@@ -41,8 +41,8 @@ type  File    struct {
        put     Iputs;
 }
 
-func (f *File) puts(s string) {
-       print(" file ", f.whoami, " -- ", s);
+func (f *File) puts(s string) string {
+       return " file " + string(f.whoami + '0') + " -- " + s
 }
 
 func
@@ -59,6 +59,9 @@ main() {
 
        f.whoami = 3;
 
-       p.dop();
-       print("\n");
+       r := p.dop();
+       expected := " print 1 bio 2 file 3 -- abc"
+       if r != expected {
+               panic(r + " != " + expected)
+       }
 }
index b74bd7d6f1c1dcefa607fdcfc985c8fd6d949068..e0510824293221abb38fedf12961d5ac8e30c82a 100644 (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.
 // Use of this source code is governed by a BSD-style
@@ -71,16 +71,14 @@ func main() {
        /* create string with integer constant */
        c = string('x')
        if c != "x" {
-               print("create int ", c)
-               panic("fail")
+               panic("create int " + c)
        }
 
        /* create string with integer variable */
        v := 'x'
        c = string(v)
        if c != "x" {
-               print("create int ", c)
-               panic("fail")
+               panic("create int " + c)
        }
 
        /* create string with byte array */
@@ -90,8 +88,7 @@ func main() {
        z1[2] = 'c'
        c = string(z1[0:])
        if c != "abc" {
-               print("create byte array ", c)
-               panic("fail")
+               panic("create byte array " + c)
        }
 
        /* create string with int array */
@@ -101,8 +98,7 @@ func main() {
        z2[2] = 'c'
        c = string(z2[0:])
        if c != "a\u1234c" {
-               print("create int array ", c)
-               panic("fail")
+               panic("create int array " + c)
        }
 
        /* create string with byte array pointer */
@@ -112,7 +108,6 @@ func main() {
        z3[2] = 'c'
        c = string(z3[0:])
        if c != "abc" {
-               print("create array pointer ", c)
-               panic("fail")
+               panic("create array pointer " + c)
        }
 }
diff --git a/test/ken/string.out b/test/ken/string.out
new file mode 100644 (file)
index 0000000..8bc36bc
--- /dev/null
@@ -0,0 +1 @@
+abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
index bbb707004fff24a1d897af2c263773b608dc83eb..d867bdc646c14c34807a7a8417e4c7cfb28e2794 100644 (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.
 // Use of this source code is governed by a BSD-style
diff --git a/test/printbig.out b/test/printbig.out
new file mode 100644 (file)
index 0000000..6a16b15
--- /dev/null
@@ -0,0 +1,2 @@
+-9223372036854775808
+9223372036854775807
index 74d428efc266cb59f8eff2b3fcdd49c690a186ee..e7c3d5abb48d4289f3454552a0d85583104f6e4d 100644 (file)
@@ -1,5 +1,5 @@
-// ([ "$GOOS" = windows ] && echo survived SIGCHLD) ||
-// ($G $D/$F.go && $L $F.$A && ./$A.out)
+// [ "$GOOS" == windows ] ||
+// ($G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out)
 
 // Copyright 2009 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
diff --git a/test/sigchld.out b/test/sigchld.out
new file mode 100644 (file)
index 0000000..477d025
--- /dev/null
@@ -0,0 +1 @@
+survived SIGCHLD