mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-07 08:41:45 +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
|
|
@ -22,6 +22,8 @@ namespace Cosmos.Compiler.Tests.Exceptions
|
||||||
|
|
||||||
TestSimpleException();
|
TestSimpleException();
|
||||||
|
|
||||||
|
var xFilter = false;
|
||||||
|
var xShouldCatch = false;
|
||||||
var xCaught = false;
|
var xCaught = false;
|
||||||
var xInFinally = false;
|
var xInFinally = false;
|
||||||
mDebugger.Send("START: Test throw Exception() in method and catch in caller.");
|
mDebugger.Send("START: Test throw Exception() in method and catch in caller.");
|
||||||
|
|
@ -93,6 +95,63 @@ namespace Cosmos.Compiler.Tests.Exceptions
|
||||||
Assert.IsTrue(xCaught, "Did not reach catch block (3)");
|
Assert.IsTrue(xCaught, "Did not reach catch block (3)");
|
||||||
//Assert.IsTrue(xInFinally, "Did not reach finally 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();
|
TestController.Completed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue