OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [method3.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $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
 
9
package main
10
 
11
type T []int
12
 
13
func (t T) Len() int { return len(t) }
14
 
15
type I interface {
16
        Len() int
17
}
18
 
19
func main() {
20
        var t T = T{0, 1, 2, 3, 4}
21
        var i I
22
        i = t
23
        if i.Len() != 5 {
24
                println("i.Len", i.Len())
25
                panic("fail")
26
        }
27
        if T.Len(t) != 5 {
28
                println("T.Len", T.Len(t))
29
                panic("fail")
30
        }
31
        if (*T).Len(&t) != 5 {
32
                println("(*T).Len", (*T).Len(&t))
33
                panic("fail")
34
        }
35
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.