mirror of https://github.com/go-python/gopy.git
examples/iface: expand test
Change-Id: Ibe437b2af33ec9adcf136e51acf50bbc5f4e18b7
This commit is contained in:
parent
14b9cb2dba
commit
c8ce550bd3
|
@ -2,8 +2,28 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// package iface tests various aspects of interfaces.
|
||||
package iface
|
||||
|
||||
import (
|
||||
"github.com/go-python/gopy/_examples/cpkg"
|
||||
)
|
||||
|
||||
// Iface has a single F() method
|
||||
type Iface interface {
|
||||
F()
|
||||
}
|
||||
|
||||
// T implements Iface
|
||||
type T struct{}
|
||||
|
||||
func (t *T) F() {
|
||||
cpkg.Printf("t.F [CALLED]\n")
|
||||
}
|
||||
|
||||
// CallIface calls F() on v
|
||||
func CallIface(v Iface) {
|
||||
cpkg.Printf("iface.CallIface...\n")
|
||||
v.F()
|
||||
cpkg.Printf("iface.CallIface... [DONE]\n")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue