Browse Source

Added debugger test: FunctionArgumentVariables

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@865 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
00cc12f465
  1. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj
  2. 54
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs
  3. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs
  4. 36
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs

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

@ -48,6 +48,7 @@ @@ -48,6 +48,7 @@
<Compile Include="Src\TestPrograms\FileRelease.cs" />
<Compile Include="Src\TestPrograms\Stepping.cs" />
<Compile Include="Src\TestPrograms\Callstack.cs" />
<Compile Include="Src\TestPrograms\FunctionArgumentVariables.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Src" />

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

@ -223,5 +223,59 @@ namespace Debugger.Tests @@ -223,5 +223,59 @@ namespace Debugger.Tests
debugger.Continue();
debugger.WaitForPrecessExit();
}
[Test]
public void FunctionArgumentVariables()
{
List<Variable> args;
StartProgram("FunctionArgumentVariables");
WaitForPause(PausedReason.Break, null);
for(int i = 0; i < 2; i++) {
debugger.Continue();
WaitForPause(PausedReason.Break, null);
args = new List<Variable>(debugger.CurrentFunction.ArgumentVariables);
// Argument names
Assert.AreEqual("i", args[0].Name);
Assert.AreEqual("s", args[1].Name);
Assert.AreEqual("args", args[2].Name);
// Argument types
Assert.AreEqual(typeof(PrimitiveValue), args[0].Value.GetType());
Assert.AreEqual(typeof(PrimitiveValue), args[1].Value.GetType());
Assert.AreEqual(typeof(ArrayValue), args[2].Value.GetType());
// Argument values
Assert.AreEqual("0", args[0].Value.AsString);
Assert.AreEqual("S", args[1].Value.AsString);
Assert.AreEqual(0 ,((ArrayValue)args[2].Value).Lenght);
debugger.Continue();
WaitForPause(PausedReason.Break, null);
args = new List<Variable>(debugger.CurrentFunction.ArgumentVariables);
// Argument types
Assert.AreEqual(typeof(PrimitiveValue), args[0].Value.GetType());
Assert.AreEqual(typeof(PrimitiveValue), args[1].Value.GetType());
Assert.AreEqual(typeof(ArrayValue), args[2].Value.GetType());
// Argument values
Assert.AreEqual("1", args[0].Value.AsString);
Assert.AreEqual("S", args[1].Value.AsString);
Assert.AreEqual(1 ,((ArrayValue)args[2].Value).Lenght);
debugger.Continue();
WaitForPause(PausedReason.Break, null);
args = new List<Variable>(debugger.CurrentFunction.ArgumentVariables);
// Argument types
Assert.AreEqual(typeof(PrimitiveValue), args[0].Value.GetType());
Assert.AreEqual(typeof(NullValue), args[1].Value.GetType());
Assert.AreEqual(typeof(ArrayValue), args[2].Value.GetType());
// Argument values
Assert.AreEqual("2", args[0].Value.AsString);
Assert.IsNotNull(args[1].Value.AsString);
Assert.AreEqual(2 ,((ArrayValue)args[2].Value).Lenght);
}
debugger.Continue();
debugger.WaitForPrecessExit();
}
}
}

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

@ -23,6 +23,7 @@ namespace Debugger.Tests @@ -23,6 +23,7 @@ namespace Debugger.Tests
case "Breakpoint": Progs.Breakpoint.Main(); break;
case "Callstack": Progs.Callstack.Main(); break;
case "FileRelease": Progs.FileRelease.Main(); break;
case "FunctionArgumentVariables": Progs.FunctionArgumentVariables.Main(); break;
case "HelloWorld": Progs.HelloWorld.Main(); break;
case "SimpleProgram": Progs.SimpleProgram.Main(); break;
case "Stepping": Progs.Stepping.Main(); break;

36
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
namespace Debugger.Tests.TestPrograms
{
public class FunctionArgumentVariables
{
public static void Main()
{
System.Diagnostics.Debugger.Break();
StaticFunction(0, "S");
StaticFunction(1, "S", "p1");
StaticFunction(2, null, "p1", "p2");
new FunctionArgumentVariables().Function(0, "S");
new FunctionArgumentVariables().Function(1, "S", "p1");
new FunctionArgumentVariables().Function(2, null, "p1", "p2");
}
static void StaticFunction(int i, string s, params string[] args)
{
System.Diagnostics.Debugger.Break();
}
void Function(int i, string s, params string[] args)
{
System.Diagnostics.Debugger.Break();
}
}
}
Loading…
Cancel
Save