diff options
author | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2012-10-10 22:35:27 +0200 |
---|---|---|
committer | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2012-10-10 22:35:27 +0200 |
commit | dda1b560ec03e3c5da82bef67322f6f4d16cd7eb (patch) | |
tree | 06ad0b32d3edb70d8c93021e717406bcbdfc3f90 /test/interface | |
parent | c12dab2aa606fda6b8ff54082de775bf7737c866 (diff) | |
download | go-git-dda1b560ec03e3c5da82bef67322f6f4d16cd7eb.tar.gz |
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
Diffstat (limited to 'test/interface')
-rw-r--r-- | test/interface/embed1.dir/embed0.go (renamed from test/interface/embed0.go) | 2 | ||||
-rw-r--r-- | test/interface/embed1.dir/embed1.go | 43 | ||||
-rw-r--r-- | test/interface/embed1.go | 43 | ||||
-rw-r--r-- | test/interface/private.dir/private1.go (renamed from test/interface/private1.go) | 2 | ||||
-rw-r--r-- | test/interface/private.dir/prog.go | 33 | ||||
-rw-r--r-- | test/interface/private.go | 32 | ||||
-rw-r--r-- | test/interface/recursive1.dir/recursive1.go | 15 | ||||
-rw-r--r-- | test/interface/recursive1.dir/recursive2.go (renamed from test/interface/recursive2.go) | 5 | ||||
-rw-r--r-- | test/interface/recursive1.go | 12 |
9 files changed, 97 insertions, 90 deletions
diff --git a/test/interface/embed0.go b/test/interface/embed1.dir/embed0.go index e2ee20adeb..728bec74e8 100644 --- a/test/interface/embed0.go +++ b/test/interface/embed1.dir/embed0.go @@ -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 index 0000000000..7dfb1dbc0a --- /dev/null +++ b/test/interface/embed1.dir/embed1.go @@ -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 +} diff --git a/test/interface/embed1.go b/test/interface/embed1.go index 07b873a633..784b82bb07 100644 --- a/test/interface/embed1.go +++ b/test/interface/embed1.go @@ -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 diff --git a/test/interface/private1.go b/test/interface/private.dir/private1.go index 3281c38be6..75eee51f5a 100644 --- a/test/interface/private1.go +++ b/test/interface/private.dir/private1.go @@ -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 index 0000000000..abea7d625c --- /dev/null +++ b/test/interface/private.dir/prog.go @@ -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" +} diff --git a/test/interface/private.go b/test/interface/private.go index 0a42385ea7..a0da249c92 100644 --- a/test/interface/private.go +++ b/test/interface/private.go @@ -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 index 0000000000..441f0ecaa5 --- /dev/null +++ b/test/interface/recursive1.dir/recursive1.go @@ -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 +} diff --git a/test/interface/recursive2.go b/test/interface/recursive1.dir/recursive2.go index 3a1059960c..e8048c672b 100644 --- a/test/interface/recursive2.go +++ b/test/interface/recursive1.dir/recursive2.go @@ -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. diff --git a/test/interface/recursive1.go b/test/interface/recursive1.go index cc3cdc37f1..62f6108844 100644 --- a/test/interface/recursive1.go +++ b/test/interface/recursive1.go @@ -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 |