Browse Source

Added debugger test: ArrayValue

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1059 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
57e48ef856
  1. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj
  2. 34
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs
  3. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs
  4. 23
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs

1
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj

@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
<Compile Include="Src\TestPrograms\PropertyVariable.cs" />
<Compile Include="Src\TestPrograms\PropertyVariableForm.cs" />
<Compile Include="Src\TestPrograms\SetIP.cs" />
<Compile Include="Src\TestPrograms\ArrayValue.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Src" />

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

@ -46,6 +46,12 @@ namespace Debugger.Tests @@ -46,6 +46,12 @@ namespace Debugger.Tests
};
}
[TearDown]
void TearDown()
{
debugger.Terminate();
}
void StartProgram(string programName)
{
StartProgram(assemblyFilename, programName);
@ -55,6 +61,7 @@ namespace Debugger.Tests @@ -55,6 +61,7 @@ namespace Debugger.Tests
{
log = "";
lastLogMessage = null;
debugger.Terminate();
debugger.Start(exeFilename, Path.GetDirectoryName(exeFilename), programName);
}
@ -395,6 +402,33 @@ namespace Debugger.Tests @@ -395,6 +402,33 @@ namespace Debugger.Tests
debugger.WaitForPrecessExit();
}
[Test]
public void ArrayValue()
{
Variable local = null;
List<Variable> subVars = new List<Variable>();
StartProgram("ArrayValue");
WaitForPause(PausedReason.Break, null);
foreach(Variable var in debugger.CurrentFunction.LocalVariables) {
local = var; break;
}
Assert.AreEqual("array", local.Name);
Assert.AreEqual(true, local.MayHaveSubVariables);
Assert.AreEqual(typeof(ArrayValue), local.Value.GetType());
Assert.AreEqual("{System.Int32[5]}", local.Value.AsString);
foreach(Variable var in local.SubVariables) {
subVars.Add(var);
}
for(int i = 0; i < 5; i++) {
Assert.AreEqual("[" + i.ToString() + "]", subVars[i].Name);
Assert.AreEqual(i.ToString(), subVars[i].Value.AsString);
}
debugger.Continue();
debugger.WaitForPrecessExit();
}
[Test]
public void ObjectValue()
{

1
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs

@ -19,6 +19,7 @@ namespace Debugger.Tests @@ -19,6 +19,7 @@ namespace Debugger.Tests
return;
}
switch (args[0]) {
case "ArrayValue": Progs.ArrayValue.Main(); break;
case "Break": Progs.Break.Main(); break;
case "Breakpoint": Progs.Breakpoint.Main(); break;
case "Callstack": Progs.Callstack.Main(); break;

23
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
namespace Debugger.Tests.TestPrograms
{
public class ArrayValue
{
public static void Main()
{
int[] array = new int[5];
for(int i = 0; i < 5; i++) {
array[i] = i;
}
System.Diagnostics.Debugger.Break();
}
}
}
Loading…
Cancel
Save