From 57e48ef856bb2c2b72781e1a316654bb877e3bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Thu, 2 Feb 2006 00:08:34 +0000 Subject: [PATCH] Added debugger test: ArrayValue git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1059 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Debugger.Tests.csproj | 1 + .../Project/Src/DebuggerTests.cs | 34 +++++++++++++++++++ .../Debugger.Tests/Project/Src/TestProgram.cs | 1 + .../Project/Src/TestPrograms/ArrayValue.cs | 23 +++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj index 41872da468..153804198a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj @@ -53,6 +53,7 @@ + diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs index 56a510eab7..97ebe6212b 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs @@ -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 { log = ""; lastLogMessage = null; + debugger.Terminate(); debugger.Start(exeFilename, Path.GetDirectoryName(exeFilename), programName); } @@ -395,6 +402,33 @@ namespace Debugger.Tests debugger.WaitForPrecessExit(); } + [Test] + public void ArrayValue() + { + Variable local = null; + List subVars = new List(); + + 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() { diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs index 93f0206f0a..c1a545895c 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs @@ -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; diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs new file mode 100644 index 0000000000..e89821720e --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs @@ -0,0 +1,23 @@ +// +// +// +// +// $Revision$ +// + +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(); + } + } +}