diff --git a/SWIG/Examples/test-suite/common.mk b/SWIG/Examples/test-suite/common.mk index 0c11d4b3a..a2823e44e 100644 --- a/SWIG/Examples/test-suite/common.mk +++ b/SWIG/Examples/test-suite/common.mk @@ -56,7 +56,8 @@ CPP_TEST_BROKEN += \ using_namespace # Broken C test cases. (Can be run individually using make testcase.ctest.) -C_TEST_BROKEN += +C_TEST_BROKEN += \ + inctest.i # C++ test cases. (Can be run individually using make testcase.cpptest.) diff --git a/SWIG/Examples/test-suite/inctest.i b/SWIG/Examples/test-suite/inctest.i new file mode 100644 index 000000000..0b07eb345 --- /dev/null +++ b/SWIG/Examples/test-suite/inctest.i @@ -0,0 +1,15 @@ +%module inctest + + // + // This test fails if swig is not able to include + // the following two files: + // + // 'testdir/subdir1/hello.i' + // 'testdir/subdir2/hello.i' + // + // since they have the same basename 'hello', swig is only + // including one. This is not right, it must include both, + // as the well known compilers do. + // + +%include "testdir/test.i" diff --git a/SWIG/Examples/test-suite/python/inctest_runme.py b/SWIG/Examples/test-suite/python/inctest_runme.py new file mode 100644 index 000000000..8273c9e67 --- /dev/null +++ b/SWIG/Examples/test-suite/python/inctest_runme.py @@ -0,0 +1,22 @@ +import inctest + +try: + a = inctest.A() +except: + print "didn't find A" + print "therefore, I didn't include 'testdir/subdir1/hello.i'" + error = 1 +pass + + +try: + b = inctest.B() +except: + print "didn't find B" + print "therefore, I didn't include 'testdir/subdir2/hello.i'" + error = 1 +pass + +if error == 1: + raise RuntimeError + diff --git a/SWIG/Examples/test-suite/testdir/subdir1/hello.i b/SWIG/Examples/test-suite/testdir/subdir1/hello.i new file mode 100644 index 000000000..77f529486 --- /dev/null +++ b/SWIG/Examples/test-suite/testdir/subdir1/hello.i @@ -0,0 +1,15 @@ +#ifndef __subdir1_hello_i__ +#define __subdir1_hello_i__ + +%inline %{ + + struct A + { + }; + +%} + + + + +#endif //__subdir1_hello_i__ diff --git a/SWIG/Examples/test-suite/testdir/subdir1/subinc1.i b/SWIG/Examples/test-suite/testdir/subdir1/subinc1.i new file mode 100644 index 000000000..159d54b0a --- /dev/null +++ b/SWIG/Examples/test-suite/testdir/subdir1/subinc1.i @@ -0,0 +1 @@ +%include "hello.i" diff --git a/SWIG/Examples/test-suite/testdir/subdir2/hello.i b/SWIG/Examples/test-suite/testdir/subdir2/hello.i new file mode 100644 index 000000000..c7883eab4 --- /dev/null +++ b/SWIG/Examples/test-suite/testdir/subdir2/hello.i @@ -0,0 +1,14 @@ +#ifndef __subdir2_hello_i__ +#define __subdir2_hello_i__ + + +%inline %{ + + struct B + { + }; + +%} + + +#endif //__subdir2_hello_i__ diff --git a/SWIG/Examples/test-suite/testdir/subdir2/subinc2.i b/SWIG/Examples/test-suite/testdir/subdir2/subinc2.i new file mode 100644 index 000000000..912bf0550 --- /dev/null +++ b/SWIG/Examples/test-suite/testdir/subdir2/subinc2.i @@ -0,0 +1,2 @@ +%include "hello.i" + diff --git a/SWIG/Examples/test-suite/testdir/test.i b/SWIG/Examples/test-suite/testdir/test.i new file mode 100644 index 000000000..4c0b5fc82 --- /dev/null +++ b/SWIG/Examples/test-suite/testdir/test.i @@ -0,0 +1,3 @@ + +%include "subdir1/subinc1.i" +%include "subdir2/subinc2.i"