You've already forked linux-packaging-mono
Imported Upstream version 5.16.0.100
Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
parent
0a9828183b
commit
7d7f676260
@@ -11,6 +11,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace MonoTests.System.Diagnostics
|
||||
{
|
||||
@@ -180,7 +181,7 @@ namespace MonoTests.System.Diagnostics
|
||||
frame1.GetFileLineNumber (),
|
||||
"Line number (1)");
|
||||
|
||||
Assert.AreEqual (134,
|
||||
Assert.AreEqual (135,
|
||||
frame2.GetFileLineNumber (),
|
||||
"Line number (2)");
|
||||
|
||||
@@ -320,7 +321,7 @@ namespace MonoTests.System.Diagnostics
|
||||
frame1.GetFileLineNumber (),
|
||||
"Line number (1)");
|
||||
|
||||
Assert.AreEqual (270,
|
||||
Assert.AreEqual (271,
|
||||
frame2.GetFileLineNumber (),
|
||||
"Line number (2)");
|
||||
}
|
||||
@@ -341,6 +342,41 @@ namespace MonoTests.System.Diagnostics
|
||||
"Column number (2)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test whether GetFrames contains the frames for nested exceptions
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void GetFramesAndNestedExc ()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw new Exception("This is a test");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ExceptionDispatchInfo.Capture(e.InnerException ?? e).Throw();
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
StackTrace st = new StackTrace(ee, true);
|
||||
StackFrame[] frames = st.GetFrames();
|
||||
|
||||
//Console.WriteLine("StackFrame.ToString() foreach StackFrame in Stacktrace.GetFrames():");
|
||||
//foreach (StackFrame frame in frames)
|
||||
//Console.WriteLine(frame);
|
||||
//Console.WriteLine("Expecting: Main, Throw, Main");
|
||||
|
||||
Assert.AreEqual (3, frames.Length);
|
||||
var wrongFrames = false;
|
||||
Assert.AreEqual ("GetFramesAndNestedExc", frames [0].GetMethod ().Name);
|
||||
Assert.AreEqual ("Throw", frames [1].GetMethod ().Name);
|
||||
Assert.AreEqual ("GetFramesAndNestedExc", frames [2].GetMethod ().Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests whether getting method associated with frame works.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user