Merge branch 'patch-1'

* patch-1:
  nested_inheritance_interface testcase enhancement
  Add nested_inheritance_interface test for csharp
  Fix class name for nested classes
  Add nested_inheritance_interface test
  Fix class name for nested classes

Conflicts:
	CHANGES.current
This commit is contained in:
William S Fulton 2019-07-09 19:37:35 +01:00
commit aea7a6d30f
7 changed files with 90 additions and 2 deletions

View file

@ -324,6 +324,7 @@ CPP_TEST_CASES += \
nested_directors \
nested_comment \
nested_ignore \
nested_inheritance_interface \
nested_in_template \
nested_scope \
nested_template_base \

View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using nested_inheritance_interfaceNamespace;
public class nested_inheritance_interface_runme {
static string SortArrayToString(string[] types) {
Array.Sort<string>(types);
return string.Join(" ", types);
}
static string SortArrayToString(Type[] types) {
List<string> stypes = new List<string>();
foreach (Type t in types)
stypes.Add(t.Name);
return SortArrayToString(stypes.ToArray());
}
private static void takeIA(IASwigInterface ia) {
}
public static void Main() {
Type[] BNInterfaces = typeof(B.N).GetInterfaces();
string expectedInterfacesString = "IASwigInterface IDisposable";
string actualInterfacesString = SortArrayToString(BNInterfaces);
if (expectedInterfacesString != actualInterfacesString)
throw new Exception("Expected interfaces for " + typeof(B.N).Name + ": \n" + expectedInterfacesString + "\n" + "Actual interfaces: \n" + actualInterfacesString);
if (!typeof(IASwigInterface).IsInterface)
throw new Exception(typeof(IASwigInterface).Name + " should be an interface but is not");
// overloaded methods check
B.N d = new B.N();
takeIA(d);
}
}

View file

@ -0,0 +1,32 @@
import nested_inheritance_interface.*;
import java.util.Arrays;
public class nested_inheritance_interface_runme {
static {
try {
System.loadLibrary("nested_inheritance_interface");
} 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);
}
}
private static void takeIA(IASwigInterface ia) {
}
public static void main(String argv[]) {
Class[] BNInterfaces = B.N.class.getInterfaces();
String expectedInterfacesString = "[interface nested_inheritance_interface.IASwigInterface]";
String actualInterfacesString = Arrays.toString(BNInterfaces);
if (!expectedInterfacesString.equals(actualInterfacesString))
throw new RuntimeException("Expected interfaces for " + B.N.class.getName() + ": \n" + expectedInterfacesString + "\n" + "Actual interfaces: \n" + actualInterfacesString);
if (!IASwigInterface.class.isInterface())
throw new RuntimeException(IASwigInterface.class.getName() + " should be an interface but is not");
// overloaded methods check
B.N d = new B.N();
takeIA(d);
}
}

View file

@ -0,0 +1,15 @@
%module nested_inheritance_interface
%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
%include "swiginterface.i"
%interface(IA)
#endif
%inline %{
struct IA {};
struct B { struct N : IA {}; };
%}