Improve correctness of SwigDerivedClassHasMethod() tests
Tests first added in issue #1323
This commit is contained in:
parent
7eba1cfea1
commit
ea3140a981
2 changed files with 28 additions and 2 deletions
|
|
@ -48,6 +48,8 @@ public class runme
|
|||
if (myNewBar == null)
|
||||
throw new Exception("non-null pointer marshalling problem");
|
||||
myNewBar.x = 10;
|
||||
|
||||
my.testSwigDerivedClassHasMethod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +71,14 @@ class MyOverriddenClass : MyClass {
|
|||
throw new Exception("null not received as expected");
|
||||
return b;
|
||||
}
|
||||
|
||||
public bool nonVirtual() {
|
||||
throw new Exception("non-virtual overrides virtual method");
|
||||
}
|
||||
|
||||
public virtual bool nonOverride() {
|
||||
throw new Exception("non-override overrides virtual method");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,14 @@
|
|||
|
||||
%}
|
||||
|
||||
%typemap(cscode) MyClass %{
|
||||
public void testSwigDerivedClassHasMethod() {
|
||||
if (SwigDerivedClassHasMethod("nonVirtual", swigMethodTypes3))
|
||||
throw new global::System.Exception("non-overriding non-virtual method would be when connecting director");
|
||||
if (SwigDerivedClassHasMethod("nonOverride", swigMethodTypes4))
|
||||
throw new global::System.Exception("non-overriding virtual method would be when connecting director");
|
||||
}
|
||||
%}
|
||||
|
||||
%feature("director") MyClass;
|
||||
|
||||
|
|
@ -122,8 +130,16 @@ public:
|
|||
return myclass->pmethod(b);
|
||||
}
|
||||
|
||||
// Collisions with generated method names
|
||||
virtual void Connect() { }
|
||||
virtual void nonVirtual()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void nonOverride()
|
||||
{
|
||||
}
|
||||
|
||||
// Collisions with generated method names
|
||||
virtual void Connect() { }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue