You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -31,6 +31,7 @@ using NUnit.Framework;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace MonoTests.System.Runtime.ExceptionServices
|
||||
{
|
||||
@ -38,6 +39,14 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
[Category ("BitcodeNotWorking")]
|
||||
public class ExceptionDispatchInfoTest
|
||||
{
|
||||
static string[] GetLines (string str)
|
||||
{
|
||||
var lines = str.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// Ignore Metadata
|
||||
return lines.Where (l => !l.StartsWith ("[")).ToArray ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Capture_InvalidArguments ()
|
||||
{
|
||||
@ -75,7 +84,7 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
ed.Throw ();
|
||||
Assert.Fail ("#0");
|
||||
} catch (Exception e) {
|
||||
var s = e.StackTrace.Split ('\n');
|
||||
var s = GetLines (e.StackTrace);
|
||||
Assert.AreEqual (4, s.Length, "#1");
|
||||
Assert.AreEqual (orig, e, "#2");
|
||||
Assert.AreNotEqual (orig_stack, e.StackTrace, "#3");
|
||||
@ -90,8 +99,9 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
edi.Throw ();
|
||||
Assert.Fail ("#0");
|
||||
} catch (OperationCanceledException e) {
|
||||
Assert.IsFalse (e.StackTrace.Contains ("---"));
|
||||
Assert.AreEqual (2, e.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Length);
|
||||
Assert.IsTrue (!e.StackTrace.Contains("---"));
|
||||
var lines = GetLines (e.StackTrace);
|
||||
Assert.AreEqual (2, lines.Length, "#1");
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,9 +130,9 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
try {
|
||||
edi.Throw ();
|
||||
} catch (Exception ex) {
|
||||
var split = ex.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Assert.AreEqual (4, split.Length, "#1");
|
||||
Assert.IsTrue (split [1].Contains ("---"), "#2");
|
||||
var lines = GetLines (ex.StackTrace);
|
||||
Assert.AreEqual (4, lines.Length, "#1");
|
||||
Assert.IsTrue (lines [1].Contains ("---"), "#2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,10 +157,10 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
try {
|
||||
edi.Throw ();
|
||||
} catch (Exception ex) {
|
||||
var split = ex.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Assert.AreEqual (7, split.Length, "#1");
|
||||
Assert.IsTrue (split [1].Contains ("---"), "#2");
|
||||
Assert.IsTrue (split [4].Contains ("---"), "#3");
|
||||
var lines = GetLines (ex.StackTrace);
|
||||
Assert.AreEqual (7, lines.Length, "#1");
|
||||
Assert.IsTrue (lines [1].Contains ("---"), "#2");
|
||||
Assert.IsTrue (lines [4].Contains ("---"), "#3");
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,9 +176,9 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
var st = new StackTrace (ex, true);
|
||||
var split = st.ToString ().Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Assert.AreEqual (4, split.Length, "#1");
|
||||
Assert.IsTrue (split [1].Contains ("---"), "#2");
|
||||
var lines = GetLines (st.ToString ());
|
||||
Assert.AreEqual (4, lines.Length, "#1");
|
||||
Assert.IsTrue (lines [1].Contains ("---"), "#2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user