Merge branch 'davedissian-redundant-typedef-fix'
* davedissian-redundant-typedef-fix: Add more runtime typedef_classforward_same_name runtime testing Fixed 'typedef class Foo Foo;' edge case by iterating through linked list. Added test case for a forward declaration in a typedef with the same name
This commit is contained in:
commit
6607acdf3a
6 changed files with 67 additions and 0 deletions
|
|
@ -491,6 +491,7 @@ CPP_TEST_CASES += \
|
|||
throw_exception \
|
||||
typedef_array_member \
|
||||
typedef_class \
|
||||
typedef_classforward_same_name \
|
||||
typedef_funcptr \
|
||||
typedef_inherit \
|
||||
typedef_mptr \
|
||||
|
|
@ -677,6 +678,7 @@ C_TEST_CASES += \
|
|||
string_simple \
|
||||
struct_rename \
|
||||
struct_initialization \
|
||||
typedef_classforward_same_name \
|
||||
typedef_struct \
|
||||
typemap_subst \
|
||||
union_parameter \
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import typedef_classforward_same_name.*;
|
||||
|
||||
public class typedef_classforward_same_name_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("typedef_classforward_same_name");
|
||||
} 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[]) {
|
||||
Foo foo = new Foo();
|
||||
foo.setX(5);
|
||||
if (typedef_classforward_same_name.extractFoo(foo) != 5)
|
||||
throw new RuntimeException("unexpected value");
|
||||
|
||||
Boo boo = new Boo();
|
||||
boo.setX(5);
|
||||
if (typedef_classforward_same_name.extractBoo(boo) != 5)
|
||||
throw new RuntimeException("unexpected value");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
from typedef_classforward_same_name import *
|
||||
|
||||
foo = Foo()
|
||||
foo.x = 5
|
||||
if extractFoo(foo) != 5:
|
||||
raise RuntimeError("unexpected value")
|
||||
|
||||
boo = Boo()
|
||||
boo.x = 5
|
||||
if extractBoo(boo) != 5:
|
||||
raise RuntimeError("unexpected value")
|
||||
15
Examples/test-suite/typedef_classforward_same_name.i
Normal file
15
Examples/test-suite/typedef_classforward_same_name.i
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
%module typedef_classforward_same_name
|
||||
|
||||
%inline %{
|
||||
typedef struct Foo Foo;
|
||||
struct Foo {
|
||||
int x;
|
||||
};
|
||||
int extractFoo(Foo* foo) { return foo->x; }
|
||||
|
||||
struct Boo {
|
||||
int x;
|
||||
};
|
||||
typedef struct Boo Boo;
|
||||
int extractBoo(Boo* boo) { return boo->x; }
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue