Add support for the Go programming language.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12108 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
09f14197ac
commit
5af2978f77
259 changed files with 16159 additions and 14 deletions
48
Examples/test-suite/go/director_protected_runme.go
Normal file
48
Examples/test-suite/go/director_protected_runme.go
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
package main
|
||||
|
||||
import . "./director_protected"
|
||||
|
||||
type FooBar struct{} // From Bar
|
||||
func (p *FooBar) Ping() string {
|
||||
return "FooBar::ping();"
|
||||
}
|
||||
|
||||
type FooBar2 struct{} // From Bar
|
||||
func (p *FooBar2) Ping() string {
|
||||
return "FooBar2::ping();"
|
||||
}
|
||||
func (p *FooBar2) Pang() string {
|
||||
return "FooBar2::pang();"
|
||||
}
|
||||
|
||||
func main() {
|
||||
b := NewBar()
|
||||
f := b.Create()
|
||||
fb := NewDirectorBar(&FooBar{})
|
||||
fb2 := NewDirectorBar(&FooBar2{})
|
||||
|
||||
s := fb.Used()
|
||||
if s != "Foo::pang();Bar::pong();Foo::pong();FooBar::ping();" {
|
||||
panic(0)
|
||||
}
|
||||
|
||||
s = fb2.Used()
|
||||
if s != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();" {
|
||||
panic(0)
|
||||
}
|
||||
|
||||
s = b.Pong()
|
||||
if s != "Bar::pong();Foo::pong();Bar::ping();" {
|
||||
panic(0)
|
||||
}
|
||||
|
||||
s = f.Pong()
|
||||
if s != "Bar::pong();Foo::pong();Bar::ping();" {
|
||||
panic(0)
|
||||
}
|
||||
|
||||
s = fb.Pong()
|
||||
if s != "Bar::pong();Foo::pong();FooBar::ping();" {
|
||||
panic(0)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue