Add inner exception tests

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8934 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2006-03-02 23:19:56 +00:00
commit f35ca61913
2 changed files with 26 additions and 0 deletions

View file

@ -291,6 +291,16 @@ public class runme
if (testThreads[i].Failed) throw new Exception("Test Failed");
}
}
// test inner exceptions
try {
csharp_exceptions.InnerExceptionTest();
throw new Exception("InnerExceptionTest exception not caught");
} catch (InvalidOperationException e) {
if (e.Message != "My OuterException message") throw new Exception("OuterException msg incorrect");
if (e.InnerException.Message != "My InnerException message") throw new Exception("InnerException msg incorrect");
}
}
public static string CRLF = "\r\n"; // Some CLR implementations use a CRLF instead of just CR
}
@ -316,6 +326,8 @@ public class TestThread {
throw new Exception("Exception message incorrect. Expected:\n[" + expectedMessage + "]\n" + "Received:\n[" + e.Message + "]");
if (e.ParamName != "input")
throw new Exception("Exception ParamName incorrect. Expected:\n[input]\n" + "Received:\n[" + e.ParamName + "]");
if (e.InnerException != null)
throw new Exception("Unexpected inner exception");
}
if (throwsClass.dub != 1234.5678) // simple check which attempts to catch memory corruption
throw new Exception("throwsException.dub = " + throwsClass.dub + " expected: 1234.5678");