From 220247c1308c5c14d6d11f2f24d1ee6dea0c21ff Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 14 May 2018 20:42:47 +0100 Subject: [PATCH] Test c++17 nested namespaces and %nspace --- Examples/test-suite/common.mk | 1 + .../cpp17_nspace_nested_namespaces.i | 13 ++++++++ .../cpp17_nspace_nested_namespaces_runme.cs | 25 ++++++++++++++++ Examples/test-suite/java/Makefile.in | 1 + .../cpp17_nspace_nested_namespaces_runme.java | 30 +++++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 Examples/test-suite/cpp17_nspace_nested_namespaces.i create mode 100644 Examples/test-suite/csharp/cpp17_nspace_nested_namespaces_runme.cs create mode 100644 Examples/test-suite/java/cpp17_nspace_nested_namespaces_runme.java diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index c502cfb65..644355958 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -163,6 +163,7 @@ CPP_TEST_CASES += \ cpp_static \ cpp_typedef \ cpp17_nested_namespaces \ + cpp17_nspace_nested_namespaces \ curiously_recurring_template_pattern \ default_args \ default_arg_expressions \ diff --git a/Examples/test-suite/cpp17_nspace_nested_namespaces.i b/Examples/test-suite/cpp17_nspace_nested_namespaces.i new file mode 100644 index 000000000..a88878de9 --- /dev/null +++ b/Examples/test-suite/cpp17_nspace_nested_namespaces.i @@ -0,0 +1,13 @@ +%module cpp17_nspace_nested_namespaces + +#if defined(SWIGJAVA) +SWIG_JAVABODY_PROXY(public, public, SWIGTYPE) +#endif + +// nspace feature only supported by these languages +#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT) +%nspace; +#endif + + +%include "cpp17_nested_namespaces.i" diff --git a/Examples/test-suite/csharp/cpp17_nspace_nested_namespaces_runme.cs b/Examples/test-suite/csharp/cpp17_nspace_nested_namespaces_runme.cs new file mode 100644 index 000000000..61a8287f4 --- /dev/null +++ b/Examples/test-suite/csharp/cpp17_nspace_nested_namespaces_runme.cs @@ -0,0 +1,25 @@ +using System; +using cpp17_nspace_nested_namespacesNamespace; + +public class cpp17_nspace_nested_namespaces_runme +{ + static void Main() + { + new cpp17_nspace_nested_namespacesNamespace.A1.A1Struct().A1Method(); + new cpp17_nspace_nested_namespacesNamespace.A1.B1.B1Struct().B1Method(); + new cpp17_nspace_nested_namespacesNamespace.A1.B1.C1.C1Struct().C1Method(); + cpp17_nspace_nested_namespaces.createA1Struct().A1Method(); + cpp17_nspace_nested_namespaces.createB1Struct().B1Method(); + cpp17_nspace_nested_namespaces.createC1Struct().C1Method(); + + new cpp17_nspace_nested_namespacesNamespace.A2.B2.B2Struct().B2Method(); + new cpp17_nspace_nested_namespacesNamespace.A2.B2.C2.C2Struct().C2Method(); + cpp17_nspace_nested_namespaces.createB2Struct().B2Method(); + cpp17_nspace_nested_namespaces.createC2Struct().C2Method(); + + new cpp17_nspace_nested_namespacesNamespace.A3.B3.B3Struct().B3Method(); + new cpp17_nspace_nested_namespacesNamespace.A3.B3.C3.C3Struct().C3Method(); + cpp17_nspace_nested_namespaces.createB3Struct().B3Method(); + cpp17_nspace_nested_namespaces.createC3Struct().C3Method(); + } +} diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index 5f1dc375b..87538de59 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -59,6 +59,7 @@ JAVA_PACKAGEOPT = -package $(JAVA_PACKAGE) SWIGOPT += $(JAVA_PACKAGEOPT) # Custom tests - tests with additional commandline options +cpp17_nspace_nested_namespaces.%: JAVA_PACKAGE = $*Package director_nspace.%: JAVA_PACKAGE = $*Package director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package java_director_exception_feature_nspace.%: JAVA_PACKAGE = $*Package diff --git a/Examples/test-suite/java/cpp17_nspace_nested_namespaces_runme.java b/Examples/test-suite/java/cpp17_nspace_nested_namespaces_runme.java new file mode 100644 index 000000000..e603484ab --- /dev/null +++ b/Examples/test-suite/java/cpp17_nspace_nested_namespaces_runme.java @@ -0,0 +1,30 @@ +public class cpp17_nspace_nested_namespaces_runme { + + static { + try { + System.loadLibrary("cpp17_nspace_nested_namespaces"); + } 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[]) { + new cpp17_nspace_nested_namespacesPackage.A1.A1Struct().A1Method(); + new cpp17_nspace_nested_namespacesPackage.A1.B1.B1Struct().B1Method(); + new cpp17_nspace_nested_namespacesPackage.A1.B1.C1.C1Struct().C1Method(); + cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createA1Struct().A1Method(); + cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB1Struct().B1Method(); + cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC1Struct().C1Method(); + + new cpp17_nspace_nested_namespacesPackage.A2.B2.B2Struct().B2Method(); + new cpp17_nspace_nested_namespacesPackage.A2.B2.C2.C2Struct().C2Method(); + cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB2Struct().B2Method(); + cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC2Struct().C2Method(); + + new cpp17_nspace_nested_namespacesPackage.A3.B3.B3Struct().B3Method(); + new cpp17_nspace_nested_namespacesPackage.A3.B3.C3.C3Struct().C3Method(); + cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createB3Struct().B3Method(); + cpp17_nspace_nested_namespacesPackage.cpp17_nspace_nested_namespaces.createC3Struct().C3Method(); + } +}