Browse Source

Added two debugger tests

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@850 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
16d90f5cef
  1. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs
  2. 33
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger-StateControl.cs

@ -221,7 +221,7 @@ namespace Debugger @@ -221,7 +221,7 @@ namespace Debugger
public void WaitForPause()
{
if (IsRunning) {
WaitForPauseHandle.WaitOne();
this.MTA2STA.SoftWait(WaitForPauseHandle);
}
}

33
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs

@ -96,5 +96,38 @@ namespace DebuggerLibrary.Tests @@ -96,5 +96,38 @@ namespace DebuggerLibrary.Tests
debugger.Start((string)programs["SimpleProgram"], tempPath, "");
debugger.WaitForPrecessExit();
}
[Test]
public void RunDiagnosticsDebugHelloWorld()
{
string log = "";
debugger.LogMessage += delegate(object sender, MessageEventArgs e) { log += e.Message; };
debugger.Start((string)programs["DiagnosticsDebugHelloWorld"], tempPath, "");
debugger.WaitForPrecessExit();
Assert.AreEqual("Hello world!\r\n", log);
}
[Test]
public void RunDiagnosticsDebugHelloWorldWithBreakpoint()
{
string log = "";
debugger.LogMessage += delegate(object sender, MessageEventArgs e) { log += e.Message; };
string souceCodeFilename = ((string)programs["DiagnosticsDebugHelloWorld"]).Replace(".exe",".cs");
debugger.AddBreakpoint(new SourcecodeSegment(souceCodeFilename, 16), true);
debugger.Start((string)programs["DiagnosticsDebugHelloWorld"], tempPath, "");
debugger.WaitForPause();
Assert.AreEqual(PausedReason.Breakpoint, debugger.PausedReason);
Assert.AreEqual("", log);
debugger.Continue();
debugger.WaitForPrecessExit();
Assert.AreEqual("Hello world!\r\n", log);
}
}
}

Loading…
Cancel
Save