]> Cypherpunks.ru repositories - gostls13.git/commitdiff
test: convert tests to run.go whenever possible.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 10 Oct 2012 20:35:27 +0000 (22:35 +0200)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 10 Oct 2012 20:35:27 +0000 (22:35 +0200)
The other tests either need a complex procedure
or are architecture- or OS-dependent.

Update #4139.

R=golang-dev, daniel.morsing, iant
CC=golang-dev
https://golang.org/cl/6618062

15 files changed:
test/ddd2.dir/ddd2.go [new file with mode: 0644]
test/ddd2.dir/ddd3.go [moved from test/ddd3.go with 75% similarity]
test/ddd2.go
test/fixedbugs/bug437.dir/x.go [new file with mode: 0644]
test/fixedbugs/bug437.go
test/interface/embed1.dir/embed0.go [moved from test/interface/embed0.go with 93% similarity]
test/interface/embed1.dir/embed1.go [new file with mode: 0644]
test/interface/embed1.go
test/interface/private.dir/private1.go [moved from test/interface/private1.go with 92% similarity]
test/interface/private.dir/prog.go [new file with mode: 0644]
test/interface/private.go
test/interface/recursive1.dir/recursive1.go [new file with mode: 0644]
test/interface/recursive1.dir/recursive2.go [moved from test/interface/recursive2.go with 72% similarity]
test/interface/recursive1.go
test/run.go

diff --git a/test/ddd2.dir/ddd2.go b/test/ddd2.dir/ddd2.go
new file mode 100644 (file)
index 0000000..c9a2675
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2010 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.
+
+// This file is compiled and then imported by ddd3.go.
+
+package ddd
+
+func Sum(args ...int) int {
+       s := 0
+       for _, v := range args {
+               s += v
+       }
+       return s
+}
+
similarity index 75%
rename from test/ddd3.go
rename to test/ddd2.dir/ddd3.go
index d8de0a77e903abba31c6041427044df3eb56d49b..5486fe8a049705c1ff8f5bcb09a24dae5e293b02 100644 (file)
@@ -1,8 +1,3 @@
-// $G $D/ddd2.go && $G $D/$F.go && $L $F.$A && ./$A.out
-
-// NOTE: This test is not run by 'run.go' and so not run by all.bash.
-// To run this test you must use the ./run shell script.
-
 // Copyright 2010 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.
index a141a39c7667a53b59ec275f944c3eae840a8b1d..0d9f634ab6059a3d6c883e7c4160eeee5a14fbcc 100644 (file)
@@ -1,18 +1,9 @@
-// skip
+// rundir
 
 // Copyright 2010 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.
 
-// This file is compiled and then imported by ddd3.go.
-
-package ddd
-
-func Sum(args ...int) int {
-       s := 0
-       for _, v := range args {
-               s += v
-       }
-       return s
-}
+// Test that variadic functions work across package boundaries.
 
+package ignored
diff --git a/test/fixedbugs/bug437.dir/x.go b/test/fixedbugs/bug437.dir/x.go
new file mode 100644 (file)
index 0000000..364d017
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2012 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.
+
+// Test converting a type defined in a different package to an
+// interface defined in a third package, where the interface has a
+// hidden method.  This used to cause a link error with gccgo.
+
+package main
+
+import (
+       "./one"
+       "./two"
+)
+
+func F(i1 one.I1) {
+       switch v := i1.(type) {
+       case two.S2:
+               one.F1(v)
+       }
+}
+
+func main() {
+       F(nil)
+}
index b1e76a6a744653d244cc9402e9661873afba4b8a..5c4a2ad0dcf5885ffd5573813a093f6d92d84661 100644 (file)
@@ -1,7 +1,4 @@
-// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go && $G $D/$F.go && $L $F.$A && ./$A.out
-
-// NOTE: This test is not run by 'run.go' and so not run by all.bash.
-// To run this test you must use the ./run shell script.
+// rundir
 
 // Copyright 2012 The Go Authors.  All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -11,20 +8,4 @@
 // interface defined in a third package, where the interface has a
 // hidden method.  This used to cause a link error with gccgo.
 
