mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 22:12:25 +00:00
Merge branch 'master' of https://github.com/CosmosOS/Cosmos.git
This commit is contained in:
commit
ab84bca0b7
1 changed files with 60 additions and 1 deletions
|
|
@ -21,7 +21,9 @@ namespace Cosmos.Compiler.Tests.Exceptions
|
|||
mDebugger.Send("Run");
|
||||
|
||||
TestSimpleException();
|
||||
|
||||
|
||||
var xFilter = false;
|
||||
var xShouldCatch = false;
|
||||
var xCaught = false;
|
||||
var xInFinally = false;
|
||||
mDebugger.Send("START: Test throw Exception() in method and catch in caller.");
|
||||
|
|
@ -92,6 +94,63 @@ namespace Cosmos.Compiler.Tests.Exceptions
|
|||
|
||||
Assert.IsTrue(xCaught, "Did not reach catch block (3)");
|
||||
//Assert.IsTrue(xInFinally, "Did not reach finally block (3)");
|
||||
|
||||
xFilter = false;
|
||||
xShouldCatch = false;
|
||||
xCaught = false;
|
||||
xInFinally = false;
|
||||
mDebugger.Send("START: Test throw Exception() in method and catch in caller without filter.");
|
||||
try
|
||||
{
|
||||
TestReturnSimpleException();
|
||||
}
|
||||
catch (Exception ex) where (xShouldCatch == true)
|
||||
{
|
||||
Console.WriteLine("Caught filtered exception.");
|
||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||
xFilter = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Caught exception.");
|
||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||
xCaught = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.WriteLine("Finally");
|
||||
mDebugger.Send("EXCEPTION: Finally");
|
||||
xInFinally = true;
|
||||
}
|
||||
mDebugger.Send("END");
|
||||
Assert.IsFalse(xFilter, "Should not reach filter block (4)");
|
||||
Assert.IsTrue(xCaught, "Did not reach catch block (4)");
|
||||
Assert.IsTrue(xInFinally, "Did not reach finally block (4)");
|
||||
|
||||
xFilter = false;
|
||||
xShouldCatch = true;
|
||||
xCaught = false;
|
||||
xInFinally = false;
|
||||
mDebugger.Send("START: Test throw Exception() in method and catch in caller with filter.");
|
||||
try
|
||||
{
|
||||
TestReturnSimpleException();
|
||||
}
|
||||
catch (Exception ex) where (xShouldCatch == true)
|
||||
{
|
||||
Console.WriteLine("Caught filtered exception.");
|
||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||
xFilter = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.WriteLine("Finally");
|
||||
mDebugger.Send("EXCEPTION: Finally");
|
||||
xInFinally = true;
|
||||
}
|
||||
mDebugger.Send("END");
|
||||
Assert.IsTrue(xFilter, "Did not reach filter block (5)");
|
||||
Assert.IsTrue(xInFinally, "Did not reach finally block (5)");
|
||||
|
||||
TestController.Completed();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue