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
|
using System;
using NUnit.Framework;
using Mono.Debugger;
using Mono.Debugger.Languages;
using Mono.Debugger.Frontend;
namespace Mono.Debugger.Tests
{
[TestFixture]
public class TestRestart : TestSuite
{
public TestRestart ()
: base ("TestRestart")
{ }
const int line_main = 7;
const int line_test = 15;
const int line_bar = 23;
int bpt_test;
int bpt_bar;
[Test]
[Category("Session")]
public void Main ()
{
Process process = Start ();
Assert.IsTrue (process.IsManaged);
Assert.IsTrue (process.MainThread.IsStopped);
Thread thread = process.MainThread;
AssertStopped (thread, "X.Main()", line_main);
bpt_test = AssertBreakpoint (line_test);
bpt_bar = AssertBreakpoint ("Foo.Bar");
AssertExecute ("continue");
AssertTargetOutput ("Hello World");
AssertHitBreakpoint (thread, bpt_test, "X.Test()", line_test);
AssertExecute ("continue");
AssertHitBreakpoint (thread, bpt_bar, "Foo.Bar()", line_bar);
AssertExecute ("continue");
AssertTargetOutput ("Irish Pub");
AssertTargetExited (thread.Process);
}
[Test]
[Category("Session")]
public void Restarted ()
{
Process process = Start ();
Assert.IsTrue (process.IsManaged);
Assert.IsTrue (process.MainThread.IsStopped);
Thread thread = process.MainThread;
AssertStopped (thread, "X.Main()", line_main);
AssertExecute ("continue");
AssertTargetOutput ("Hello World");
AssertHitBreakpoint (thread, bpt_test, "X.Test()", line_test);
AssertExecute ("continue");
AssertHitBreakpoint (thread, bpt_bar, "Foo.Bar()", line_bar);
AssertExecute ("continue");
AssertTargetOutput ("Irish Pub");
AssertTargetExited (thread.Process);
}
[Test]
[Category("Session")]
public void SecondRestart ()
{
Process process = Start ();
Assert.IsTrue (process.IsManaged);
Assert.IsTrue (process.MainThread.IsStopped);
Thread thread = process.MainThread;
AssertStopped (thread, "X.Main()", line_main);
AssertExecute ("disable " + bpt_test);
AssertExecute ("continue");
AssertTargetOutput ("Hello World");
AssertHitBreakpoint (thread, bpt_bar, "Foo.Bar()", line_bar);
AssertExecute ("continue");
AssertTargetOutput ("Irish Pub");
AssertTargetExited (thread.Process);
}
}
}
|