blob: 491bcdad33e298fd1d8371343bf2e8a66077ee7e [file] [log] [blame]
Russ Coxe5124812009-01-08 18:06:06 -08001// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG method3
2
3// Copyright 2009 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// test that methods on slices work
8
9package main
10
Russ Cox839a6842009-01-20 14:40:40 -080011type T [] int
Russ Coxe5124812009-01-08 18:06:06 -080012func (t T) Len() int { return len(t) }
13
Russ Cox839a6842009-01-20 14:40:40 -080014type I interface {
Russ Coxe5124812009-01-08 18:06:06 -080015 Len() int
16}
17
18func main() {
Russ Coxbe2edb52009-03-03 08:39:12 -080019 var t T = T{0,1,2,3,4};
Russ Coxe5124812009-01-08 18:06:06 -080020 var i I;
21 i = t;
22 if i.Len() != 5 {
23 panicln("length", i.Len());
24 }
25}