swig/Examples/test-suite/go/director_string_runme.go
Ian Lance Taylor 7aafe3d8b2 Fix all Go tests to build with "go build"
Tested against Go 1.6 through Go 1.13beta1, and gccgo.

Fixes #1607
2019-08-08 14:30:50 -07:00

39 lines
601 B
Go

package main
import . "swigtests/director_string"
type B struct { // From A
abi A
smem string
}
func NewB(s string) A {
p := &B{nil, ""}
ret := NewDirectorA(p, s)
p.abi = ret
return ret
}
func (p *B) Get_first() string {
return DirectorAGet_first(p.abi) + " world!"
}
func (p *B) Process_text(s string) {
DirectorAProcess_text(p.abi, s)
p.smem = "hello"
}
func main() {
b := NewB("hello")
b.Get(0)
if b.Get_first() != "hello world!" {
panic(b.Get_first())
}
b.Call_process_func()
if b.DirectorInterface().(*B).smem != "hello" {
panic(b.DirectorInterface().(*B).smem)
}
}