From 48a2e0bdea237f658507650e6b7233205385d72a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 22 Jul 2010 17:01:36 +0000 Subject: Correct top_{src,build}dir definitions in csharp and java test suite. The ".." artificially appended to these variables was enough to make the build work in the source directory but broke down when the build directory was different from the source one. Remove this hack and use absolute path to the build directory instead to ensure that it's still valid even when csharp/java makefiles invoke swig_and_compile_{c,cpp} macros from a subdirectory. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12173 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index ba225f6e9..0fc8c0511 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -7,8 +7,8 @@ JAVA = java JAVAC = javac SCRIPTSUFFIX = _runme.java srcdir = @srcdir@ -top_srcdir = @top_srcdir@/.. -top_builddir = @top_builddir@/.. +top_srcdir = @top_srcdir@ +top_builddir = $(abspath @top_builddir@) C_TEST_CASES = \ java_lib_arrays \ -- cgit v1.2.1 From 70c5bb5a47d7380cf5b5371a2b84ad04f330053a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 22 Jul 2010 17:02:10 +0000 Subject: Add support for "[not]regexmatch" and "regextarget" to %rename. "regexmatch" and "notregexmatch" can be used with anonymous %renames in the same way as "match" and "notmatch" while "regextarget" specifies that the argument of a non-anonymous %rename should be interpreted as a regular expression. Document the new functions. Also add a new unit test for %regex also testing regexmatch &c and provide test code for C# and Java verifying that it works as intended. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12174 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/java/rename_pcre_enum_runme.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Examples/test-suite/java/rename_pcre_enum_runme.java (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/rename_pcre_enum_runme.java b/Examples/test-suite/java/rename_pcre_enum_runme.java new file mode 100644 index 000000000..a8bfef46a --- /dev/null +++ b/Examples/test-suite/java/rename_pcre_enum_runme.java @@ -0,0 +1,26 @@ +import rename_pcre_enum.*; + +public class rename_pcre_enum_runme { + static { System.loadLibrary("rename_pcre_enum"); } + + public static void main(String argv[]) + { + Foo foo = Foo.First; + if ( foo == Foo.Second ) + throw new RuntimeException("Enum values should be different"); + + // Check that Foo_Max enum element was ignored. + int numFooEnumElements = Foo.values().length; + if ( numFooEnumElements != 2 ) + throw new RuntimeException(String.format("Enum should have 2 elements, not %d", + numFooEnumElements)); + + BoundaryCondition bc = BoundaryCondition.MaxMax; + if ( bc.ordinal() != 2 ) + throw new RuntimeException("Wrong enum value"); + + Colour c = Colour.red; + if ( c == Colour.blue ) + throw new RuntimeException("Enum values should be different"); + } +} -- cgit v1.2.1 From 70b4d1231743911806b8a9625926187ce914560b Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 28 Jul 2010 05:53:17 +0000 Subject: Restore in source and out of source builds for the test-suite. Note that configure must be invoked using a relative path for out of source builds git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12186 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index 0fc8c0511..1ba888fc1 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -7,8 +7,8 @@ JAVA = java JAVAC = javac SCRIPTSUFFIX = _runme.java srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -top_builddir = $(abspath @top_builddir@) +top_srcdir = ../@top_srcdir@ +top_builddir = ../@top_builddir@ C_TEST_CASES = \ java_lib_arrays \ -- cgit v1.2.1 From 69af82caa4c0207cdc150f92cac1f0498ea91928 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 26 Aug 2010 18:06:02 +0000 Subject: Fix __LINE__ and __FILE__ expansion. Mostly this did not work at all. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12192 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/java/preproc_line_file_runme.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Examples/test-suite/java/preproc_line_file_runme.java (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/preproc_line_file_runme.java b/Examples/test-suite/java/preproc_line_file_runme.java new file mode 100644 index 000000000..6550e4a78 --- /dev/null +++ b/Examples/test-suite/java/preproc_line_file_runme.java @@ -0,0 +1,41 @@ +import preproc_line_file.*; + +public class preproc_line_file_runme { + + static { + try { + System.loadLibrary("preproc_line_file"); + } 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[]) throws Throwable + { + int myline = preproc_line_file.MYLINE; + int myline_adjusted = preproc_line_file.MYLINE_ADJUSTED; + if (myline != 4) + throw new RuntimeException("preproc failure"); + if (myline + 100 + 1 != myline_adjusted) + throw new RuntimeException("preproc failure"); + + String myfile = preproc_line_file.MYFILE; + String myfile_adjusted = preproc_line_file.MYFILE_ADJUSTED; + if (!(myfile.equals("../../../../Examples/test-suite/preproc_line_file.i") || myfile.equals("..\\..\\..\\..\\Examples\\test-suite\\preproc_line_file.i"))) + throw new RuntimeException("preproc failure"); + + if (!(myfile_adjusted.equals("../../../../Examples/test-suite/preproc_line_file.i.bak") || myfile_adjusted.equals("..\\..\\..\\..\\Examples\\test-suite\\preproc_line_file.i.bak"))) + throw new RuntimeException("preproc failure"); + + if (!preproc_line_file.MY_STRINGNUM_A.equals("my15")) + throw new RuntimeException("preproc failed MY_STRINGNUM_A"); + + if (!preproc_line_file.MY_STRINGNUM_B.equals("my16")) + throw new RuntimeException("preproc failed MY_STRINGNUM_B"); + + int myline2 = preproc_line_file.MYLINE2; + if (myline2 != 23) + throw new RuntimeException("preproc failure"); + } +} -- cgit v1.2.1 From 5a6443ebcfaf0865b347d24704b3acb06b4f20d9 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 29 Aug 2010 22:11:03 +0000 Subject: Fix some more instances of __LINE__ and __FILE__ numbering git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12194 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/preproc_line_file_runme.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/preproc_line_file_runme.java b/Examples/test-suite/java/preproc_line_file_runme.java index 6550e4a78..e390b0c19 100644 --- a/Examples/test-suite/java/preproc_line_file_runme.java +++ b/Examples/test-suite/java/preproc_line_file_runme.java @@ -34,8 +34,16 @@ public class preproc_line_file_runme { if (!preproc_line_file.MY_STRINGNUM_B.equals("my16")) throw new RuntimeException("preproc failed MY_STRINGNUM_B"); - int myline2 = preproc_line_file.MYLINE2; - if (myline2 != 23) + if (preproc_line_file.getThing27() != -1) + throw new RuntimeException("preproc failure"); + + if (preproc_line_file.getThing28() != -2) + throw new RuntimeException("preproc failure"); + + if (preproc_line_file.MYLINE2 != 30) + throw new RuntimeException("preproc failure"); + + if (SillyStruct.LINE_NUMBER != 41) throw new RuntimeException("preproc failure"); } } -- cgit v1.2.1 From aa728ece671c7e135d6d6dc7ab299dc6bfc78308 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 1 Sep 2010 21:06:10 +0000 Subject: Fix __LINE__ and __FILE__ expansion in macros with no arguments git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12197 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/preproc_line_file_runme.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/preproc_line_file_runme.java b/Examples/test-suite/java/preproc_line_file_runme.java index e390b0c19..7200e4a53 100644 --- a/Examples/test-suite/java/preproc_line_file_runme.java +++ b/Examples/test-suite/java/preproc_line_file_runme.java @@ -45,5 +45,8 @@ public class preproc_line_file_runme { if (SillyStruct.LINE_NUMBER != 41) throw new RuntimeException("preproc failure"); + + if (SillyMacroClass.LINE_NUM != 45) + throw new RuntimeException("preproc failure"); } } -- cgit v1.2.1 From 45601f24b4209b1f00b6897a01afc3ecfcf07b40 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 3 Sep 2010 17:47:12 +0000 Subject: Fix line numbers in error and warning messages for preprocessor messages within %inline. Also fixes __LINE__ within %inline git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12200 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/preproc_line_file_runme.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/preproc_line_file_runme.java b/Examples/test-suite/java/preproc_line_file_runme.java index 7200e4a53..8119824e9 100644 --- a/Examples/test-suite/java/preproc_line_file_runme.java +++ b/Examples/test-suite/java/preproc_line_file_runme.java @@ -11,6 +11,8 @@ public class preproc_line_file_runme { } } + public static String FILENAME_WINDOWS = "..\\..\\..\\..\\Examples\\test-suite\\preproc_line_file.i"; + public static String FILENAME_UNIX = "../../../../Examples/test-suite/preproc_line_file.i"; public static void main(String argv[]) throws Throwable { int myline = preproc_line_file.MYLINE; @@ -22,10 +24,10 @@ public class preproc_line_file_runme { String myfile = preproc_line_file.MYFILE; String myfile_adjusted = preproc_line_file.MYFILE_ADJUSTED; - if (!(myfile.equals("../../../../Examples/test-suite/preproc_line_file.i") || myfile.equals("..\\..\\..\\..\\Examples\\test-suite\\preproc_line_file.i"))) + if (!(myfile.equals(FILENAME_UNIX) || myfile.equals(FILENAME_WINDOWS))) throw new RuntimeException("preproc failure"); - if (!(myfile_adjusted.equals("../../../../Examples/test-suite/preproc_line_file.i.bak") || myfile_adjusted.equals("..\\..\\..\\..\\Examples\\test-suite\\preproc_line_file.i.bak"))) + if (!(myfile_adjusted.equals(FILENAME_UNIX + ".bak") || myfile_adjusted.equals(FILENAME_WINDOWS + ".bak"))) throw new RuntimeException("preproc failure"); if (!preproc_line_file.MY_STRINGNUM_A.equals("my15")) @@ -48,5 +50,15 @@ public class preproc_line_file_runme { if (SillyMacroClass.LINE_NUM != 45) throw new RuntimeException("preproc failure"); + + if (SillyMultipleMacroStruct.LINE_NUM != 70) + throw new RuntimeException("preproc failure"); + + if (preproc_line_file.INLINE_LINE != 76) + throw new RuntimeException("preproc failure"); + + String inlineFile = preproc_line_file.INLINE_FILE; + if (!(inlineFile.equals(FILENAME_UNIX) || inlineFile.equals(FILENAME_WINDOWS))) + throw new RuntimeException("preproc failure"); } } -- cgit v1.2.1 From e3092a6150860764792767d375d22ec9ced2d54f Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 10 Sep 2010 06:40:42 +0000 Subject: Remove java specifics from testcase git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12212 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/preproc_line_file_runme.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/preproc_line_file_runme.java b/Examples/test-suite/java/preproc_line_file_runme.java index 8119824e9..9b47ae4bd 100644 --- a/Examples/test-suite/java/preproc_line_file_runme.java +++ b/Examples/test-suite/java/preproc_line_file_runme.java @@ -45,16 +45,16 @@ public class preproc_line_file_runme { if (preproc_line_file.MYLINE2 != 30) throw new RuntimeException("preproc failure"); - if (SillyStruct.LINE_NUMBER != 41) + if (SillyStruct.LINE_NUMBER != 52) throw new RuntimeException("preproc failure"); - if (SillyMacroClass.LINE_NUM != 45) + if (SillyMacroClass.LINE_NUM != 56) throw new RuntimeException("preproc failure"); - if (SillyMultipleMacroStruct.LINE_NUM != 70) + if (SillyMultipleMacroStruct.LINE_NUM != 81) throw new RuntimeException("preproc failure"); - if (preproc_line_file.INLINE_LINE != 76) + if (preproc_line_file.INLINE_LINE != 87) throw new RuntimeException("preproc failure"); String inlineFile = preproc_line_file.INLINE_FILE; -- cgit v1.2.1 From efb9090a87d557b4fe244485aa0756f944a765f5 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 11 Sep 2010 11:02:18 +0000 Subject: Fix correct line number reporting in errors/warnings when a macro definition ends with '/' and it is not the end of a C comment - swig.swg has some of these macro definitions. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12215 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/preproc_line_file_runme.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/preproc_line_file_runme.java b/Examples/test-suite/java/preproc_line_file_runme.java index 9b47ae4bd..c29cef680 100644 --- a/Examples/test-suite/java/preproc_line_file_runme.java +++ b/Examples/test-suite/java/preproc_line_file_runme.java @@ -60,5 +60,9 @@ public class preproc_line_file_runme { String inlineFile = preproc_line_file.INLINE_FILE; if (!(inlineFile.equals(FILENAME_UNIX) || inlineFile.equals(FILENAME_WINDOWS))) throw new RuntimeException("preproc failure"); + + if (Slash.LINE_NUM != 93) + throw new RuntimeException("preproc failure"); + } } -- cgit v1.2.1 From 3219746776bb1bcb9f46f895c68040303f0d4b33 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 3 Oct 2010 13:12:00 +0000 Subject: Apply patch #3066958 from Mikael Johansson to fix default smart pointer handling when the smart pointer contains both a const and non-const operator->. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12240 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../java/smart_pointer_const_overload_runme.java | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Examples/test-suite/java/smart_pointer_const_overload_runme.java (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/smart_pointer_const_overload_runme.java b/Examples/test-suite/java/smart_pointer_const_overload_runme.java new file mode 100644 index 000000000..bb4ae2c8f --- /dev/null +++ b/Examples/test-suite/java/smart_pointer_const_overload_runme.java @@ -0,0 +1,99 @@ +import smart_pointer_const_overload.*; + +public class smart_pointer_const_overload_runme { + static int CONST_ACCESS = 1; + static int MUTABLE_ACCESS = 2; + + static { + System.loadLibrary("smart_pointer_const_overload"); + } + + public static void test(Bar b, Foo f) { + Assert(f.getX() == 0); + + // Test member variable get + Assert(b.getX() == 0); + Assert(f.getAccess() == CONST_ACCESS); + + // Test member variable set + b.setX(1); + Assert(f.getX() == 1); + Assert(f.getAccess() == MUTABLE_ACCESS); + + // Test const method + Assert(b.getx() == 1); + Assert(f.getAccess() == CONST_ACCESS); + + // Test mutable method + b.setx(2); + + Assert(f.getX() == 2); + Assert(f.getAccess() == MUTABLE_ACCESS); + + // Test extended const method + Assert(b.getx2() == 2); + Assert(f.getAccess() == CONST_ACCESS); + + // Test extended mutable method + b.setx2(3); + + Assert(f.getX() == 3); + Assert(f.getAccess() == MUTABLE_ACCESS); + + // Test static method + b.stat(); + + Assert(f.getAccess() == CONST_ACCESS); + + // Test const member + f.setAccess(MUTABLE_ACCESS); + + Assert(b.getY() == 0); + Assert(f.getAccess() == CONST_ACCESS); + + // Test get through mutable pointer to const member + f.setAccess(MUTABLE_ACCESS); + + Assert(smart_pointer_const_overload.get_int(b.getYp()) == 0); + Assert(f.getAccess() == CONST_ACCESS); + + // Test get through const pointer to mutable member + f.setX(4); + f.setAccess(MUTABLE_ACCESS); + + Assert(smart_pointer_const_overload.get_int(b.getXp()) == 4); + Assert(f.getAccess() == CONST_ACCESS); + + // Test set through const pointer to mutable member + f.setAccess(MUTABLE_ACCESS); + smart_pointer_const_overload.set_int(b.getXp(), 5); + + Assert(f.getX() == 5); + Assert(f.getAccess() == CONST_ACCESS); + + // Test set pointer to const member + b.setYp(smart_pointer_const_overload.new_int(6)); + + Assert(f.getY() == 0); + Assert(smart_pointer_const_overload.get_int(f.getYp()) == 6); + Assert(f.getAccess() == MUTABLE_ACCESS); + + smart_pointer_const_overload.delete_int(f.getYp()); + } + + public static void main(String argv[]) { + Foo f = new Foo(); + Bar b = new Bar(f); + + //Foo f2 = new Foo(); + //Bar b2 = new Bar2(f2); + + test(b, f); + //test(b2, f2); + } + + public static void Assert(boolean b) { + if (!b) + throw new RuntimeException("Assertion failed"); + } +} -- cgit v1.2.1 From c9ede7e62278085ce4560f8ff1ff227d11e6d4a6 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 13 Oct 2010 05:48:59 +0000 Subject: Fix unary scope operator (::) (global scope) regression introduced in 2.0.0. The mangled symbol names were incorrect, sometimes resulting in types being incorrectly treated as opaque types. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12264 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/java/global_namespace_runme.java | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/global_namespace_runme.java b/Examples/test-suite/java/global_namespace_runme.java index faab7d4ba..205e149b0 100644 --- a/Examples/test-suite/java/global_namespace_runme.java +++ b/Examples/test-suite/java/global_namespace_runme.java @@ -13,8 +13,38 @@ public class global_namespace_runme { public static void main(String argv[]) { - KlassMethods.methodA(new Klass1(), new Klass2(), new Klass3(), new Klass4(), new Klass5(), new Klass6(), new Klass7()); - KlassMethods.methodB(new Klass1(), new Klass2(), new Klass3(), new Klass4(), new Klass5(), new Klass6(), new Klass7()); + Klass1 k1 = new Klass1(); + Klass2 k2 = new Klass2(); + Klass3 k3 = new Klass3(); + Klass4 k4 = new Klass4(); + Klass5 k5 = new Klass5(); + Klass6 k6 = new Klass6(); + Klass7 k7 = new Klass7(); + + KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7); + KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7); + + k1 = global_namespace.getKlass1A(); + k2 = global_namespace.getKlass2A(); + k3 = global_namespace.getKlass3A(); + k4 = global_namespace.getKlass4A(); + k5 = global_namespace.getKlass5A(); + k6 = global_namespace.getKlass6A(); + k7 = global_namespace.getKlass7A(); + + KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7); + KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7); + + k1 = global_namespace.getKlass1B(); + k2 = global_namespace.getKlass2B(); + k3 = global_namespace.getKlass3B(); + k4 = global_namespace.getKlass4B(); + k5 = global_namespace.getKlass5B(); + k6 = global_namespace.getKlass6B(); + k7 = global_namespace.getKlass7B(); + + KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7); + KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7); XYZMethods.methodA(new XYZ1(), new XYZ2(), new XYZ3(), new XYZ4(), new XYZ5(), new XYZ6(), new XYZ7()); XYZMethods.methodB(new XYZ1(), new XYZ2(), new XYZ3(), new XYZ4(), new XYZ5(), new XYZ6(), new XYZ7()); -- cgit v1.2.1 From f6cab0170abdb69b1ac562b223d101bf55e5700f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 16 Nov 2010 14:09:39 +0000 Subject: Ignore non-matching regex renames when searching renames list. Skip over %renames with non-matching %(regex)s expansion when looking for the one to apply to the given name. This allows to have multiple anonymous renames using regex as now the first _matching_ one will be used instead of always using the first one and ignoring all the rest of them. Extend unit tests to verify that applying two anonymous %renames does work as expected. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12293 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/rename_pcre_encoder_runme.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Examples/test-suite/java/rename_pcre_encoder_runme.java (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/rename_pcre_encoder_runme.java b/Examples/test-suite/java/rename_pcre_encoder_runme.java new file mode 100644 index 000000000..cb843338b --- /dev/null +++ b/Examples/test-suite/java/rename_pcre_encoder_runme.java @@ -0,0 +1,14 @@ +import rename_pcre_encoder.*; + +public class rename_pcre_encoder_runme { + static { System.loadLibrary("rename_pcre_encoder"); } + + public static void main(String argv[]) + { + SomeWidget w = new SomeWidget(); + w.putBorderWidth(17); + if ( w.getBorderWidth() != 17 ) + throw new RuntimeException(String.format("Border with should be 17, not %d", + w.getBorderWidth())); + } +} -- cgit v1.2.1 From 64852460a0c70c0511bf5285980786a8500cdb7a Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 8 Dec 2010 19:56:14 +0000 Subject: Fix wallkw runtime test since D was added git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12338 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/wallkw_runme.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/wallkw_runme.java b/Examples/test-suite/java/wallkw_runme.java index 028c2a32f..3b1007291 100644 --- a/Examples/test-suite/java/wallkw_runme.java +++ b/Examples/test-suite/java/wallkw_runme.java @@ -19,7 +19,7 @@ public class wallkw_runme { throw new RuntimeException("delegate keyword fail"); if (!wallkw._pass().equals("pass")) throw new RuntimeException("pass keyword fail"); - if (!wallkw.C_alias().equals("alias")) + if (!wallkw._alias().equals("alias")) throw new RuntimeException("alias keyword fail"); } } -- cgit v1.2.1 From 93b030ec6a38301cb6a48278e52ef7e9d82bdc7c Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 8 Dec 2010 19:58:19 +0000 Subject: Fix wallkw runtime test since D was added git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12339 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/wallkw_runme.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/wallkw_runme.java b/Examples/test-suite/java/wallkw_runme.java index 3b1007291..7695cda24 100644 --- a/Examples/test-suite/java/wallkw_runme.java +++ b/Examples/test-suite/java/wallkw_runme.java @@ -21,5 +21,7 @@ public class wallkw_runme { throw new RuntimeException("pass keyword fail"); if (!wallkw._alias().equals("alias")) throw new RuntimeException("alias keyword fail"); + if (!wallkw.C_rescue().equals("rescue")) + throw new RuntimeException("rescue keyword fail"); } } -- cgit v1.2.1 From 8f1bde9d81c84bd3f761803eec6c5ab456633cf0 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 14 Dec 2010 21:38:36 +0000 Subject: Fix expansion in array typemaps git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12347 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/typemap_arrays_runme.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Examples/test-suite/java/typemap_arrays_runme.java (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/typemap_arrays_runme.java b/Examples/test-suite/java/typemap_arrays_runme.java new file mode 100644 index 000000000..1ca062f78 --- /dev/null +++ b/Examples/test-suite/java/typemap_arrays_runme.java @@ -0,0 +1,19 @@ +import typemap_arrays.*; + +public class typemap_arrays_runme { + + static { + try { + System.loadLibrary("typemap_arrays"); + } 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[]) { + if (typemap_arrays.sumA(null) != 60) + throw new RuntimeException("Sum is wrong"); + } +} + -- cgit v1.2.1 From cdc8d13ae64a1a28fdd6979cf8f05c54992b2dc1 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 5 Jan 2011 21:15:10 +0000 Subject: Fix rname testcase when run under OpenJDK icedtea on Linux because libjvm.so also contains a class called Base. Also remove need for Go specific handling in this testcase. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12372 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/rname_runme.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/rname_runme.java b/Examples/test-suite/java/rname_runme.java index 7f2ab2f75..dac0a1ecf 100644 --- a/Examples/test-suite/java/rname_runme.java +++ b/Examples/test-suite/java/rname_runme.java @@ -30,7 +30,7 @@ public class rname_runme { throw new RuntimeException("base.newname"); RenamedDerived derived = new RenamedDerived(); - derived.func(base, base, base); + derived.Xfunc(base, base, base); if (!derived.newname(10.0).equals("Derived")) throw new RuntimeException("derived.newname"); } -- cgit v1.2.1 From ef865e06d5e8c8f9498068d5ca9ce2a4338e9eaa Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 14 Jan 2011 19:06:43 +0000 Subject: Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and (char *STRING, int LENGTH) - Java patch is from Volker Grabsch. Elements of the primitive_types.i testcase for this moved into char_binary.i. Documentation for this enhanced. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12393 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/char_binary_runme.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Examples/test-suite/java/char_binary_runme.java (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/char_binary_runme.java b/Examples/test-suite/java/char_binary_runme.java new file mode 100644 index 000000000..9227f8617 --- /dev/null +++ b/Examples/test-suite/java/char_binary_runme.java @@ -0,0 +1,24 @@ +import char_binary.*; + +public class char_binary_runme { + + static { + try { + System.loadLibrary("char_binary"); + } 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[]) { + Test t = new Test(); + byte[] hile = "hile".getBytes(); + byte[] hil0 = "hil\0".getBytes(); + if (t.strlen(hile) != 4) + throw new RuntimeException("bad multi-arg typemap"); + + if (t.strlen(hil0) != 4) + throw new RuntimeException("bad multi-arg typemap"); + } +} -- cgit v1.2.1 From 640cce2c50ac3fa86f8575fe5262c1fd257dbb44 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 30 Jan 2011 00:42:27 +0000 Subject: Fix typecheck typemaps for SWIGTYPE *const& git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12413 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/pointer_reference_runme.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/pointer_reference_runme.java b/Examples/test-suite/java/pointer_reference_runme.java index e8bd6800e..284951611 100644 --- a/Examples/test-suite/java/pointer_reference_runme.java +++ b/Examples/test-suite/java/pointer_reference_runme.java @@ -19,5 +19,8 @@ public class pointer_reference_runme { Struct ss = new Struct(20); pointer_reference.set(ss); if (Struct.getInstance().getValue() != 20) throw new RuntimeException("set test failed"); + + if (pointer_reference.overloading(1) != 111) throw new RuntimeException("overload test 1 failed"); + if (pointer_reference.overloading(ss) != 222) throw new RuntimeException("overload test 2 failed"); } } -- cgit v1.2.1 From 4a73d986ddc26fd8eab62219090a4bc4bb55a453 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 1 Feb 2011 07:02:50 +0000 Subject: Any 'using' statements in the protected section of a class were previously ignored with dirprot mode, certainly with Java and C#. Also directors - a call to a method being defined in the base class, not overridden in a subcalss, but again overridden in a class derived from the first subclass was not being dispatched correcly to the most derived class - affecting non-scripting languages. Fix for C# is based on recent fix for D. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12419 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/java/director_protected_runme.java | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'Examples/test-suite/java') diff --git a/Examples/test-suite/java/director_protected_runme.java b/Examples/test-suite/java/director_protected_runme.java index 464b4d4d9..63ac03502 100644 --- a/Examples/test-suite/java/director_protected_runme.java +++ b/Examples/test-suite/java/director_protected_runme.java @@ -19,6 +19,7 @@ public class director_protected_runme { Foo f = b.create(); director_protected_FooBar fb = new director_protected_FooBar(); director_protected_FooBar2 fb2 = new director_protected_FooBar2(); + director_protected_FooBar3 fb3 = new director_protected_FooBar3(); { String s = fb.used(); @@ -60,11 +61,34 @@ public class director_protected_runme { if ( !Modifier.isProtected(method.getModifiers()) ) throw new RuntimeException("Foo::ping should be protected" ); + method = b.getClass().getDeclaredMethod("cheer", (java.lang.Class[])null); + if ( !Modifier.isProtected(method.getModifiers()) ) + throw new RuntimeException("Bar::cheer should be protected" ); + + method = f.getClass().getDeclaredMethod("cheer", (java.lang.Class[])null); + if ( !Modifier.isProtected(method.getModifiers()) ) + throw new RuntimeException("Foo::cheer should be protected" ); + } catch (NoSuchMethodException n) { - throw new RuntimeException("NoSuchmethodException caught. Test failed."); + throw new RuntimeException(n); } catch (SecurityException s) { throw new RuntimeException("SecurityException caught. Test failed."); } + + if (!fb3.cheer().equals("director_protected_FooBar3::cheer();")) + throw new RuntimeException("bad fb3::cheer"); + + if (!fb2.callping().equals("director_protected_FooBar2::ping();")) + throw new RuntimeException("bad fb2.callping"); + + if (!fb2.callcheer().equals("director_protected_FooBar2::pang();Bar::pong();Foo::pong();director_protected_FooBar2::ping();")) + throw new RuntimeException("bad fb2.callcheer"); + + if (!fb3.callping().equals("Bar::ping();")) + throw new RuntimeException("bad fb3.callping"); + + if (!fb3.callcheer().equals("director_protected_FooBar3::cheer();")) + throw new RuntimeException("bad fb3.callcheer"); } } @@ -83,3 +107,9 @@ class director_protected_FooBar2 extends Bar { } } +class director_protected_FooBar3 extends Bar { + public String cheer() { + return "director_protected_FooBar3::cheer();"; + } +} + -- cgit v1.2.1