add test for %extend on member variable
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11382 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
224c83ef09
commit
0576ffcde7
3 changed files with 50 additions and 1 deletions
|
|
@ -79,7 +79,7 @@ CPP_TEST_BROKEN += \
|
||||||
extend_variable \
|
extend_variable \
|
||||||
li_std_vector_ptr \
|
li_std_vector_ptr \
|
||||||
namespace_union \
|
namespace_union \
|
||||||
nested_struct \
|
nested_structs \
|
||||||
overload_complicated \
|
overload_complicated \
|
||||||
template_default_pointer \
|
template_default_pointer \
|
||||||
template_expr
|
template_expr
|
||||||
|
|
@ -220,6 +220,7 @@ CPP_TEST_CASES += \
|
||||||
li_typemaps \
|
li_typemaps \
|
||||||
li_windows \
|
li_windows \
|
||||||
long_long_apply \
|
long_long_apply \
|
||||||
|
memberin_extend \
|
||||||
member_pointer \
|
member_pointer \
|
||||||
member_template \
|
member_template \
|
||||||
minherit \
|
minherit \
|
||||||
|
|
|
||||||
26
Examples/test-suite/java/memberin_extend_runme.java
Normal file
26
Examples/test-suite/java/memberin_extend_runme.java
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
import memberin_extend.*;
|
||||||
|
|
||||||
|
public class memberin_extend_runme {
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
System.loadLibrary("memberin_extend");
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String argv[])
|
||||||
|
{
|
||||||
|
ExtendMe em1 = new ExtendMe();
|
||||||
|
ExtendMe em2 = new ExtendMe();
|
||||||
|
em1.setThing("em1thing");
|
||||||
|
em2.setThing("em2thing");
|
||||||
|
if (!em1.getThing().equals("em1thing"))
|
||||||
|
throw new RuntimeException("wrong: " + em1.getThing());
|
||||||
|
if (!em2.getThing().equals("em2thing"))
|
||||||
|
throw new RuntimeException("wrong: " + em2.getThing());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
22
Examples/test-suite/memberin_extend.i
Normal file
22
Examples/test-suite/memberin_extend.i
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
%module memberin_extend
|
||||||
|
|
||||||
|
// Tests memberin typemap. The default char * memberin typemap will be used.
|
||||||
|
// The test extends the struct with a pseudo member variable
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
#include <string>
|
||||||
|
struct ExtendMe {
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <map>
|
||||||
|
std::map<ExtendMe*, char *> ExtendMeStringMap;
|
||||||
|
#define ExtendMe_thing_set(self_, val_) ExtendMeStringMap[self_]
|
||||||
|
#define ExtendMe_thing_get(self_) ExtendMeStringMap[self_]
|
||||||
|
%}
|
||||||
|
|
||||||
|
%extend ExtendMe {
|
||||||
|
char *thing;
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue