Browse Source

Move testing code to the tests

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2850 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
7ad7219b5a
  1. 416
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs
  2. 21
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs
  3. 18
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Break.cs
  4. 30
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Breakpoint.cs
  5. 27
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Callstack.cs
  6. 18
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/DebuggeeKilled.cs
  7. 17
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Exception.cs
  8. 17
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ExceptionCustom.cs
  9. 23
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Expressions.cs
  10. 13
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FileRelease.cs
  11. 36
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLifetime.cs
  12. 21
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs
  13. 2
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.xml
  14. 64
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionVariablesLifetime.cs
  15. 20
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs
  16. 26
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Generics.cs
  17. 15
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/HelloWorld.cs
  18. 29
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.cs
  19. 44
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/PropertyVariable.cs
  20. 43
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/PropertyVariableForm.cs
  21. 27
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/SetIP.cs
  22. 15
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/SimpleProgram.cs
  23. 51
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Stepping.cs
  24. 9
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Symbols.cs
  25. 4
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ValueType.cs
  26. 4
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ValueType.xml

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

@ -24,422 +24,6 @@ namespace Debugger.Tests @@ -24,422 +24,6 @@ namespace Debugger.Tests
[TestFixture]
public partial class DebuggerTests: DebuggerTestsBase
{
[Test]
public void SimpleProgram()
{
StartTest("SimpleProgram");
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void HelloWorld()
{
StartTest("HelloWorld");
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void Break()
{
StartTest("Break");
WaitForPause();
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void Breakpoint()
{
Breakpoint breakpoint = debugger.AddBreakpoint(@"F:\SharpDevelopTrunk\src\AddIns\Misc\Debugger\Debugger.Tests\Project\Src\TestPrograms\Breakpoint.cs", 18);
StartTest("Breakpoint");
WaitForPause();
ObjectDump(breakpoint);
process.Continue();
WaitForPause();
process.Continue();
WaitForPause();
process.Continue();
process.WaitForExit();
ObjectDump(breakpoint);
CheckXmlOutput();
}
// [Test]
// public void FileRelease()
// {
//
// }
// [Test]
// public void DebuggeeKilled()
// {
// StartTest("DebuggeeKilled");
// WaitForPause();
// Assert.AreNotEqual(null, lastLogMessage);
// System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(int.Parse(lastLogMessage));
// p.Kill();
// process.WaitForExit();
// }
[Test]
public void Stepping()
{
StartTest("Stepping");
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOver(); // Debugger.Break
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOver(); // Debug.WriteLine 1
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepInto(); // Method Sub
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepInto(); // '{'
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepInto(); // Debug.WriteLine 2
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOut(); // Method Sub
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOver(); // Method Sub
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOver(); // Method Sub2
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void Callstack()
{
StartTest("Callstack");
WaitForPause();
ObjectDump("Callstack", process.SelectedThread.Callstack);
process.StepOut();
WaitForPause();
ObjectDump("Callstack", process.SelectedThread.Callstack);
process.StepOut();
WaitForPause();
ObjectDump("Callstack", process.SelectedThread.Callstack);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void FunctionLocalVariables()
{
StartTest("FunctionLocalVariables");
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void FunctionLifetime()
{
StartTest("FunctionLifetime");
WaitForPause();
StackFrame stackFrame = process.SelectedStackFrame;
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue(); // Go to the SubFunction
WaitForPause();
ObjectDump("Old StackFrame", stackFrame);
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue(); // Go back to Function
WaitForPause();
ObjectDump("Old StackFrame", stackFrame);
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue(); // Setp out of function
WaitForPause();
ObjectDump("Main", process.SelectedStackFrame);
ObjectDump("Old StackFrame", stackFrame);
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void FunctionVariablesLifetime()
{
Value argument = null;
Value local = null;
Value localInSubFunction = null;
Value @class = null;
StartTest("FunctionVariablesLifetime"); // 1 - Enter program
WaitForPause();
argument = process.SelectedStackFrame.GetArgumentValue(0);
local = process.SelectedStackFrame.LocalVariables["local"];
@class = process.SelectedStackFrame.ContaingClassVariables["class"];
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
process.Continue(); // 2 - Go to the SubFunction
WaitForPause();
localInSubFunction = process.SelectedStackFrame.LocalVariables["localInSubFunction"];
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
ObjectDump("localInSubFunction", @localInSubFunction);
process.Continue(); // 3 - Go back to Function
WaitForPause();
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
ObjectDump("localInSubFunction", @localInSubFunction);
process.Continue(); // 4 - Go to the SubFunction
WaitForPause();
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
ObjectDump("localInSubFunction", @localInSubFunction);
localInSubFunction = process.SelectedStackFrame.LocalVariables["localInSubFunction"];
ObjectDump("localInSubFunction(new)", @localInSubFunction);
process.Continue(); // 5 - Setp out of both functions
WaitForPause();
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
ObjectDump("localInSubFunction", @localInSubFunction);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void ArrayValue()
{
StartTest("ArrayValue");
WaitForPause();
Value array = process.SelectedStackFrame.LocalVariables["array"];
ObjectDump("array", array);
ObjectDump("array elements", array.GetArrayElements());
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test, NIgnore]
public void ObjectValue()
{
Value val = null;
StartTest("ObjectValue");
WaitForPause();
val = process.SelectedStackFrame.LocalVariables["val"];
ObjectDump("val", val);
ObjectDump("val members", val.GetMemberValues(null, Debugger.BindingFlags.All));
//ObjectDump("typeof(val)", val.Type);
process.Continue();
WaitForPause();
ObjectDump("val", val);
ObjectDump("val members", val.GetMemberValues(null, Debugger.BindingFlags.All));
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
/*
[Test]
public void PropertyVariable()
{
StartProgram("PropertyVariable");
WaitForPause();
NamedValueCollection props = process.SelectedFunction.LocalVariables["var"].GetMembers(null, Debugger.BindingFlags.All);
Assert.AreEqual(typeof(UnavailableValue), props["PrivateProperty"].Value.GetType());
process.StartEvaluation();
WaitForPause();
Assert.AreEqual("private", props["PrivateProperty"].AsString);
Assert.AreEqual(typeof(UnavailableValue), props["PublicProperty"].Value.GetType());
process.StartEvaluation();
WaitForPause();
Assert.AreEqual("public", props["PublicProperty"].AsString);
Assert.AreEqual(typeof(UnavailableValue), props["ExceptionProperty"].Value.GetType());
process.StartEvaluation();
WaitForPause();
Assert.AreEqual(typeof(UnavailableValue), props["ExceptionProperty"].Value.GetType());
Assert.AreEqual(typeof(UnavailableValue), props["StaticProperty"].Value.GetType());
process.StartEvaluation();
WaitForPause();
Assert.AreEqual("static", props["StaticProperty"].AsString);
process.Continue();
WaitForPause(PausedReason.Break, null);
process.Continue();
process.WaitForPrecessExit();
CheckXmlOutput();
}
*/
/*
[Test]
public void PropertyVariableForm()
{
Variable local = null;
StartProgram("PropertyVariableForm");
WaitForPause();
foreach(Variable var in process.SelectedFunction.LocalVariables) {
local = var;
}
Assert.AreEqual("form", local.Name);
Assert.AreEqual(typeof(Variable), local.GetType());
foreach(Variable var in local.Value.SubVariables) {
Assert.AreEqual(typeof(UnavailableValue), var.Value.GetType(), "Variable name: " + var.Name);
process.StartEvaluation();
WaitForPause();
Assert.AreNotEqual(null, var.Value.AsString, "Variable name: " + var.Name);
}
process.Continue();
WaitForPause();
foreach(Variable var in local.Value.SubVariables) {
Assert.AreEqual(typeof(UnavailableValue), var.Value.GetType(), "Variable name: " + var.Name);
}
process.StartEvaluation();
WaitForPause();
process.Continue();
process.WaitForPrecessExit();
CheckXmlOutput();
}
*/
[Test]
public void SetIP()
{
StartTest("SetIP");
WaitForPause();
Assert.IsNotNull(process.SelectedStackFrame.CanSetIP("SetIP.cs", 16, 0));
Assert.IsNull(process.SelectedStackFrame.CanSetIP("SetIP.cs", 100, 0));
process.SelectedStackFrame.SetIP("SetIP.cs", 16, 0);
process.Continue();
WaitForPause();
Assert.AreEqual("1\r\n1\r\n", log);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test, NIgnore]
public void GenericDictionary()
{
StartTest("GenericDictionary");
WaitForPause();
ObjectDump("dict", process.SelectedStackFrame.LocalVariables["dict"]);
ObjectDump("dict members", process.SelectedStackFrame.LocalVariables["dict"].GetMemberValues(null, BindingFlags.All));
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void Exception()
{
StartTest("Exception");
WaitForPause();
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void ExceptionCustom()
{
StartTest("ExceptionCustom");
WaitForPause();
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test, NIgnore]
public void Expressions()
{
StartTest("Expressions");
WaitForPause();
ObjectDump("Variables", process.SelectedStackFrame.Variables);
ObjectDump("array", process.SelectedStackFrame.Variables["array"].GetArrayElements());
ObjectDump("array2", process.SelectedStackFrame.Variables["array2"].GetArrayElements());
ObjectDump("this", process.SelectedStackFrame.ThisValue.GetMemberValues());
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
[Test]
public void Generics()
{
StartTest("Generics");
for(int i = 0; i < 8; i++) {
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue();
}
WaitForPause();
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}

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

@ -21,3 +21,24 @@ namespace Debugger.Tests.TestPrograms @@ -21,3 +21,24 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void ArrayValue()
{
StartTest("ArrayValue");
WaitForPause();
Value array = process.SelectedStackFrame.LocalVariables["array"];
ObjectDump("array", array);
ObjectDump("array elements", array.GetArrayElements());
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

18
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Break.cs

@ -17,3 +17,21 @@ namespace Debugger.Tests.TestPrograms @@ -17,3 +17,21 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void Break()
{
StartTest("Break");
WaitForPause();
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

30
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Breakpoint.cs

@ -20,3 +20,33 @@ namespace Debugger.Tests.TestPrograms @@ -20,3 +20,33 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void Breakpoint()
{
Breakpoint breakpoint = debugger.AddBreakpoint(@"F:\SharpDevelopTrunk\src\AddIns\Misc\Debugger\Debugger.Tests\Project\Src\TestPrograms\Breakpoint.cs", 18);
StartTest("Breakpoint");
WaitForPause();
ObjectDump(breakpoint);
process.Continue();
WaitForPause();
process.Continue();
WaitForPause();
process.Continue();
process.WaitForExit();
ObjectDump(breakpoint);
CheckXmlOutput();
}
}
}
#endif

27
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Callstack.cs

@ -27,3 +27,30 @@ namespace Debugger.Tests.TestPrograms @@ -27,3 +27,30 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void Callstack()
{
StartTest("Callstack");
WaitForPause();
ObjectDump("Callstack", process.SelectedThread.Callstack);
process.StepOut();
WaitForPause();
ObjectDump("Callstack", process.SelectedThread.Callstack);
process.StepOut();
WaitForPause();
ObjectDump("Callstack", process.SelectedThread.Callstack);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

18
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/DebuggeeKilled.cs

@ -19,3 +19,21 @@ namespace Debugger.Tests.TestPrograms @@ -19,3 +19,21 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
// [NUnit.Framework.Test]
// public void DebuggeeKilled()
// {
// StartTest("DebuggeeKilled");
// WaitForPause();
// Assert.AreNotEqual(null, lastLogMessage);
// System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(int.Parse(lastLogMessage));
// p.Kill();
// process.WaitForExit();
// }
}
}
#endif

17
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Exception.cs

@ -17,3 +17,20 @@ namespace Debugger.Tests.TestPrograms @@ -17,3 +17,20 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void Exception()
{
StartTest("Exception");
WaitForPause();
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

17
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ExceptionCustom.cs

@ -25,3 +25,20 @@ namespace Debugger.Tests.TestPrograms @@ -25,3 +25,20 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void ExceptionCustom()
{
StartTest("ExceptionCustom");
WaitForPause();
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

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

@ -48,3 +48,26 @@ namespace Debugger.Tests.TestPrograms @@ -48,3 +48,26 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test, NUnit.Framework.Ignore]
public void Expressions()
{
StartTest("Expressions");
WaitForPause();
ObjectDump("Variables", process.SelectedStackFrame.Variables);
ObjectDump("array", process.SelectedStackFrame.Variables["array"].GetArrayElements());
ObjectDump("array2", process.SelectedStackFrame.Variables["array2"].GetArrayElements());
ObjectDump("this", process.SelectedStackFrame.ThisValue.GetMemberValues());
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

13
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FileRelease.cs

@ -17,3 +17,16 @@ namespace Debugger.Tests.TestPrograms @@ -17,3 +17,16 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
// [NUnit.Framework.Test]
// public void FileRelease()
// {
//
// }
}
}
#endif

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

@ -30,3 +30,39 @@ namespace Debugger.Tests.TestPrograms @@ -30,3 +30,39 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void FunctionLifetime()
{
StartTest("FunctionLifetime");
WaitForPause();
StackFrame stackFrame = process.SelectedStackFrame;
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue(); // Go to the SubFunction
WaitForPause();
ObjectDump("Old StackFrame", stackFrame);
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue(); // Go back to Function
WaitForPause();
ObjectDump("Old StackFrame", stackFrame);
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue(); // Setp out of function
WaitForPause();
ObjectDump("Main", process.SelectedStackFrame);
ObjectDump("Old StackFrame", stackFrame);
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

21
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs

@ -7,8 +7,6 @@ @@ -7,8 +7,6 @@
using System;
#pragma warning disable 0219
namespace Debugger.Tests.TestPrograms
{
public class FunctionLocalVariables
@ -25,4 +23,21 @@ namespace Debugger.Tests.TestPrograms @@ -25,4 +23,21 @@ namespace Debugger.Tests.TestPrograms
}
}
#pragma warning restore 0219
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void FunctionLocalVariables()
{
StartTest("FunctionLocalVariables");
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

2
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.xml

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
</MethodInfo>
<HasSymbols>True</HasSymbols>
<HasExpired>False</HasExpired>
<NextStatement>Start=23,4 End=23,40</NextStatement>
<NextStatement>Start=21,4 End=21,40</NextStatement>
<ThisValue exception="Static method does not have 'this'." />
<ContaingClassVariables Type="ValueCollection">
<Count>0</Count>

64
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionVariablesLifetime.cs

@ -7,10 +7,6 @@ @@ -7,10 +7,6 @@
using System;
//CS0219: The variable 'variable' is assigned but its value is never used
//CS0414: The private field 'field' is assigned but its value is never used
#pragma warning disable 0219, 0414
namespace Debugger.Tests.TestPrograms
{
public class FunctionVariablesLifetime
@ -40,4 +36,62 @@ namespace Debugger.Tests.TestPrograms @@ -40,4 +36,62 @@ namespace Debugger.Tests.TestPrograms
}
}
#pragma warning restore 0219, 0414
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void FunctionVariablesLifetime()
{
Value argument = null;
Value local = null;
Value localInSubFunction = null;
Value @class = null;
StartTest("FunctionVariablesLifetime"); // 1 - Enter program
WaitForPause();
argument = process.SelectedStackFrame.GetArgumentValue(0);
local = process.SelectedStackFrame.LocalVariables["local"];
@class = process.SelectedStackFrame.ContaingClassVariables["class"];
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
process.Continue(); // 2 - Go to the SubFunction
WaitForPause();
localInSubFunction = process.SelectedStackFrame.LocalVariables["localInSubFunction"];
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
ObjectDump("localInSubFunction", @localInSubFunction);
process.Continue(); // 3 - Go back to Function
WaitForPause();
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
ObjectDump("localInSubFunction", @localInSubFunction);
process.Continue(); // 4 - Go to the SubFunction
WaitForPause();
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
ObjectDump("localInSubFunction", @localInSubFunction);
localInSubFunction = process.SelectedStackFrame.LocalVariables["localInSubFunction"];
ObjectDump("localInSubFunction(new)", @localInSubFunction);
process.Continue(); // 5 - Setp out of both functions
WaitForPause();
ObjectDump("argument", argument);
ObjectDump("local", local);
ObjectDump("@class", @class);
ObjectDump("localInSubFunction", @localInSubFunction);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

20
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs

@ -22,3 +22,23 @@ namespace Debugger.Tests.TestPrograms @@ -22,3 +22,23 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test, NUnit.Framework.Ignore]
public void GenericDictionary()
{
StartTest("GenericDictionary");
WaitForPause();
ObjectDump("dict", process.SelectedStackFrame.LocalVariables["dict"]);
ObjectDump("dict members", process.SelectedStackFrame.LocalVariables["dict"].GetMemberValues(null, BindingFlags.All));
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

26
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Generics.cs

@ -82,4 +82,28 @@ namespace Debugger.Tests.TestPrograms @@ -82,4 +82,28 @@ namespace Debugger.Tests.TestPrograms
return default(T);
}
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void Generics()
{
StartTest("Generics");
for(int i = 0; i < 8; i++) {
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue();
}
WaitForPause();
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

15
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/HelloWorld.cs

@ -17,3 +17,18 @@ namespace Debugger.Tests.TestPrograms @@ -17,3 +17,18 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void HelloWorld()
{
StartTest("HelloWorld");
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

29
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.cs

@ -35,3 +35,32 @@ namespace Debugger.Tests.TestPrograms @@ -35,3 +35,32 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test, NUnit.Framework.Ignore]
public void ObjectValue()
{
Value val = null;
StartTest("ObjectValue");
WaitForPause();
val = process.SelectedStackFrame.LocalVariables["val"];
ObjectDump("val", val);
ObjectDump("val members", val.GetMemberValues(null, Debugger.BindingFlags.All));
//ObjectDump("typeof(val)", val.Type);
process.Continue();
WaitForPause();
ObjectDump("val", val);
ObjectDump("val members", val.GetMemberValues(null, Debugger.BindingFlags.All));
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

44
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/PropertyVariable.cs

@ -43,3 +43,47 @@ namespace Debugger.Tests.TestPrograms @@ -43,3 +43,47 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
/*
[NUnit.Framework.Test]
public void PropertyVariable()
{
StartProgram("PropertyVariable");
WaitForPause();
NamedValueCollection props = process.SelectedFunction.LocalVariables["var"].GetMembers(null, Debugger.BindingFlags.All);
Assert.AreEqual(typeof(UnavailableValue), props["PrivateProperty"].Value.GetType());
process.StartEvaluation();
WaitForPause();
Assert.AreEqual("private", props["PrivateProperty"].AsString);
Assert.AreEqual(typeof(UnavailableValue), props["PublicProperty"].Value.GetType());
process.StartEvaluation();
WaitForPause();
Assert.AreEqual("public", props["PublicProperty"].AsString);
Assert.AreEqual(typeof(UnavailableValue), props["ExceptionProperty"].Value.GetType());
process.StartEvaluation();
WaitForPause();
Assert.AreEqual(typeof(UnavailableValue), props["ExceptionProperty"].Value.GetType());
Assert.AreEqual(typeof(UnavailableValue), props["StaticProperty"].Value.GetType());
process.StartEvaluation();
WaitForPause();
Assert.AreEqual("static", props["StaticProperty"].AsString);
process.Continue();
WaitForPause(PausedReason.Break, null);
process.Continue();
process.WaitForPrecessExit();
CheckXmlOutput();
}
*/
}
}
#endif

43
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/PropertyVariableForm.cs

@ -20,3 +20,46 @@ namespace Debugger.Tests.TestPrograms @@ -20,3 +20,46 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
/*
[NUnit.Framework.Test]
public void PropertyVariableForm()
{
Variable local = null;
StartProgram("PropertyVariableForm");
WaitForPause();
foreach(Variable var in process.SelectedFunction.LocalVariables) {
local = var;
}
Assert.AreEqual("form", local.Name);
Assert.AreEqual(typeof(Variable), local.GetType());
foreach(Variable var in local.Value.SubVariables) {
Assert.AreEqual(typeof(UnavailableValue), var.Value.GetType(), "Variable name: " + var.Name);
process.StartEvaluation();
WaitForPause();
Assert.AreNotEqual(null, var.Value.AsString, "Variable name: " + var.Name);
}
process.Continue();
WaitForPause();
foreach(Variable var in local.Value.SubVariables) {
Assert.AreEqual(typeof(UnavailableValue), var.Value.GetType(), "Variable name: " + var.Name);
}
process.StartEvaluation();
WaitForPause();
process.Continue();
process.WaitForPrecessExit();
CheckXmlOutput();
}
*/
}
}
#endif

27
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/SetIP.cs

@ -18,3 +18,30 @@ namespace Debugger.Tests.TestPrograms @@ -18,3 +18,30 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
using NUnit.Framework;
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void SetIP()
{
StartTest("SetIP");
WaitForPause();
Assert.IsNotNull(process.SelectedStackFrame.CanSetIP("SetIP.cs", 16, 0));
Assert.IsNull(process.SelectedStackFrame.CanSetIP("SetIP.cs", 100, 0));
process.SelectedStackFrame.SetIP("SetIP.cs", 16, 0);
process.Continue();
WaitForPause();
Assert.AreEqual("1\r\n1\r\n", log);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

15
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/SimpleProgram.cs

@ -17,3 +17,18 @@ namespace Debugger.Tests.TestPrograms @@ -17,3 +17,18 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void SimpleProgram()
{
StartTest("SimpleProgram");
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

51
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Stepping.cs

@ -32,3 +32,54 @@ namespace Debugger.Tests.TestPrograms @@ -32,3 +32,54 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void Stepping()
{
StartTest("Stepping");
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOver(); // Debugger.Break
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOver(); // Debug.WriteLine 1
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepInto(); // Method Sub
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepInto(); // '{'
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepInto(); // Debug.WriteLine 2
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOut(); // Method Sub
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOver(); // Method Sub
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.StepOver(); // Method Sub2
WaitForPause();
ObjectDump("SelectedStackFrame", process.SelectedStackFrame);
process.Continue();
process.WaitForExit();
CheckXmlOutput();
}
}
}
#endif

9
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Symbols.cs

@ -17,3 +17,12 @@ namespace Debugger.Tests.TestPrograms @@ -17,3 +17,12 @@ namespace Debugger.Tests.TestPrograms
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
}
}
#endif

4
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ValueType.cs

@ -21,8 +21,10 @@ namespace Debugger.Tests @@ -21,8 +21,10 @@ namespace Debugger.Tests
System.Diagnostics.Debugger.Break();
}
}
}
#if TESTS
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
@ -38,5 +40,5 @@ namespace Debugger.Tests @@ -38,5 +40,5 @@ namespace Debugger.Tests
CheckXmlOutput();
}
}
#endif
}
#endif

4
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ValueType.xml

@ -30,9 +30,9 @@ @@ -30,9 +30,9 @@
<BaseAdress>4194304</BaseAdress>
<IsDynamic>False</IsDynamic>
<IsInMemory>False</IsInMemory>
<FullPath>C:\Documents and Settings\User\Local Settings\Temp\SharpDevelop\DebuggerTests\B0214D78938BD39D5579C5B2036C0B99\ValueType.exe</FullPath>
<FullPath>C:\Documents and Settings\User\Local Settings\Temp\SharpDevelop\DebuggerTests\82C64ECFB76E7B7EA7B81778E34530C7\ValueType.exe</FullPath>
<Filename>ValueType.exe</Filename>
<DirectoryName>C:\Documents and Settings\User\Local Settings\Temp\SharpDevelop\DebuggerTests\B0214D78938BD39D5579C5B2036C0B99</DirectoryName>
<DirectoryName>C:\Documents and Settings\User\Local Settings\Temp\SharpDevelop\DebuggerTests\82C64ECFB76E7B7EA7B81778E34530C7</DirectoryName>
<SymbolsLoaded>True</SymbolsLoaded>
<OrderOfLoading>1</OrderOfLoading>
</Module>

Loading…
Cancel
Save