Browse Source

Enable "CompilerGeneratedClasses" debugger test

newNRvisualizers
David Srbecký 13 years ago
parent
commit
0ef2ab3f76
  1. 1
      src/AddIns/Debugger/Debugger.Tests/Debugger.Tests.csproj
  2. 15
      src/AddIns/Debugger/Debugger.Tests/DebuggerTests.cs
  3. 6
      src/AddIns/Debugger/Debugger.Tests/DebuggerTestsBase.cs
  4. 23
      src/AddIns/Debugger/Debugger.Tests/Tests/DebugType_CompilerGeneratedClasses.cs
  5. 5
      src/AddIns/Debugger/Debugger.Tests/Tests/ExpressionEvaluatorVisitor_Tests.cs

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

@ -45,7 +45,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DebuggerTests.cs" />
<Compile Include="DebuggerTestsBase.cs" /> <Compile Include="DebuggerTestsBase.cs" />
<Compile Include="Tests\AppDomain_Tests.cs" /> <Compile Include="Tests\AppDomain_Tests.cs" />
<Compile Include="Tests\ControlFlow_NoBreak.cs" /> <Compile Include="Tests\ControlFlow_NoBreak.cs" />

15
src/AddIns/Debugger/Debugger.Tests/DebuggerTests.cs

@ -1,15 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using NUnit.Framework;
using NIgnore = NUnit.Framework.IgnoreAttribute;
namespace Debugger.Tests
{
[TestFixture]
public partial class DebuggerTests: DebuggerTestsBase
{
}
}

6
src/AddIns/Debugger/Debugger.Tests/DebuggerTestsBase.cs

@ -18,6 +18,12 @@ using NUnit.Framework;
namespace Debugger.Tests namespace Debugger.Tests
{ {
[TestFixture]
public partial class DebuggerTests: DebuggerTestsBase
{
}
public class DebuggerTestsBase public class DebuggerTestsBase
{ {
string expetedOutputEnvVar = "SD_TESTS_DEBUGGER_XML_OUT"; string expetedOutputEnvVar = "SD_TESTS_DEBUGGER_XML_OUT";

23
src/AddIns/Debugger/Debugger.Tests/Tests/DebugType_CompilerGeneratedClasses.cs

@ -65,7 +65,7 @@ namespace Debugger.Tests {
public partial class DebuggerTests public partial class DebuggerTests
{ {
[NUnit.Framework.Test, NUnit.Framework.Ignore("TODO: Compiler generated classes are missing from the metadata")] [NUnit.Framework.Test]
public void DebugType_CompilerGeneratedClasses() public void DebugType_CompilerGeneratedClasses()
{ {
StartTest(); StartTest();
@ -74,9 +74,13 @@ namespace Debugger.Tests {
DumpLocalVariables("OutterDelegateLocalVariables"); DumpLocalVariables("OutterDelegateLocalVariables");
process.Continue(); process.Continue();
DumpLocalVariables("InnterDelegateLocalVariables"); DumpLocalVariables("InnterDelegateLocalVariables");
Evaluate(CurrentStackFrame, EvalThread, "nestedDelegArg", GetResource("DebugType_CompilerGeneratedClasses.cs"));
Evaluate(CurrentStackFrame, EvalThread, "instanceField", GetResource("DebugType_CompilerGeneratedClasses.cs")); evalContext = GetResource("DebugType_CompilerGeneratedClasses.cs");
Evaluate(CurrentStackFrame, EvalThread, "staticField", GetResource("DebugType_CompilerGeneratedClasses.cs"));
AssertEval("nestedDelegArg", "402");
AssertEval("instanceField", "\"instance field value\"");
AssertEval("staticField", "\"static field value\"");
EndTest(); EndTest();
} }
} }
@ -141,6 +145,12 @@ namespace Debugger.Tests {
Type="System.Int32" Type="System.Int32"
Value="103" /> Value="103" />
</Item> </Item>
<Item>
<LocalVariable
Name="this"
Type="Debugger.Tests.DebugType_CompilerGeneratedClasses"
Value="{Debugger.Tests.DebugType_CompilerGeneratedClasses}" />
</Item>
</YieldLocalVariables> </YieldLocalVariables>
<Paused>DebugType_CompilerGeneratedClasses.cs:53,6-53,42</Paused> <Paused>DebugType_CompilerGeneratedClasses.cs:53,6-53,42</Paused>
<OutterDelegateLocalVariables> <OutterDelegateLocalVariables>
@ -154,7 +164,7 @@ namespace Debugger.Tests {
<LocalVariable <LocalVariable
Name="nestedDeleg" Name="nestedDeleg"
Type="Debugger.Tests.DebugType_CompilerGeneratedClasses+IntDelegate" Type="Debugger.Tests.DebugType_CompilerGeneratedClasses+IntDelegate"
Value="{Debugger.Tests.DebugType_CompilerGeneratedClasses+IntDelegate}" /> Value="{Debugger.Tests.DebugType_CompilerGeneratedClasses.IntDelegate}" />
</Item> </Item>
<Item> <Item>
<LocalVariable <LocalVariable
@ -250,9 +260,6 @@ namespace Debugger.Tests {
Value="{Debugger.Tests.DebugType_CompilerGeneratedClasses}" /> Value="{Debugger.Tests.DebugType_CompilerGeneratedClasses}" />
</Item> </Item>
</InnterDelegateLocalVariables> </InnterDelegateLocalVariables>
<Eval> nestedDelegArg = 402 </Eval>
<Eval> instanceField = "instance field value" </Eval>
<Eval> staticField = "static field value" </Eval>
<Exited /> <Exited />
</Test> </Test>
</DebuggerTests> </DebuggerTests>

5
src/AddIns/Debugger/Debugger.Tests/Tests/ExpressionEvaluatorVisitor_Tests.cs

@ -291,6 +291,8 @@ namespace Debugger.Tests
{ {
StartTest(); StartTest();
evalContext = GetResource("ExpressionEvaluatorVisitor_Tests.cs");
AssertEval("i", "4"); AssertEval("i", "4");
AssertEval("pi", "3.14f"); AssertEval("pi", "3.14f");
AssertEval("hi", "\"hi\""); AssertEval("hi", "\"hi\"");
@ -312,10 +314,11 @@ namespace Debugger.Tests
EndTest(false); EndTest(false);
} }
string evalContext;
void AssertEval(string expression, string expected) void AssertEval(string expression, string expected)
{ {
NUnit.Framework.Assert.AreEqual(expected, ExpressionEvaluationVisitor.FormatValue(EvalThread, Evaluate(CurrentStackFrame, EvalThread, expression, GetResource("ExpressionEvaluatorVisitor_Tests.cs")))); NUnit.Framework.Assert.AreEqual(expected, ExpressionEvaluationVisitor.FormatValue(EvalThread, Evaluate(CurrentStackFrame, EvalThread, expression, evalContext)));
} }
static ResolveResult ResolveSnippet(string fileName, TextLocation location, string contextCode, string codeSnippet, ICompilation compilation) static ResolveResult ResolveSnippet(string fileName, TextLocation location, string contextCode, string codeSnippet, ICompilation compilation)

Loading…
Cancel
Save