1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
using System;
using NUnit.Framework;
using Mono.Debugger;
using Mono.Debugger.Languages;
using Mono.Debugger.Frontend;
namespace Mono.Debugger.Tests
{
[TestFixture]
public class TestDelegate : TestSuite
{
public TestDelegate ()
: base ("TestDelegate")
{ }
[Test]
[Category("ManagedTypes")]
public void Main ()
{
Process process = Start ();
Assert.IsTrue (process.IsManaged);
Assert.IsTrue (process.MainThread.IsStopped);
Thread thread = process.MainThread;
AssertStopped (thread, "X.Main()", 29);
AssertExecute ("next");
AssertStopped (thread, "X.Main()", 30);
AssertPrint (thread, "x.Foo (8)", "(long) 24");
AssertTargetOutput ("Hello World: 8");
AssertTargetOutput ("Boston: 8");
AssertNoTargetOutput ();
AssertPrint (thread, "x.Foo (9)", "(long) 27");
AssertTargetOutput ("Hello World: 9");
AssertTargetOutput ("Boston: 9");
AssertNoTargetOutput ();
AssertExecute ("step");
AssertStopped (thread, "X.foo(int)", 17);
AssertExecute ("next");
AssertTargetOutput ("Hello World: 4");
AssertNoTargetOutput ();
AssertStopped (thread, "X.foo(int)", 18);
AssertExecute ("step");
AssertStopped (thread, "X.foo(int)", 19);
AssertExecute ("step");
AssertStopped (thread, "X.boston(int)", 23);
AssertExecute ("next");
AssertTargetOutput ("Boston: 4");
AssertStopped (thread, "X.boston(int)", 24);
AssertExecute ("step");
AssertStopped (thread, "X.boston(int)", 25);
AssertExecute ("step");
AssertStopped (thread, "X.Main()", 31);
AssertPrint (thread, "x.Foo (5)", "(long) 15");
AssertTargetOutput ("Hello World: 5");
AssertTargetOutput ("Boston: 5");
AssertNoTargetOutput ();
AssertPrint (thread, "x.Foo (3)", "(long) 9");
AssertTargetOutput ("Hello World: 3");
AssertTargetOutput ("Boston: 3");
AssertNoTargetOutput ();
AssertBreakpoint ("-invoke x.Foo");
AssertExecute ("continue");
AssertTargetOutput ("Back in main");
AssertNoTargetOutput ();
AssertStopped (thread, "X.foo(int)", 17);
AssertExecute ("next");
AssertTargetOutput ("Hello World: 11");
AssertNoTargetOutput ();
AssertStopped (thread, "X.foo(int)", 18);
AssertExecute ("step");
AssertStopped (thread, "X.foo(int)", 19);
AssertExecute ("step");
AssertStopped (thread, "X.boston(int)", 23);
AssertExecute ("next");
AssertTargetOutput ("Boston: 11");
AssertNoTargetOutput ();
AssertStopped (thread, "X.boston(int)", 24);
AssertExecute ("step");
AssertStopped (thread, "X.boston(int)", 25);
AssertExecute ("step");
AssertStopped (thread, "X.Main()", 33);
AssertExecute ("continue");
AssertTargetExited (thread.Process);
}
}
}
|