-package main
-
-import (
-       "./one"
-       "./two"
-)
-
-func F(i1 one.I1) {
-       switch v := i1.(type) {
-       case two.S2:
-               one.F1(v)
-       }
-}
-
-func main() {
-       F(nil)
-}
+package ignored
similarity index 93%
rename from test/interface/embed0.go
rename to test/interface/embed1.dir/embed0.go
index e2ee20adebaceda1fc55fc480a196d5d8a4a7107..728bec74e876ca73f2bea8d764b88b03b17189dd 100644 (file)
@@ -1,5 +1,3 @@
-// skip # used by embed1.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.
diff --git a/test/interface/embed1.dir/embed1.go b/test/interface/embed1.dir/embed1.go
new file mode 100644 (file)
index 0000000..7dfb1db
--- /dev/null
@@ -0,0 +1,43 @@
+// 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.
+
+// Test that embedded interface types can have local methods.
+
+package main
+
+import "./embed0"
+
+type T int
+func (t T) m() {}
+
+type I interface { m() }
+type J interface { I }
+
+type PI interface { p.I }
+type PJ interface { p.J }
+
+func main() {
+       var i I
+       var j J
+       var t T
+       i = t
+       j = t
+       _ = i
+       _ = j
+       i = j
+       _ = i
+       j = i
+       _ = j
+       var pi PI
+       var pj PJ
+       var pt p.T
+       pi = pt
+       pj = pt
+       _ = pi
+       _ = pj
+       pi = pj
+       _ = pi
+       pj = pi
+       _ = pj
+}
index 07b873a633b9ff62fb640c1ae6f5004aa7cb341b..784b82bb072b683b9f8caa3390e2b1a154d63aad 100644 (file)
@@ -1,7 +1,4 @@
-// $G $D/embed0.go && $G $D/$F.go && $L $F.$A && ./$A.out
-
-// NOTE: This test is not run by 'run.go' and so not run by all.bash.
-// To run this test you must use the ./run shell script.
+// rundir
 
 // Copyright 2009 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -9,40 +6,4 @@
 
 // Test that embedded interface types can have local methods.
 
-package main
-
-import "./embed0"
-
-type T int
-func (t T) m() {}
-
-type I interface { m() }
-type J interface { I }
-
-type PI interface { p.I }
-type PJ interface { p.J }
-
-func main() {
-       var i I
-       var j J
-       var t T
-       i = t
-       j = t
-       _ = i
-       _ = j
-       i = j
-       _ = i
-       j = i
-       _ = j
-       var pi PI
-       var pj PJ
-       var pt p.T
-       pi = pt
-       pj = pt
-       _ = pi
-       _ = pj
-       pi = pj
-       _ = pi
-       pj = pi
-       _ = pj
-}
+package ignored
similarity index 92%
rename from test/interface/private1.go
rename to test/interface/private.dir/private1.go
index 3281c38be606452ab5a5cc810f390cabb8ad0ba4..75eee51f5a0509c287cc0a7f8682f09c777a0589 100644 (file)
@@ -1,5 +1,3 @@
-// skip # used by private.go
-
 // 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.
diff --git a/test/interface/private.dir/prog.go b/test/interface/private.dir/prog.go
new file mode 100644 (file)
index 0000000..abea7d6
--- /dev/null
@@ -0,0 +1,33 @@
+// 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.
+
+// Test that unexported methods are not visible outside the package.
+// Does not compile.
+
+package main
+
+import "./private1"
+
+type Exported interface {
+       private()
+}
+
+type Implementation struct{}
+
+func (p *Implementation) private() {}
+
+func main() {
+       var x Exported
+       x = new(Implementation)
+       x.private()
+
+       var px p.Exported
+       px = p.X
+
+       px.private()                    // ERROR "private"
+
+       px = new(Implementation)        // ERROR "private"
+
+       x = px                          // ERROR "private"
+}
index 0a42385ea7bf69058ff8251af99892847dc63e0a..a0da249c92c505801ed250f252a13e7180f4b940 100644 (file)
@@ -1,7 +1,4 @@
-// $G $D/${F}1.go && errchk $G $D/$F.go
-
-// NOTE: This test is not run by 'run.go' and so not run by all.bash.
-// To run this test you must use the ./run shell script.
+// errorcheckdir
 
 // Copyright 2011 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -10,29 +7,4 @@
 // Test that unexported methods are not visible outside the package.
 // Does not compile.
 
-package main
-
-import "./private1"
-
-type Exported interface {
-       private()
-}
-
-type Implementation struct{}
-
-func (p *Implementation) private() {}
-
-func main() {
-       var x Exported
-       x = new(Implementation)
-       x.private()
-
-       var px p.Exported
-       px = p.X
-
-       px.private()                    // ERROR "private"
-
-       px = new(Implementation)        // ERROR "private"
-
-       x = px                          // ERROR "private"
-}
+package ignored
diff --git a/test/interface/recursive1.dir/recursive1.go b/test/interface/recursive1.dir/recursive1.go
new file mode 100644 (file)
index 0000000..441f0ec
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2012 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.
+
+// Mutually recursive type definitions imported and used by recursive1.go.
+
+package p
+
+type I1 interface {
+       F() I2
+}
+
+type I2 interface {
+       I1
+}
similarity index 72%
rename from test/interface/recursive2.go
rename to test/interface/recursive1.dir/recursive2.go
index 3a1059960cf14c853b6e19a7c3b7d21bb3ba85aa..e8048c672b2f0e09eb78a5c9747e20c893f47d2e 100644 (file)
@@ -1,8 +1,3 @@
-// $G $D/recursive1.go && $G $D/$F.go
-
-// NOTE: This test is not run by 'run.go' and so not run by all.bash.
-// To run this test you must use the ./run shell script.
-
 // Copyright 2012 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.
index cc3cdc37f1ae482768ff4038b4a50f9fd60dfaa7..62f61088441d02f60e5c6d042a8dfa342eae0752 100644 (file)
@@ -1,4 +1,4 @@
-// skip # used by recursive2
+// compiledir
 
 // Copyright 2012 The Go Authors.  All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -6,12 +6,4 @@
 
 // Mutually recursive type definitions imported and used by recursive1.go.
 
-package p
-
-type I1 interface {
-       F() I2
-}
-
-type I2 interface {
-       I1
-}
+package ignored
index b79323dd17938f230357cc3476cf70ba0f2c57a9..6b881eb1f05f39b1b02784d018bd794b98a82b2b 100644 (file)
@@ -647,16 +647,12 @@ func (t *test) wantedErrors(file, short string) (errs []wantedError) {
 
 var skipOkay = map[string]bool{
        "args.go":                 true,
-       "ddd3.go":                 true,
        "index.go":                true,
        "linkx.go":                true,
        "nul1.go":                 true,
        "rotate.go":               true,
        "sigchld.go":              true,
        "sinit.go":                true,
-       "interface/embed1.go":     true,
-       "interface/private.go":    true,
-       "interface/recursive2.go": true,
        "dwarf/main.go":           true,
        "dwarf/z1.go":             true,
        "dwarf/z10.go":            true,
@@ -686,7 +682,6 @@ var skipOkay = map[string]bool{
        "fixedbugs/bug385_32.go":  true, // arch-specific errors.
        "fixedbugs/bug385_64.go":  true, // arch-specific errors.
        "fixedbugs/bug429.go":     true,
-       "fixedbugs/bug437.go":     true,
        "bugs/bug395.go":          true,
        "bugs/bug434.go":          true,
 }