mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
test: convert tests to run.go whenever possible.
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
This commit is contained in:
parent
c12dab2aa6
commit
dda1b560ec
16
test/ddd2.dir/ddd2.go
Normal file
16
test/ddd2.dir/ddd2.go
Normal file
@ -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
|
||||
}
|
||||
|
@ -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.
|
15
test/ddd2.go
15
test/ddd2.go
@ -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
|
||||
|
25
test/fixedbugs/bug437.dir/x.go
Normal file
25
test/fixedbugs/bug437.dir/x.go
Normal file
@ -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)
|
||||
}
|
@ -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
|
||||
|
@ -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.
|
43
test/interface/embed1.dir/embed1.go
Normal file
43
test/interface/embed1.dir/embed1.go
Normal file
@ -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
|
||||
}
|
@ -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
|
||||
|
@ -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.
|
33
test/interface/private.dir/prog.go
Normal file
33
test/interface/private.dir/prog.go
Normal file
@ -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"
|
||||
}
|
@ -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
|
||||
|
15
test/interface/recursive1.dir/recursive1.go
Normal file
15
test/interface/recursive1.dir/recursive1.go
Normal file
@ -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
|
||||
}
|
@ -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.
|
@ -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
|
||||
|
@ -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,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user