diff options
author | Brant K. Kyser <brantkyser@gmail.com> | 2013-01-05 03:14:42 -0600 |
---|---|---|
committer | Brant K. Kyser <brantkyser@gmail.com> | 2013-01-05 03:14:42 -0600 |
commit | c786781e9273f341183fe927c9061cc1979b2769 (patch) | |
tree | 226319885bd9d3e9432b4121aebc31d04c5be2fd | |
parent | 54b576d8b2b71f55cffb0f4b882f9331f487c3c2 (diff) | |
download | swig-c786781e9273f341183fe927c9061cc1979b2769.tar.gz |
Add test case for SourceForge Bug #1299
-rw-r--r-- | Examples/test-suite/common.mk | 1 | ||||
-rw-r--r-- | Examples/test-suite/director_nspace_director_name_collision.i | 66 | ||||
-rw-r--r-- | Examples/test-suite/java/Makefile.in | 1 |
3 files changed, 68 insertions, 0 deletions
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 1cda06140..09112c316 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -178,6 +178,7 @@ CPP_TEST_CASES += \ director_keywords \ director_namespace_clash \ director_nspace \ + director_nspace_director_name_collision \ director_nested \ director_overload \ director_overload2 \ diff --git a/Examples/test-suite/director_nspace_director_name_collision.i b/Examples/test-suite/director_nspace_director_name_collision.i new file mode 100644 index 000000000..5ef2509f8 --- /dev/null +++ b/Examples/test-suite/director_nspace_director_name_collision.i @@ -0,0 +1,66 @@ +%module(directors="1") director_nspace_director_name_collision + +#ifdef SWIGJAVA +SWIG_JAVABODY_PROXY(public, public, SWIGTYPE) +SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE) +#endif + +%{ +#include <string> + +namespace TopLevel +{ + namespace A + { + class Foo { + public: + virtual ~Foo() {} + virtual std::string ping() { return "TopLevel::A::Foo::ping()"; } + }; + } + + namespace B + { + class Foo { + public: + virtual ~Foo() {} + virtual std::string ping() { return "TopLevel::B:Foo::ping()"; } + }; + } +} + +%} + +%include <std_string.i> + +// nspace feature only supported by these languages +#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) +%nspace TopLevel::A::Foo; +%nspace TopLevel::B::Foo; +#else +#warning nspace feature not yet supported in this target language +#endif + +%feature("director") TopLevel::A::Foo; +%feature("director") TopLevel::B::Foo; + +namespace TopLevel +{ + namespace A + { + class Foo { + public: + virtual ~Foo(); + virtual std::string ping(); + }; + } + + namespace B + { + class Foo { + public: + virtual ~Foo(); + virtual std::string ping(); + }; + } +} diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index 0b3f7babb..f8da8e6cc 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -46,6 +46,7 @@ SWIGOPT += -package $(JAVA_PACKAGE) nspace.%: JAVA_PACKAGE = $*Package nspace_extend.%: JAVA_PACKAGE = $*Package director_nspace.%: JAVA_PACKAGE = $*Package +director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package # Rules for the different types of tests %.cpptest: |