Fix handling of protected methods in Go when using directors.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12492 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
643f603475
commit
0c8c5e7614
3 changed files with 74 additions and 22 deletions
10
Examples/test-suite/go/director_alternating_runme.go
Normal file
10
Examples/test-suite/go/director_alternating_runme.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package main
|
||||
|
||||
import . "./director_alternating"
|
||||
|
||||
func main() {
|
||||
id := GetBar().Id()
|
||||
if id != IdFromGetBar() {
|
||||
panic(id)
|
||||
}
|
||||
}
|
||||
|
|
@ -15,11 +15,17 @@ func (p *FooBar2) Pang() string {
|
|||
return "FooBar2::pang();"
|
||||
}
|
||||
|
||||
type FooBar3 struct{} // From Bar
|
||||
func (p *FooBar3) Cheer() string {
|
||||
return "FooBar3::cheer();"
|
||||
}
|
||||
|
||||
func main() {
|
||||
b := NewBar()
|
||||
f := b.Create()
|
||||
fb := NewDirectorBar(&FooBar{})
|
||||
fb2 := NewDirectorBar(&FooBar2{})
|
||||
fb3 := NewDirectorBar(&FooBar3{})
|
||||
|
||||
s := fb.Used()
|
||||
if s != "Foo::pang();Bar::pong();Foo::pong();FooBar::ping();" {
|
||||
|
|
@ -45,4 +51,23 @@ func main() {
|
|||
if s != "Bar::pong();Foo::pong();FooBar::ping();" {
|
||||
panic(0)
|
||||
}
|
||||
|
||||
s = fb3.DirectorInterface().(*FooBar3).Cheer()
|
||||
if s != "FooBar3::cheer();" {
|
||||
panic(s)
|
||||
}
|
||||
if fb2.Callping() != "FooBar2::ping();" {
|
||||
panic("bad fb2.callping")
|
||||
}
|
||||
if fb2.Callcheer() != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();" {
|
||||
panic("bad fb2.callcheer")
|
||||
}
|
||||
|
||||
if fb3.Callping() != "Bar::ping();" {
|
||||
panic("bad fb3.callping")
|
||||
}
|
||||
|
||||
if fb3.Callcheer() != "FooBar3::cheer();" {
|
||||
panic("bad fb3.callcheer")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue