From b20983d11c20738b0974130eae6cf89fb5553fe8 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Wed, 26 Oct 2005 14:12:11 +0000 Subject: [PATCH] add another nested case git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7740 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Examples/test-suite/director_nested.i | 11 ++++++++ .../python/director_nested_runme.py | 27 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/SWIG/Examples/test-suite/director_nested.i b/SWIG/Examples/test-suite/director_nested.i index 6aea9da4d..3293ee6b3 100644 --- a/SWIG/Examples/test-suite/director_nested.i +++ b/SWIG/Examples/test-suite/director_nested.i @@ -60,6 +60,17 @@ { public: virtual C get_value() const = 0; + + virtual const char * get_name() + { + return "FooBar::get_name"; + } + + static FooBar *get_self(FooBar *a) + { + return a; + } + }; } diff --git a/SWIG/Examples/test-suite/python/director_nested_runme.py b/SWIG/Examples/test-suite/python/director_nested_runme.py index 0a1b8c11b..47505f629 100644 --- a/SWIG/Examples/test-suite/python/director_nested_runme.py +++ b/SWIG/Examples/test-suite/python/director_nested_runme.py @@ -24,7 +24,7 @@ class B(FooBar_int): return "B::do_step;" def get_value(self): - return "B::get_value" + return 1 pass @@ -34,3 +34,28 @@ b = B() if b.step() != "Bar::step;Foo::advance;B::do_advance;B::do_step;": raise RuntimeError,"Bad B virtual resolution" + + +class C(FooBar_int): + def do_advance(self): + return "C::do_advance;" + FooBar_int.do_advance(self) + + def do_step(self): + return "C::do_step;" + + def get_value(self): + return 2 + + def get_name(self): + return FooBar_int.get_name(self) + " hello" + + + pass + +cc = C() + +c = C.get_self(cc) +c.advance() +if c.get_name() != "FooBar::get_name hello": + raise RuntimeError +