summaryrefslogtreecommitdiff
path: root/test/method3.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2010-03-24 16:46:53 -0700
committerRob Pike <r@golang.org>2010-03-24 16:46:53 -0700
commite8e3a7555127764d37bd3fe22ebc1c1e2033fe3f (patch)
tree19bab8994a6a628a1309f01d31a9809d6f6ac5be /test/method3.go
parenta105fc1625b16bd2678a392844b87a71693970b9 (diff)
downloadgo-e8e3a7555127764d37bd3fe22ebc1c1e2033fe3f.tar.gz
delete all uses of panicln by rewriting them using panic or,
in the tests, println+panic. gofmt some tests too. R=rsc CC=golang-dev http://codereview.appspot.com/741041
Diffstat (limited to 'test/method3.go')
-rw-r--r--test/method3.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/method3.go b/test/method3.go
index 20ced1eb2..7946a8750 100644
--- a/test/method3.go
+++ b/test/method3.go
@@ -8,7 +8,8 @@
package main
-type T [] int
+type T []int
+
func (t T) Len() int { return len(t) }
type I interface {
@@ -16,16 +17,19 @@ type I interface {
}
func main() {
- var t T = T{0,1,2,3,4};
- var i I;
- i = t;
+ var t T = T{0, 1, 2, 3, 4}
+ var i I
+ i = t
if i.Len() != 5 {
- panicln("i.Len", i.Len());
+ println("i.Len", i.Len())
+ panic("fail")
}
if T.Len(t) != 5 {
- panicln("T.Len", T.Len(t));
+ println("T.Len", T.Len(t))
+ panic("fail")
}
if (*T).Len(&t) != 5 {
- panicln("(*T).Len", (*T).Len(&t));
+ println("(*T).Len", (*T).Len(&t))
+ panic("fail")
}
}