diff options
author | Mikayla Hutchinson <m.j.hutchinson@gmail.com> | 2017-03-18 01:36:33 +0300 |
---|---|---|
committer | Mikayla Hutchinson <m.j.hutchinson@gmail.com> | 2017-03-18 01:36:33 +0300 |
commit | f84a4368b156875300e7a3206e73a28e2436033c (patch) | |
tree | 2355731ce6ad49f58a7ebc7f287d5a34518e526d /main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests | |
parent | 191a296fa05886f8286a9123a14913b6a53a99c6 (diff) | |
parent | e316531c1336cd290aa32b0cf06146535fff68ea (diff) |
Merge remote-tracking branch 'origin/master' into roslyn-ivt
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests')
14 files changed, 220 insertions, 4686 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/AdvancedEvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/AdvancedEvaluationTests.cs deleted file mode 100644 index 8266af66c9..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/AdvancedEvaluationTests.cs +++ /dev/null @@ -1,204 +0,0 @@ -//
-// AdvancedEvaluationTests.cs
-//
-// Author:
-// David Karlaš <david.karlas@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using NUnit.Framework;
-
-namespace MonoDevelop.Debugger.Tests
-{
- namespace Soft
- {
- [TestFixture]
- public class SdbAdvancedEvaluationAllowTargetInvokesTests : AdvancedEvaluationTests
- {
- public SdbAdvancedEvaluationAllowTargetInvokesTests () : base ("Mono.Debugger.Soft", true)
- {
- }
- }
-
- [TestFixture]
- public class SdbAdvancedEvaluationNoTargetInvokesTests : AdvancedEvaluationTests
- {
- public SdbAdvancedEvaluationNoTargetInvokesTests () : base ("Mono.Debugger.Soft", false)
- {
- }
- }
- }
-
- namespace Win32
- {
- [TestFixture]
- [Platform(Include = "Win")]
- public class CorAdvancedEvaluationAllowTargetInvokesTests : AdvancedEvaluationTests
- {
- public CorAdvancedEvaluationAllowTargetInvokesTests () : base ("MonoDevelop.Debugger.Win32", true)
- {
- }
- }
-
- [TestFixture]
- [Platform(Include = "Win")]
- public class CorAdvancedEvaluationNoTargetInvokesTests : AdvancedEvaluationTests
- {
- public CorAdvancedEvaluationNoTargetInvokesTests () : base ("MonoDevelop.Debugger.Win32", false)
- {
- }
- }
- }
-
- [TestFixture]
- public abstract class AdvancedEvaluationTests : DebugTests
- {
- protected AdvancedEvaluationTests (string de, bool allowTargetInvokes) : base (de)
- {
- AllowTargetInvokes = allowTargetInvokes;
- }
-
- [TestFixtureSetUp]
- public override void SetUp ()
- {
- base.SetUp ();
- Start ("AdvancedEvaluation");
- }
-
- [Test]
- public void Bug24998 ()
- {
- InitializeTest ();
- AddBreakpoint ("cc622137-a162-4b91-a85c-88241e68c3ea");
- StartTest ("Bug24998Test");
- CheckPosition ("cc622137-a162-4b91-a85c-88241e68c3ea");
- var val = Eval ("someField");
- Assert.AreEqual ("\"das\"", val.Value);
- Assert.AreEqual ("string", val.TypeName);
-
- val = Eval ("someVariable");
- Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
- var children = val.GetAllChildrenSync ();
- Assert.AreEqual (2, children.Length);
- Assert.AreEqual ("[0]", children [0].ChildSelector);
- Assert.AreEqual ("1", children [0].Value);
- Assert.AreEqual ("int", children [0].TypeName);
-
- val = Eval ("action");
- Assert.AreEqual ("System.Action", val.TypeName);
- }
-
-
- [Test]
- public void YieldMethodTest ()
- {
- InitializeTest ();
- AddBreakpoint ("0b1212f8-9035-43dc-bf01-73efd078d680");
- StartTest ("YieldMethodTest");
- CheckPosition ("0b1212f8-9035-43dc-bf01-73efd078d680");
-
- var val = Eval ("someVariable");
- Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
- Assert.AreEqual (1, val.GetAllChildrenSync ().Length);
-
- AddBreakpoint ("e96b28bb-59bf-445d-b71f-316726ba4c52");
- Continue ("e96b28bb-59bf-445d-b71f-316726ba4c52");
-
- val = Eval ("someField");
- Assert.AreEqual ("\"das1\"", val.Value);
- Assert.AreEqual ("string", val.TypeName);
- val = Eval ("someVariable");
- Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
- Assert.AreEqual (2, val.GetAllChildrenSync ().Length);
-
- AddBreakpoint ("760feb92-176a-43d7-b5c9-116c4a3c6a6c");
- Continue ("760feb92-176a-43d7-b5c9-116c4a3c6a6c");
-
- val = Eval ("someField");
- Assert.AreEqual ("\"das2\"", val.Value);
- Assert.AreEqual ("string", val.TypeName);
- val = Eval ("someVariable");
- Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
- Assert.AreEqual (3, val.GetAllChildrenSync ().Length);
-
- AddBreakpoint ("a9a9aa9d-6b8b-4724-9741-2a3e1fb435e8");
- Continue ("a9a9aa9d-6b8b-4724-9741-2a3e1fb435e8");
-
- val = Eval ("someField");
- Assert.AreEqual ("\"das2\"", val.Value);
- Assert.AreEqual ("string", val.TypeName);
- val = Eval ("someVariable");
- Assert.AreEqual ("System.Collections.ArrayList", val.TypeName);
- Assert.AreEqual (3, val.GetAllChildrenSync ().Length);
-
- }
-
- [Test]
- public void InvocationsCountDuringExpandingTest ()
- {
- InitializeTest ();
- AddBreakpoint ("8865cace-6b57-42cc-ad55-68a2c12dd3d7");
- StartTest ("InvocationsCountDuringExpandingTest");
- CheckPosition ("8865cace-6b57-42cc-ad55-68a2c12dd3d7");
- var options = Session.EvaluationOptions.Clone ();
- options.GroupPrivateMembers = false; // to access private fields (else there are in Private subgroup)
- var value = Eval ("mutableFieldClass");
- var sharedX = value.GetChildSync ("sharedX", options);
- Assert.NotNull (sharedX);
-
- var prop1 = value.GetChildSync("Prop1", options);
- Assert.NotNull (prop1);
- Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.AdvancedEvaluation.MutableField", prop1.TypeName);
- var prop1X = prop1.GetChildSync ("x", options);
- Assert.NotNull (prop1X);
- Assert.AreEqual ("0", prop1X.Value); // before CorValRef optimization this field evaluated to 2,
- // because every value to the root object was recalculated - this was wrong behavior
-
- var prop2 = value.GetChildSync ("Prop2", options);
- Assert.NotNull (prop2);
- var prop2X = prop2.GetChildSync("x", options);
- Assert.NotNull (prop2X);
- Assert.AreEqual ("1", prop2X.Value);
-
- Assert.AreEqual ("2", sharedX.Value);
- }
-
- [Test]
- public void MethodWithTypeGenericArgsEval ()
- {
- InitializeTest ();
- AddBreakpoint ("ba6350e5-7149-4cc2-a4cf-8a54c635eb38");
- StartTest ("MethodWithTypeGenericArgsEval");
- CheckPosition ("ba6350e5-7149-4cc2-a4cf-8a54c635eb38");
-
- var baseMethodEval = Eval ("genericClass.BaseMethodWithClassTArg (wrappedA)");
- Assert.NotNull (baseMethodEval);
- Assert.AreEqual ("{Wrapper(wrappedA)}", baseMethodEval.Value);
-
- var thisMethodEval = Eval ("genericClass.RetMethodWithClassTArg (a)");
- Assert.NotNull (thisMethodEval);
- Assert.AreEqual ("{Just A}", thisMethodEval.Value);
- }
-
-
- }
-}
-
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs deleted file mode 100644 index a1d16e178a..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs +++ /dev/null @@ -1,1157 +0,0 @@ -//
-// BreakpointsAndSteppingTests.cs
-//
-// Author:
-// David Karlaš <david.karlas@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using NUnit.Framework;
-using Mono.Debugging.Client;
-using System.Collections.Generic;
-using Mono.Debugging.Soft;
-
-namespace MonoDevelop.Debugger.Tests
-{
- [TestFixture]
- public abstract class BreakpointsAndSteppingTests:DebugTests
- {
- protected BreakpointsAndSteppingTests (string de)
- : base (de)
- {
- }
-
- [TestFixtureSetUp]
- public override void SetUp ()
- {
- base.SetUp ();
- Start ("BreakpointsAndStepping");
- }
-
- [Test]
- public void OneLineProperty ()
- {
- InitializeTest ();
- AddBreakpoint ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
- StartTest ("OneLineProperty");
- CheckPosition ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
- StepIn ("3722cad3-7da1-4c86-a398-bb2cf6cc65a9", "{");
- StepIn ("3722cad3-7da1-4c86-a398-bb2cf6cc65a9", "return");
- StepIn ("3722cad3-7da1-4c86-a398-bb2cf6cc65a9", "}");
- StepIn ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
- StepIn ("36c0a44a-44ac-4676-b99b-9a58b73bae9d");
- }
-
- /// <summary>
- /// Bug 775
- /// </summary>
- [Test]
- public void StepOverPropertiesAndOperatorsSetting ()
- {
- InitializeTest ();
- //This is default but lets set again for code readability
- Session.Options.StepOverPropertiesAndOperators = false;
- AddBreakpoint ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
- StartTest ("OneLineProperty");
- CheckPosition ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
- StepIn ("3722cad3-7da1-4c86-a398-bb2cf6cc65a9");
-
-
- InitializeTest ();
- Session.Options.StepOverPropertiesAndOperators = true;
- AddBreakpoint ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
- StartTest ("OneLineProperty");
- CheckPosition ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
- StepIn ("36c0a44a-44ac-4676-b99b-9a58b73bae9d");
-
-
- InitializeTest ();
- //This is default but lets set again for code readability
- Session.Options.StepOverPropertiesAndOperators = false;
- AddBreakpoint ("6049ea77-e04a-43ba-907a-5d198727c448");
- StartTest ("TestOperators");
- CheckPosition ("6049ea77-e04a-43ba-907a-5d198727c448");
- StepIn ("5a3eb8d5-88f5-49c0-913f-65018e5a1c5c");
-
-
- InitializeTest ();
- Session.Options.StepOverPropertiesAndOperators = true;
- AddBreakpoint ("6049ea77-e04a-43ba-907a-5d198727c448");
- StartTest ("TestOperators");
- CheckPosition ("6049ea77-e04a-43ba-907a-5d198727c448");
- StepIn ("49737db6-e62b-4c5e-8758-1a9d655be11a");
- }
-
- [Test]
- public void StaticConstructorStepping ()
- {
- InitializeTest ();
- AddBreakpoint ("6c42f31b-ca4f-4963-bca1-7d7c163087f1");
- StartTest ("StaticConstructorStepping");
- CheckPosition ("6c42f31b-ca4f-4963-bca1-7d7c163087f1");
- StepOver ("7e6862cd-bf31-486c-94fe-19933ae46094");
- }
-
- [Test]
- public void SteppingInsidePropertyWhenStepInPropertyDisabled ()
- {
- InitializeTest ();
- Session.Options.StepOverPropertiesAndOperators = true;
- AddBreakpoint ("e0082b9a-26d7-4279-8749-31cd13866abf");
- StartTest ("SteppingInsidePropertyWhenStepInPropertyDisabled");
- CheckPosition ("e0082b9a-26d7-4279-8749-31cd13866abf");
- StepIn ("04f1ce38-121a-4ce7-b4ba-14fb3f6184a2");
- }
-
- [Test]
- public void CheckIfNull ()
- {
- InitializeTest ();
- AddBreakpoint ("d42a19ec-98db-4166-a3b4-fc102ebd7905");
- StartTest ("CheckIfNull");
- CheckPosition ("d42a19ec-98db-4166-a3b4-fc102ebd7905");
- StepIn ("c5361deb-aff5-468f-9293-0d2e50fc62fd");
- StepIn ("10e0f5c7-4c77-4897-8324-deef9aae0192");
- StepIn ("40f0acc2-2de2-44c8-8e18-3867151ba8da");
- StepIn ("3c0316e9-eace-48e8-b9ed-03a8c6306c66", 1);
- StepIn ("d42a19ec-98db-4166-a3b4-fc102ebd7905");
- StepIn ("f633d197-cb92-418a-860c-4d8eadbe2342");
- StepIn ("c5361deb-aff5-468f-9293-0d2e50fc62fd");
- StepIn ("10e0f5c7-4c77-4897-8324-deef9aae0192");
- StepIn ("ae71a41d-0c90-433d-b925-0b236b8119a9");
- StepIn ("3c0316e9-eace-48e8-b9ed-03a8c6306c66", 1);
- StepIn ("f633d197-cb92-418a-860c-4d8eadbe2342");
- StepIn ("6d50c480-1cd1-49a9-9758-05f65c07c037");
- }
-
- /// <summary>
- /// Bug 4015
- /// </summary>
- [Test]
- public void SimpleConstrutor ()
- {
- InitializeTest ();
- AddBreakpoint ("d62ff7ab-02fa-4205-a432-b4569709eab6");
- StartTest ("SimpleConstrutor");
- CheckPosition ("d62ff7ab-02fa-4205-a432-b4569709eab6");
- StepIn ("1f37aea1-77a1-40c1-9ea5-797db48a14f9", 1, "public");
- StepIn ("494fddfb-85f1-4ad0-b5b3-9b2f990bb6d0", -1, "{");
- StepIn ("494fddfb-85f1-4ad0-b5b3-9b2f990bb6d0", "int");
- StepIn ("494fddfb-85f1-4ad0-b5b3-9b2f990bb6d0", 1, "}");
- StepIn ("d62ff7ab-02fa-4205-a432-b4569709eab6", "var");
- StepIn ("d62ff7ab-02fa-4205-a432-b4569709eab6", 1, "}");
- }
-
- /// <summary>
- /// Bug 3262
- /// </summary>
- [Test]
- public void NoConstructor ()
- {
- InitializeTest ();
- Session.Options.ProjectAssembliesOnly = true;
- AddBreakpoint ("84fc04b2-ede2-4d8b-acc4-28441e1c5f55");
- StartTest ("NoConstructor");
- CheckPosition ("84fc04b2-ede2-4d8b-acc4-28441e1c5f55");
- StepIn ("84fc04b2-ede2-4d8b-acc4-28441e1c5f55", 1);
- }
-
- [Test]
- public void IfPropertyStepping ()
- {
- InitializeTest ();
- Session.Options.StepOverPropertiesAndOperators = true;
- AddBreakpoint ("0c64d51c-40b3-4d20-b7e3-4e3e641ec52a");
- StartTest ("IfPropertyStepping");
- CheckPosition ("0c64d51c-40b3-4d20-b7e3-4e3e641ec52a");
- StepIn ("ac7625ef-ebbd-4543-b7ff-c9c5d26fd8b4");
- }
-
- /// <summary>
- /// Bug 3565
- /// </summary>
- [Test]
- public void DebuggerHiddenMethod ()
- {
- InitializeTest ();
- AddBreakpoint ("b0abae8d-fbd0-4bde-b586-bb511b954d8a");
- StartTest ("DebuggerHiddenMethod");
- CheckPosition ("b0abae8d-fbd0-4bde-b586-bb511b954d8a");
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a");
- StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (4).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (5).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (4).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (3).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a", 1);
- StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a", 2);
- StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a", 3);
- }
-
- /// <summary>
- /// Bug 3565
- /// </summary>
- [Test]
- public void DebuggerNonUserCodeMethod ()
- {
- InitializeTest ();
- Session.Options.ProjectAssembliesOnly = false;
- AddBreakpoint ("02757896-0e76-40b8-8235-d09d2110da78");
- StartTest ("DebuggerNonUserCodeMethod");
- CheckPosition ("02757896-0e76-40b8-8235-d09d2110da78");
- //entering testClass.DebuggerNonUserCodeMethod (true);
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- //entering EmptyTestMethod
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- //exited EmptyTestMethod
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78");
- //exited testClass.DebuggerNonUserCodeMethod (true);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1);
- //entering testClass.DebuggerNonUserCodeMethod (true, 3); starts here
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -2);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
- //entering resursion
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -2);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
- //entering resursion
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -2);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- //entering EmptyTestMethod
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- //exited EmptyTestMethod
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
- //returning resursion
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 2);
-
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- //entering EmptyTestMethod
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- //exited EmptyTestMethod
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
- //returning resursion
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 2);
-
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- //entering EmptyTestMethod
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- //exited EmptyTestMethod
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
- //returning resursion
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 1);
- StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 2);
-
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- //entering EmptyTestMethod
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- //exited EmptyTestMethod
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1);
- //exited testClass.DebuggerNonUserCodeMethod (true, 3);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 2);
- //entering testClass.DebuggerNonUserCodeMethod (false);
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
- StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
- StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 2);
- //exited testClass.DebuggerNonUserCodeMethod (false);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 3);
-
- InitializeTest ();
- Session.Options.ProjectAssembliesOnly = true;
- AddBreakpoint ("02757896-0e76-40b8-8235-d09d2110da78");
- StartTest ("DebuggerNonUserCodeMethod");
- CheckPosition ("02757896-0e76-40b8-8235-d09d2110da78");
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78");
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (4).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (5).IsExternalCode);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (4).IsExternalCode);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 2);
- StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 3);
- }
-
- /// <summary>
- /// Bug 3565
- /// </summary>
- [Test]
- public void DebuggerStepperBoundaryMethod ()
- {
- InitializeTest ();
- AddBreakpoint ("0b7eef17-af79-4b34-b4fc-cede110f20fe");
- AddBreakpoint ("806c13f8-8a59-4ae0-83a2-33191368af47");
- StartTest ("DebuggerStepperBoundaryMethod");
- CheckPosition ("0b7eef17-af79-4b34-b4fc-cede110f20fe");
- StepIn ("806c13f8-8a59-4ae0-83a2-33191368af47");//This actually means it hit 2nd breakpoint
- //because [DebuggerStepperBoundary] actually means if you step into this method
- //its looks like pressing F5
- }
-
- /// <summary>
- /// Bug 21510
- /// </summary>
- [Test]
- public void DebuggerStepperBoundaryMethod2ProjectAssembliesOnly ()
- {
- IgnoreSoftDebugger ("Fix me");
- //SDB Ignore: DebuggerStepperBoundary is stupid and pretty much uselss attribute anyway
- //Problem that we have here is that DebuggerStepperBoundary is handled on IDE side
- //and if method that has DebuggerStepperBoundary also has DebuggerNonUserCode IDE
- //is never notified about entering such method since runtime handles DebuggerNonUserCode
- //hence bug
- InitializeTest ();
- Session.Options.ProjectAssembliesOnly = true;
- AddBreakpoint ("f3a22b38-596a-4463-a562-20b342fdec12");
- AddBreakpoint ("4721f27a-a268-4529-b327-c39f208c08c5");
- StartTest ("DebuggerStepperBoundaryMethod2");
- CheckPosition ("f3a22b38-596a-4463-a562-20b342fdec12");
- StepIn ("4721f27a-a268-4529-b327-c39f208c08c5");
- }
-
- /// <summary>
- /// Bug 21510
- /// </summary>
- [Test]
- public void DebuggerStepperBoundaryMethod2 ()
- {
- InitializeTest ();
- Session.Options.ProjectAssembliesOnly = false;
- AddBreakpoint ("f3a22b38-596a-4463-a562-20b342fdec12");
- AddBreakpoint ("4721f27a-a268-4529-b327-c39f208c08c5");
- StartTest ("DebuggerStepperBoundaryMethod2");
- CheckPosition ("f3a22b38-596a-4463-a562-20b342fdec12");
- StepIn ("d110546f-a622-4ec3-9564-1c51bfec28f9", -1);
- StepIn ("d110546f-a622-4ec3-9564-1c51bfec28f9");
- StepIn ("4721f27a-a268-4529-b327-c39f208c08c5");
- }
-
- /// <summary>
- /// Bug 3565
- /// </summary>
- [Test]
- public void DebuggerStepThroughMethod ()
- {
- InitializeTest ();
- AddBreakpoint ("707ccd6c-3464-4700-8487-a83c948aa0c3");
- StartTest ("DebuggerStepThroughMethod");
- CheckPosition ("707ccd6c-3464-4700-8487-a83c948aa0c3");
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3");
- StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
- StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
- StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3", 1);
- StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3", 2);
- StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3", 3);
- }
-
- /// <summary>
- /// This test is very specific because of Win32 debugger bug
- /// Placing breakpoint inside delegate fails if some other
- /// breakpoint adding failed before this(invalidBreakpointAtEndOfFile)
- /// </summary>
- [Test]
- public void BreakpointInsideDelegate ()
- {
- InitializeTest ();
- AddBreakpoint ("f3b6862d-732b-4f68-81f5-f362d5a092e2");
- StartTest ("BreakpointInsideDelegate");
- CheckPosition ("f3b6862d-732b-4f68-81f5-f362d5a092e2");
- AddBreakpoint ("invalidBreakpointAtEndOfFile");
- AddBreakpoint ("ffde3c82-4310-43d3-93d1-4c39e9cf615e");
- Continue ("ffde3c82-4310-43d3-93d1-4c39e9cf615e");
- }
-
- [Test]
- public void BreakpointInsideOneLineDelegateNoDisplayClass ()
- {
- InitializeTest ();
- AddBreakpoint ("e0a96c37-577f-43e3-9a20-2cdd8bf7824e");
- AddBreakpoint ("e72a2fa6-2d95-4f96-b3d0-ba321da3cb55", statement: "Console.WriteLine");
- StartTest ("BreakpointInsideOneLineDelegateNoDisplayClass");
- CheckPosition ("e0a96c37-577f-43e3-9a20-2cdd8bf7824e");
- StepOver ("e72a2fa6-2d95-4f96-b3d0-ba321da3cb55", "Console.WriteLine");
- StepOut ("3be64647-76c1-455b-a4a7-a21b37383dcb");
- StepOut ("e0a96c37-577f-43e3-9a20-2cdd8bf7824e");
- }
-
- [Test]
- public void BreakpointInsideOneLineDelegate ()
- {
- InitializeTest ();
- AddBreakpoint ("67ae4cce-22b3-49d8-8221-7e5b26a5e79b");
- AddBreakpoint ("22af08d6-dafc-47f1-b8d1-bee1526840fd", statement: "button.SetTitle");
- StartTest ("BreakpointInsideOneLineDelegate");
- CheckPosition ("67ae4cce-22b3-49d8-8221-7e5b26a5e79b");
- StepOver ("22af08d6-dafc-47f1-b8d1-bee1526840fd", "button.SetTitle");
- StepOut ("3be64647-76c1-455b-a4a7-a21b37383dcb");
- StepOut ("67ae4cce-22b3-49d8-8221-7e5b26a5e79b");
- }
-
- [Test]
- public void BreakpointInsideOneLineDelegateAsync ()
- {
- InitializeTest ();
- AddBreakpoint ("b6a65e9e-5db2-4850-969a-b3747b2459af", statement: "button.SetTitle");
- AddBreakpoint ("b6a65e9e-5db2-4850-969a-b3747b2459af", 1);
- StartTest ("BreakpointInsideOneLineDelegateAsync");
- CheckPosition ("b6a65e9e-5db2-4850-969a-b3747b2459af", 1);
- StepOver ("b6a65e9e-5db2-4850-969a-b3747b2459af", "button.SetTitle");
- if (Session is SoftDebuggerSession) {
- StepOut ("3be64647-76c1-455b-a4a7-a21b37383dcb");
- } else {
- StepOut ("3be64647-76c1-455b-a4a7-a21b37383dcb", 1);//Feels like CorDebugger bug
- }
- StepOut ("b6a65e9e-5db2-4850-969a-b3747b2459af", 1);
- }
-
- /// <summary>
- /// Bug 2851
- /// </summary>
- [Test]
- public void ForeachEnumerable ()
- {
- IgnoreSoftDebugger ("Sdb has some problems when stepping into yeild methods. Have to investigate");
-
- InitializeTest ();
- AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74");
- StartTest ("ForeachEnumerable");
- CheckPosition ("b73bec88-2c43-4157-8574-ad517730bc74");
- StepOver ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "foreach");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "testClass.Iter_1");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- StepIn ("1463a77d-f27e-4bcd-8f92-89a682faa1c7", -1, "{");
- StepIn ("1463a77d-f27e-4bcd-8f92-89a682faa1c7", "yield return 1;");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
- StepIn ("69dba3ab-0941-47e9-99fa-10222a2e894d", -1, "{");
- StepIn ("69dba3ab-0941-47e9-99fa-10222a2e894d", 1, "}");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- StepIn ("1463a77d-f27e-4bcd-8f92-89a682faa1c7", 1, "yield return 2;");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
- StepIn ("69dba3ab-0941-47e9-99fa-10222a2e894d", -1, "{");
- StepIn ("69dba3ab-0941-47e9-99fa-10222a2e894d", 1, "}");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- StepIn ("1463a77d-f27e-4bcd-8f92-89a682faa1c7", 2, "}");
- StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- StepIn ("e01a5428-b067-4ca3-ac8c-a19d5d800228", 1, "}");
- }
-
- [Test]
- public void SetBreakpointOnColumn ()
- {
- InitializeTest ();
- AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "testClass.Iter_1");
- AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
- AddBreakpoint ("e01a5428-b067-4ca3-ac8c-a19d5d800228", 1);//end of method
- StartTest ("ForeachEnumerable");
- CheckPosition ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "testClass.Iter_1");
- Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
- Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
- Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- Continue ("e01a5428-b067-4ca3-ac8c-a19d5d800228", 1);//end of method
- }
-
- [Test]
- public void RunToCursorTest ()
- {
- InitializeTest ();
- AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74");
- StartTest ("ForeachEnumerable");
- CheckPosition ("b73bec88-2c43-4157-8574-ad517730bc74");
- RunToCursor ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "testClass.Iter_1");
- RunToCursor ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
- RunToCursor ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
- RunToCursor ("69dba3ab-0941-47e9-99fa-10222a2e894d", 1, "}");
- RunToCursor ("e01a5428-b067-4ca3-ac8c-a19d5d800228", 1);
- }
-
- [Test]
- public void RunToCursorTest2 ()
- {
- InitializeTest ();
- AddBreakpoint ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
- StartTest ("SimpleMethod");
- CheckPosition ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
- RunToCursor ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 3);
- }
-
- /// <summary>
- /// Bug 4032
- /// </summary>
- [Test]
- public void PListSchemeTest ()
- {
- IgnoreSoftDebugger ("Sdb is reapeating StepIn in StaticConstructor instead of StepOut. Resulting in step stopping at unexpected location.");
-
- InitializeTest ();
- AddBreakpoint ("41eb3a30-3b19-4ea5-a7dc-e4c76871f391");
- StartTest ("PListSchemeTest");
- CheckPosition ("41eb3a30-3b19-4ea5-a7dc-e4c76871f391");
- StepIn ("c9b18785-1348-42e3-a479-9cac1e7c5360", -1);
- }
-
- /// <summary>
- /// Bug 4433 StepOverPropertiesAndOperators = true
- /// </summary>
- [Test]
- public void Bug4433StepOverProperties ()
- {
- InitializeTest ();
- Session.Options.StepOverPropertiesAndOperators = true;
- AddBreakpoint ("a062e69c-e3f7-4fd7-8985-fc7abd5c27d2");
- StartTest ("Bug4433Test");
- CheckPosition ("a062e69c-e3f7-4fd7-8985-fc7abd5c27d2");
- StepIn ("ad9b8803-eef0-438c-bf2b-9156782f4027", -1);
- }
-
- /// <summary>
- /// Bug 4433 StepOverPropertiesAndOperators = false
- /// </summary>
- [Test]
- public void Bug4433 ()
- {
- InitializeTest ();
- Session.Options.StepOverPropertiesAndOperators = false;
- AddBreakpoint ("a062e69c-e3f7-4fd7-8985-fc7abd5c27d2");
- StartTest ("Bug4433Test");
- CheckPosition ("a062e69c-e3f7-4fd7-8985-fc7abd5c27d2");
- StepIn ("ad9b8803-eef0-438c-bf2b-9156782f4027", -1);
- }
-
- /// <summary>
- /// Bug 5386
- /// </summary>
- [Test]
- public void EmptyForLoopTest ()
- {
- InitializeTest ();
- AddBreakpoint ("946d5781-a162-4cd9-a7b6-c320564cc594", -1);
- StartTest ("EmptyForLoopTest");
- CheckPosition ("946d5781-a162-4cd9-a7b6-c320564cc594", -1);
- //make 3 loops...
- StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", -1);
- StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", 1);
- StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", -1);
- StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", 1);
- StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", -1);
- StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", 1);
- }
-
- /// <summary>
- /// Bug 6724
- /// </summary>
- [Test]
- public void CallMethodWithPropertyAsArgument ()
- {
- InitializeTest ();
- Session.Options.StepOverPropertiesAndOperators = true;
- AddBreakpoint ("1c3e65ca-3201-42ba-9c6e-6f9a45ddac44");
- StartTest ("CallMethodWithPropertyAsArgument");
- CheckPosition ("1c3e65ca-3201-42ba-9c6e-6f9a45ddac44");
- StepIn ("c25be44e-ead3-4891-ab42-0e4cf8450f7a", -1);
- StepOut ("1c3e65ca-3201-42ba-9c6e-6f9a45ddac44");
- StepIn ("1c3e65ca-3201-42ba-9c6e-6f9a45ddac44", 1);
- StepIn ("c25be44e-ead3-4891-ab42-0e4cf8450f7a", -1);
- }
-
- /// <summary>
- /// Bug 7901
- /// </summary>
- [Test]
- public void Bug7901 ()
- {
- InitializeTest ();
- AddBreakpoint ("956bd9fd-39fe-4587-9d9e-a2a817d76286");
- StartTest ("TestBug7901");
- CheckPosition ("956bd9fd-39fe-4587-9d9e-a2a817d76286");
- StepIn ("f456a9b0-9c1a-4b34-bef4-d80b8541ebdb", -1);
- StepIn ("f456a9b0-9c1a-4b34-bef4-d80b8541ebdb", 1);
- StepIn ("11259de1-944d-4052-b970-62662e21876a", -1);
- StepIn ("11259de1-944d-4052-b970-62662e21876a");
- StepIn ("11259de1-944d-4052-b970-62662e21876a", 1);
- StepIn ("11259de1-944d-4052-b970-62662e21876a", 2);
- StepIn ("4863ebb7-8c90-4704-af8b-66a9f53657b9");
- StepOut ("956bd9fd-39fe-4587-9d9e-a2a817d76286");
- }
-
- /// <summary>
- /// Bug 10782
- /// </summary>
- [Test]
- public void Bug10782 ()
- {
- InitializeTest ();
- AddBreakpoint ("cdcabe93-4f55-4dbb-821e-912097c4f727");
- StartTest ("TestBug10782");
- CheckPosition ("cdcabe93-4f55-4dbb-821e-912097c4f727");
- StepIn ("1f37aea1-77a1-40c1-9ea5-797db48a14f9", 1);
- StepOut ("cdcabe93-4f55-4dbb-821e-912097c4f727");
- StepIn ("3bda6643-6d06-4504-a4da-91bc8c5eb887", -1);
- }
-
- /// <summary>
- /// Bug 11868
- /// </summary>
- [Test]
- [Ignore ("Todo")]
- public void AwaitCall ()
- {
- InitializeTest ();
- AddBreakpoint ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", -1);
- StartTest ("TestAwaitCall");
- CheckPosition ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", -1);
- StepOver ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");
- StepOver ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", 1);
- StepOver ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", 2);
- }
-
- /// <summary>
- /// Bug 13396
- /// </summary>
- [Test]
- [Ignore ("This is not working in VS as well is this doable or should bug be closed as invalid?")]
- public void StepInsideAwaitTaskRun ()
- {
- InitializeTest ();
- AddBreakpoint ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", -1);
- StartTest ("StepInsideAwaitTaskRun");
- CheckPosition ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", -1);
- StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");
- StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");//Now we are on delegate
- //entering EmptyMethod
- StepIn ("3c27f60f-fdfa-44c0-b58f-552ecaaa77f1", -1);
- StepIn ("3c27f60f-fdfa-44c0-b58f-552ecaaa77f1", 1);
- StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");//Back at delegate
- StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");//Back at await?
- StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", 1);
- }
-
- /// <summary>
- /// Bug 13640
- /// </summary>
- [Test]
- public void Bug13640 ()
- {
- InitializeTest ();
- AddBreakpoint ("b64e6497-e976-4125-9741-801909e5eeb1");
- StartTest ("Bug13640");
- CheckPosition ("b64e6497-e976-4125-9741-801909e5eeb1");
- StepIn ("b64e6497-e976-4125-9741-801909e5eeb1", 1, "foreach");
- StepIn ("b64e6497-e976-4125-9741-801909e5eeb1", 1, "l");
- StepIn ("b64e6497-e976-4125-9741-801909e5eeb1", 1, "in");
- StepIn ("a90ba766-0891-4837-9b1d-e5458f6b8e07", "return");
- StepIn ("a90ba766-0891-4837-9b1d-e5458f6b8e07", 1, "}");
- }
-
- [Test]
- public void SetNextStatementTest ()
- {
- InitializeTest ();
- AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- SetNextStatement ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- StepIn ("3e2e4759-f6d9-4839-98e6-4fa96b227458", 1);
- }
-
-
- [Test]
- public void SetNextStatementTest2 ()
- {
- InitializeTest ();
- AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- SetNextStatement ("c35046f7-e87d-4b8f-b260-43e181a0a07c", -1, "{");
- StepIn ("c35046f7-e87d-4b8f-b260-43e181a0a07c", 1, "int");
- }
-
- [Test]
- public void SetNextStatementTest3 ()
- {
- InitializeTest ();
- AddBreakpoint ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
- StartTest ("SimpleMethod");
- CheckPosition ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
- StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 2);
- StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 3);
- StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 4);
- SetNextStatement ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
- StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 2);
- StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 3);
- SetNextStatement ("f4e3a214-229e-44dd-9da2-db82ddfbec11", -1);
- StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
- }
-
- [Test]
- public void CatchPointTest1 ()
- {
- InitializeTest ();
- AddBreakpoint ("fcdc2412-c00e-4c95-b2ea-e3cf5d5bf856");
- AddCatchpoint ("System.Exception", true);
- StartTest ("Catchpoint1");
- if (!CheckPosition ("526795d3-ee9e-44a7-8423-df0b406e9e8d", 1, null, true))//Workaround for Win32 debugger which stops at +1 line
- CheckPosition ("526795d3-ee9e-44a7-8423-df0b406e9e8d");
- var ops = Session.EvaluationOptions.Clone ();
- ops.MemberEvaluationTimeout = 0;
- ops.EvaluationTimeout = 0;
- ops.EllipsizeStrings = false;
-
- var val = Frame.GetException (ops);
- Assert.AreEqual ("System.NotImplementedException", val.Type);
-
- InitializeTest ();
- AddBreakpoint ("fcdc2412-c00e-4c95-b2ea-e3cf5d5bf856");
- AddCatchpoint ("System.Exception", false);
- StartTest ("Catchpoint1");
- CheckPosition ("fcdc2412-c00e-4c95-b2ea-e3cf5d5bf856");
- }
-
- [Test]
- public void CatchPointTest2 ()
- {
- IgnoreSoftDebugger ("I'm having problem testing this because. There is error nonstop happening in framework about CurrentCulture featching.");
- IgnoreCorDebugger ("Randomly fails");
-
- InitializeTest ();
- AddCatchpoint ("System.Exception", true);
- StartTest ("Catchpoint2");
- CheckPosition ("d24b1c9d-3944-4f0d-be31-5556251fbdf5");
- Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
- Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
- }
-
- [Test]
- public void CatchpointIgnoreExceptionsInNonUserCodeTest ()
- {
- //It seems CorDebugger has different definition of what is user code and what is not.
- IgnoreCorDebugger ("CorDebugger: TODO");
-
- InitializeTest ();
- Session.Options.ProjectAssembliesOnly = true;
- AddBreakpoint ("999b8a83-8c32-4640-a8e1-f74309cda79c");
- AddCatchpoint ("System.Exception", true);
- StartTest ("CatchpointIgnoreExceptionsInNonUserCode");
- CheckPosition ("999b8a83-8c32-4640-a8e1-f74309cda79c");
-
- InitializeTest ();
- Session.Options.ProjectAssembliesOnly = false;
- AddCatchpoint ("System.Exception", true);
- AddBreakpoint ("999b8a83-8c32-4640-a8e1-f74309cda79c");
- StartTest ("CatchpointIgnoreExceptionsInNonUserCode");
- WaitStop (2000);
- Assert.AreEqual ("3913936e-3f89-4f07-a863-7275aaaa5fc9", Session.ActiveThread.Backtrace.GetFrame (0).GetException ().Message);
- }
-
- [Test] - public void ConditionalBreakpoints ()
- {
- ObjectValue val;
- Breakpoint bp;
-
- InitializeTest ();
- AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- bp.ConditionExpression = "i==2";
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("2", val.Value);
- Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
-
- IgnoreCorDebugger ("TODO: Conditional breakpoints with compare against string or enum is not working on CorDebugger");
-
- InitializeTest ();
- bp = AddBreakpoint ("033dd01d-6cb4-4e1a-b445-de6d7fa0d2a7");
- bp.ConditionExpression = "str == \"bbb\"";
- StartTest ("ConditionalBreakpointString");
- CheckPosition ("033dd01d-6cb4-4e1a-b445-de6d7fa0d2a7");
- val = Eval ("str");
- Assert.AreEqual ("\"bbb\"", val.Value);
-
- InitializeTest ();
- bp = AddBreakpoint ("ecf764bf-9182-48d6-adb0-0ba36e2653a7");
- bp.ConditionExpression = "en == BooleanEnum.False";
- StartTest ("ConitionalBreakpointEnum");
- CheckPosition ("ecf764bf-9182-48d6-adb0-0ba36e2653a7");
- val = Eval ("en");
- Assert.AreEqual ("BooleanEnum.False", val.Value);
- }
-
- [Test]
- public void HitCountBreakpoints ()
- {
- ObjectValue val;
- Breakpoint bp;
-
- InitializeTest ();
- AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- bp.HitCount = 3;
- bp.HitCountMode = HitCountMode.EqualTo;
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("2", val.Value);
- Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
-
- InitializeTest ();
- AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- bp.HitCount = 3;
- bp.HitCountMode = HitCountMode.GreaterThan;
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("3", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("4", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("5", val.Value);
-
- InitializeTest ();
- AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- bp.HitCount = 3;
- bp.HitCountMode = HitCountMode.GreaterThanOrEqualTo;
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("2", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("3", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("4", val.Value);
-
- InitializeTest ();
- AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- bp.HitCount = 3;
- bp.HitCountMode = HitCountMode.LessThan;
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("0", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("1", val.Value);
- Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
-
- InitializeTest ();
- AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- bp.HitCount = 3;
- bp.HitCountMode = HitCountMode.LessThanOrEqualTo;
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("0", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("1", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("2", val.Value);
- Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
-
- InitializeTest ();
- AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- bp.HitCount = 3;
- bp.HitCountMode = HitCountMode.MultipleOf;
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("2", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("5", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("8", val.Value);
- Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
-
- InitializeTest ();
- AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
- bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- bp.HitCount = 3;
- bp.HitCountMode = HitCountMode.None;
- StartTest ("ForLoop10");
- CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("0", val.Value);
- Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
- val = Eval ("i");
- Assert.AreEqual ("1", val.Value);
- }
-
- [Test] - public void Bug13401 ()
- {
- InitializeTest ();
- AddBreakpoint ("977ee8ce-ee61-4de0-9fc1-138fa164870b");
- StartTest ("Bug13401");
- CheckPosition ("977ee8ce-ee61-4de0-9fc1-138fa164870b");
- var val = Eval ("s");
- Assert.AreEqual ("string", val.TypeName);
- Assert.AreEqual ("\"Hello from Bar\"", val.Value);
- }
-
- [Test]
- public void OutputAndDebugWriter ()
- {
- //Interesting fact... Debug.Write(""); produces log entry
- //but Console.Write(""); does not
-
- InitializeTest ();
- AddBreakpoint ("5070ed1c-593d-4cbe-b4fa-b2b0c7b25289");
- var errorsList = new List<string> ();
- errorsList.Add ("ErrorText");
- var outputList = new HashSet<string> ();
- outputList.Add ("NormalText");
- var debugList = new List<Tuple<int,string,string>> ();
- debugList.Add (new Tuple<int,string,string> (0, "", "DebugText"));
- debugList.Add (new Tuple<int, string, string> (3, "SomeCategory", "DebugText2"));
-
- var unexpectedOutput = new List<string> ();
- var unexpectedError = new List<string> ();
- var unexpectedDebug = new List<Tuple<int,string,string>> ();
-
- Session.DebugWriter = delegate(int level, string category, string message) {
- var entry = new Tuple<int,string,string> (level, category, message);
- if (entry.Equals (new Tuple<int,string,string> (0, "", "")))//Sdb is emitting some empty messages :S
- return;
- if (debugList.Contains (entry)) {
- debugList.Remove (entry);
- } else {
- unexpectedDebug.Add (entry);
- }
- };
- Session.OutputWriter = delegate(bool isStderr, string text) {
- if (isStderr) {
- if (errorsList.Contains (text))
- errorsList.Remove (text);
- else
- unexpectedError.Add (text);
- } else {
- if (outputList.Contains (text))
- outputList.Remove (text);
- else
- unexpectedOutput.Add (text);
- }
- };
- StartTest ("OutputAndDebugWriter");
- CheckPosition ("5070ed1c-593d-4cbe-b4fa-b2b0c7b25289");
- if (outputList.Count > 0)
- Assert.Fail ("Output list still has following items:" + string.Join (",", outputList));
- if (errorsList.Count > 0)
- Assert.Fail ("Error list still has following items:" + string.Join (",", errorsList));
- if (debugList.Count > 0)
- Assert.Fail ("Debug list still has following items:" + string.Join (",", debugList));
- if (unexpectedOutput.Count > 0)
- Assert.Fail ("Unexcpected Output list has following items:" + string.Join (",", unexpectedOutput));
- if (unexpectedError.Count > 0)
- Assert.Fail ("Unexcpected Error list has following items:" + string.Join (",", unexpectedError));
- if (unexpectedDebug.Count > 0)
- Assert.Fail ("Unexcpected Debug list has following items:" + string.Join (",", unexpectedDebug));
- }
-
- [Test]
- public void Bug25358 ()
- {
- InitializeTest ();
- AddBreakpoint ("4b30f826-2ba0-4b53-ab36-85b2cdde1069");
- StartTest ("TestBug25358");
- CheckPosition ("4b30f826-2ba0-4b53-ab36-85b2cdde1069");
- var val = Eval ("e");
- val = val.GetChildSync ("Message", EvaluationOptions.DefaultOptions);
- Assert.AreEqual ("\"2b2c4423-accf-4c2c-af31-7d8dcee31c32\"", val.Value);
- }
-
- [Test]
- public void Bug21410 ()
- {
- IgnoreSoftDebugger ("Runtime bug.");
-
- InitializeTest ();
- AddBreakpoint ("5e6663d0-9088-40ad-914d-0fcc05b2d0d5");
- StartTest ("TestBug21410");
- CheckPosition ("5e6663d0-9088-40ad-914d-0fcc05b2d0d5");
- StepOver ("5e6663d0-9088-40ad-914d-0fcc05b2d0d5", 1);
- } - }
-}
-
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorBreakpointsAndSteppingTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorBreakpointsAndSteppingTests.cs deleted file mode 100644 index 43eaec378d..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorBreakpointsAndSteppingTests.cs +++ /dev/null @@ -1,39 +0,0 @@ -//
-// CorBreakpointsAndSteppingTests.cs
-//
-// Author:
-// David Karlaš <david.karlas@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using NUnit.Framework;
-
-namespace MonoDevelop.Debugger.Tests.Win32
-{
- [TestFixture]
- [Platform (Include = "Win")]
- public class CorBreakpointsAndSteppingTests: BreakpointsAndSteppingTests
- {
- public CorBreakpointsAndSteppingTests () : base ("MonoDevelop.Debugger.Win32")
- {
- }
- }
-}
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorEvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorEvaluationTests.cs deleted file mode 100644 index f6714b4375..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorEvaluationTests.cs +++ /dev/null @@ -1,49 +0,0 @@ -//
-// CorEvaluationTests.cs
-//
-// Author:
-// Therzok <teromario@yahoo.com>
-//
-// Copyright (c) 2013 Xamarin Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using NUnit.Framework;
-
-namespace MonoDevelop.Debugger.Tests.Win32
-{
- [TestFixture]
- [Platform (Include = "Win")]
- public class CorEvaluationAllowTargetInvokesTests: EvaluationTests
- {
- public CorEvaluationAllowTargetInvokesTests (): base ("MonoDevelop.Debugger.Win32", true)
- {
- }
- }
-
- [TestFixture]
- [Platform (Include = "Win")]
- [Ignore ("Disabled for now")]
- public class CorEvaluationNoTargetInvokesTests: EvaluationTests
- {
- public CorEvaluationNoTargetInvokesTests (): base ("MonoDevelop.Debugger.Win32", false)
- {
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorStackFrameTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorStackFrameTests.cs deleted file mode 100644 index 41d0b3ae12..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorStackFrameTests.cs +++ /dev/null @@ -1,47 +0,0 @@ -//
-// CorStackFrametests.cs
-//
-// Author:
-// Therzok <teromario@yahoo.com>
-//
-// Copyright (c) 2013 Xamarin Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using NUnit.Framework;
-
-namespace MonoDevelop.Debugger.Tests.Win32
-{
- [TestFixture]
- [Platform (Include = "Win")]
- public class CorStackFrameAllowTargetInvokesTests : StackFrameTests
- {
- public CorStackFrameAllowTargetInvokesTests (): base ("MonoDevelop.Debugger.Win32", true)
- {
- }
- }
-
- [TestFixture]
- [Platform (Include = "Win")]
- public class CorStackFrameNoTargetInvokesTests : StackFrameTests
- {
- public CorStackFrameNoTargetInvokesTests (): base ("MonoDevelop.Debugger.Win32", false)
- {
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.MonoDevelop.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.MonoDevelop.cs new file mode 100644 index 0000000000..d7bd837f54 --- /dev/null +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.MonoDevelop.cs @@ -0,0 +1,136 @@ +using System;
+using System.IO;
+using System.Linq;
+using Mono.Debugging.Client;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Assemblies;
+using MonoDevelop.Core.Execution;
+using MonoDevelop.Debugger;
+using NUnit.Framework;
+
+using MDTextFile = MonoDevelop.Projects.Text.TextFile;
+
+namespace Mono.Debugging.Tests
+{
+ public abstract partial class DebugTests
+ {
+ DebuggerEngine engine;
+ TargetRuntime runtime;
+
+ partial void SetUpPartial()
+ {
+ foreach (var e in DebuggingService.GetDebuggerEngines ()) {
+ if (e.Id == EngineId) {
+ engine = e;
+ break;
+ }
+ }
+ if (engine == null)
+ Assert.Ignore ("Engine not found: {0}", EngineId);
+ }
+
+ partial void TearDownPartial ()
+ {
+ }
+
+ FilePath UnitTestsDir
+ {
+ get{
+ FilePath thisAssemblyPath = GetType ().Assembly.Location;
+ return thisAssemblyPath.ParentDirectory.ParentDirectory.ParentDirectory.Combine ("external", "debugger-libs", "UnitTests");
+ }
+ }
+
+ protected string TargetExeDirectory
+ {
+ get{
+ return Path.GetDirectoryName (GetType ().Assembly.Location);
+ }
+ }
+
+ protected string TargetProjectSourceDir
+ {
+ get{
+ FilePath path = TargetExeDirectory;
+ return UnitTestsDir.Combine (TestAppProjectDirName);
+ }
+ }
+
+ protected DebuggerSession CreateSession (string test, string engineId)
+ {
+ switch (engineId) {
+ case "MonoDevelop.Debugger.Win32":
+ runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("MS.NET");
+ break;
+ case "Mono.Debugger.Soft":
+ runtime = Runtime.SystemAssemblyService.GetTargetRuntimes ()
+ .OfType<MonoTargetRuntime> ()
+ .OrderByDescending ((o) => {
+ //Attempt to find latest version of Mono registred in IDE and use that for unit tests
+ if (string.IsNullOrWhiteSpace (o.Version) || o.Version == "Unknown")
+ return new Version (0, 0, 0, 0);
+ int indexOfBeforeDetails = o.Version.IndexOf (" (", StringComparison.Ordinal);
+ if (indexOfBeforeDetails == -1)
+ return new Version (0, 0, 0, 0);
+ string hopefullyVersion = o.Version.Remove (indexOfBeforeDetails);
+ Version version;
+ if (Version.TryParse (hopefullyVersion, out version)) {
+ return version;
+ } else {
+ return new Version (0, 0, 0, 0);
+ }
+ }).FirstOrDefault ();
+ break;
+ default:
+ runtime = Runtime.SystemAssemblyService.DefaultRuntime;
+ break;
+ }
+
+ if (runtime == null) {
+ Assert.Ignore ("Runtime not found for: {0}", engineId);
+ }
+
+ Console.WriteLine ("Target Runtime: " + runtime.DisplayRuntimeName + " " + runtime.Version + " " + (IntPtr.Size == 8 ? "64bit" : "32bit"));
+
+ // main/build/tests
+ var exe = TargetExePath;
+
+ var cmd = new DotNetExecutionCommand ();
+ cmd.TargetRuntime = runtime;
+ cmd.Command = exe;
+ cmd.Arguments = test;
+
+ if (Platform.IsWindows) {
+ var monoRuntime = runtime as MonoTargetRuntime;
+ if (monoRuntime != null) {
+ var psi = new System.Diagnostics.ProcessStartInfo (Path.Combine (monoRuntime.Prefix, "bin", "pdb2mdb.bat"), exe);
+ psi.UseShellExecute = false;
+ psi.CreateNoWindow = true;
+ System.Diagnostics.Process.Start (psi).WaitForExit ();
+ }
+ }
+ return engine.CreateSession ();
+ }
+
+ protected DebuggerStartInfo CreateStartInfo (string test, string engineId)
+ {
+ var cmd = new DotNetExecutionCommand {
+ TargetRuntime = runtime,
+ Command = TargetExePath,
+ Arguments = test
+ };
+ var dsi = engine.CreateDebuggerStartInfo (cmd);
+ return dsi;
+ }
+
+ /// <summary>
+ /// Reads file from given path
+ /// </summary>
+ /// <param name="sourcePath"></param>
+ /// <returns></returns>
+ public static ITextFile ReadFile (string sourcePath)
+ {
+ return new TextFile(MDTextFile.ReadFile (sourcePath));
+ }
+ }
+}
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs deleted file mode 100644 index fafb2b96c6..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs +++ /dev/null @@ -1,466 +0,0 @@ -// -// DebugTests.cs -// -// Author: -// Lluis Sanchez Gual <lluis@novell.com> -// -// Copyright (c) 2009 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.IO; -using System.Linq; -using System.Threading; -using System.Reflection; -using System.Collections.Generic; - -using Mono.Debugging.Soft; -using Mono.Debugging.Client; - -using MonoDevelop.Core; -using MonoDevelop.Core.Execution; -using MonoDevelop.Projects.Text; -using MonoDevelop.Core.Assemblies; - -using NUnit.Framework; - -namespace MonoDevelop.Debugger.Tests -{ - [TestFixture] - public abstract class DebugTests - { - readonly ManualResetEvent targetStoppedEvent = new ManualResetEvent (false); - readonly string EngineId; - DebuggerEngine engine; - string TestName = ""; - TextFile SourceFile; - - SourceLocation lastStoppedPosition; - - public bool AllowTargetInvokes { get; protected set; } - - public DebuggerSession Session { get; private set; } - - public StackFrame Frame { get; private set; } - - protected DebugTests (string engineId) - { - EngineId = engineId; - } - - public void IgnoreCorDebugger (string message = "") - { - if (!(Session is SoftDebuggerSession)) { - Assert.Ignore (message); - } - } - - public void IgnoreSoftDebugger (string message = "") - { - if (Session is SoftDebuggerSession) { - Assert.Ignore (message); - } - } - - [TestFixtureSetUp] - public virtual void SetUp () - { - foreach (var e in DebuggingService.GetDebuggerEngines ()) { - if (e.Id == EngineId) { - engine = e; - break; - } - } - if (engine == null) - Assert.Ignore ("Engine not found: {0}", EngineId); - } - - [TestFixtureTearDown] - public virtual void TearDown () - { - if (Session != null) { - Session.Exit (); - Session.Dispose (); - Session = null; - } - } - - protected void Start (string test) - { - TargetRuntime runtime; - - switch (EngineId) { - case "MonoDevelop.Debugger.Win32": - runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("MS.NET"); - break; - case "Mono.Debugger.Soft": - runtime = Runtime.SystemAssemblyService.GetTargetRuntimes () - .OfType<MonoTargetRuntime> () - .OrderByDescending ((o) => { - //Attempt to find latest version of Mono registred in IDE and use that for unit tests - if (string.IsNullOrWhiteSpace (o.Version) || o.Version == "Unknown") - return new Version (0, 0, 0, 0); - int indexOfBeforeDetails = o.Version.IndexOf (" (", StringComparison.Ordinal); - if (indexOfBeforeDetails == -1) - return new Version (0, 0, 0, 0); - string hopefullyVersion = o.Version.Remove (indexOfBeforeDetails); - Version version; - if (Version.TryParse (hopefullyVersion, out version)) { - return version; - } else { - return new Version (0, 0, 0, 0); - } - }).FirstOrDefault (); - break; - default: - runtime = Runtime.SystemAssemblyService.DefaultRuntime; - break; - } - - if (runtime == null) { - Assert.Ignore ("Runtime not found for: {0}", EngineId); - return; - } - - Console.WriteLine ("Target Runtime: " + runtime.DisplayRuntimeName + " " + runtime.Version + " " + (IntPtr.Size == 8 ? "64bit" : "32bit")); - - // main/build/tests - FilePath path = Path.GetDirectoryName (GetType ().Assembly.Location); - var exe = Path.Combine (path, "MonoDevelop.Debugger.Tests.TestApp.exe"); - - var cmd = new DotNetExecutionCommand (); - cmd.TargetRuntime = runtime; - cmd.Command = exe; - cmd.Arguments = test; - - if (Platform.IsWindows) { - var monoRuntime = runtime as MonoTargetRuntime; - if (monoRuntime != null) { - var psi = new System.Diagnostics.ProcessStartInfo (Path.Combine (monoRuntime.Prefix, "bin", "pdb2mdb.bat"), cmd.Command); - psi.UseShellExecute = false; - psi.CreateNoWindow = true; - System.Diagnostics.Process.Start (psi).WaitForExit (); - } - } - - var dsi = engine.CreateDebuggerStartInfo (cmd); - var soft = dsi as SoftDebuggerStartInfo; - - if (soft != null) { - var assemblyName = AssemblyName.GetAssemblyName (exe); - - soft.UserAssemblyNames = new List<AssemblyName> (); - soft.UserAssemblyNames.Add (assemblyName); - } - - Session = engine.CreateSession (); - var ops = new DebuggerSessionOptions (); - ops.ProjectAssembliesOnly = true; - ops.EvaluationOptions = EvaluationOptions.DefaultOptions; - ops.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes; - ops.EvaluationOptions.EvaluationTimeout = 100000; - - path = path.ParentDirectory.ParentDirectory.Combine ("src", "addins", "MonoDevelop.Debugger", "MonoDevelop.Debugger.Tests.TestApp", test + ".cs").FullPath; - SourceFile = TextFile.ReadFile (path); - TestName = test; - AddBreakpoint ("break"); - - var done = new ManualResetEvent (false); - - Session.TargetHitBreakpoint += (sender, e) => { - Frame = e.Backtrace.GetFrame (0); - lastStoppedPosition = Frame.SourceLocation; - targetStoppedEvent.Set (); - done.Set (); - }; - - Session.TargetExceptionThrown += (sender, e) => { - Frame = e.Backtrace.GetFrame (0); - for (int i = 0; i < e.Backtrace.FrameCount; i++) { - if (!e.Backtrace.GetFrame (i).IsExternalCode) { - Frame = e.Backtrace.GetFrame (i); - break; - } - } - lastStoppedPosition = Frame.SourceLocation; - targetStoppedEvent.Set (); - }; - - Session.TargetStopped += (sender, e) => { - //This can be null in case of ForcedStop - //which is called when exception is thrown - //when Continue & Stepping is executed - if (e.Backtrace != null) { - Frame = e.Backtrace.GetFrame (0); - lastStoppedPosition = Frame.SourceLocation; - targetStoppedEvent.Set (); - } else { - Console.WriteLine ("e.Backtrace is null"); - } - }; - - var targetExited = new ManualResetEvent (false); - Session.TargetExited += delegate { - targetExited.Set (); - }; - - Session.Run (dsi, ops); - Session.ExceptionHandler = (ex) => { - Console.WriteLine ("Session.ExceptionHandler:" + Environment.NewLine + ex.ToString ()); - return true; - }; - switch (WaitHandle.WaitAny (new WaitHandle[]{ done, targetExited }, 30000)) { - case 0: - //Breakpoint is hit good... run tests now - break; - case 1: - throw new Exception ("Test application exited before hitting breakpoint"); - default: - throw new Exception ("Timeout while waiting for initial breakpoint"); - } - if (Session is SoftDebuggerSession) { - Console.WriteLine ("SDB protocol version:" + ((SoftDebuggerSession)Session).ProtocolVersion); - } - } - - void GetLineAndColumn (string breakpointMarker, int offset, string statement, out int line, out int col) - { - int i = SourceFile.Text.IndexOf ("/*" + breakpointMarker + "*/", StringComparison.Ordinal); - if (i == -1) - Assert.Fail ("Break marker not found: " + breakpointMarker + " in " + SourceFile.Name); - SourceFile.GetLineColumnFromPosition (i, out line, out col); - line += offset; - if (statement != null) { - int lineStartPosition = SourceFile.GetPositionFromLineColumn (line, 1); - string lineText = SourceFile.GetText (lineStartPosition, lineStartPosition + SourceFile.GetLineLength (line)); - col = lineText.IndexOf (statement, StringComparison.Ordinal) + 1; - if (col == 0) - Assert.Fail ("Failed to find statement:" + statement + " at " + SourceFile.Name + "(" + line + ")"); - } else { - col = 1; - } - } - - public Breakpoint AddBreakpoint (string breakpointMarker, int offset = 0, string statement = null) - { - int col, line; - GetLineAndColumn (breakpointMarker, offset, statement, out line, out col); - var bp = new Breakpoint (SourceFile.Name, line, col); - Session.Breakpoints.Add (bp); - return bp; - } - - public void RunToCursor (string breakpointMarker, int offset = 0, string statement = null) - { - int col, line; - GetLineAndColumn (breakpointMarker, offset, statement, out line, out col); - targetStoppedEvent.Reset (); - Session.Breakpoints.RemoveRunToCursorBreakpoints (); - var bp = new RunToCursorBreakpoint (SourceFile.Name, line, col); - Session.Breakpoints.Add (bp); - Session.Continue (); - CheckPosition (breakpointMarker, offset, statement); - } - - public void InitializeTest () - { - Session.Breakpoints.Clear (); - Session.Options.EvaluationOptions = EvaluationOptions.DefaultOptions; - Session.Options.ProjectAssembliesOnly = true; - Session.Options.StepOverPropertiesAndOperators = false; - AddBreakpoint ("break"); - while (!CheckPosition ("break", 0, silent: true)) { - targetStoppedEvent.Reset (); - Session.Continue (); - } - } - - public ObjectValue Eval (string exp) - { - return Frame.GetExpressionValue (exp, true).Sync (); - } - - public void WaitStop (int miliseconds) - { - if (!targetStoppedEvent.WaitOne (miliseconds)) { - Assert.Fail ("WaitStop failure: Target stop timeout"); - } - } - - public bool CheckPosition (string guid, int offset = 0, string statement = null, bool silent = false) - { - if (!targetStoppedEvent.WaitOne (6000)) { - if (!silent) - Assert.Fail ("CheckPosition failure: Target stop timeout"); - return false; - } - if (lastStoppedPosition.FileName == SourceFile.Name) { - int i = SourceFile.Text.IndexOf ("/*" + guid + "*/", StringComparison.Ordinal); - if (i == -1) { - if (!silent) - Assert.Fail ("CheckPosition failure: Guid marker not found:" + guid + " in file:" + SourceFile.Name); - return false; - } - int line, col; - SourceFile.GetLineColumnFromPosition (i, out line, out col); - if ((line + offset) != lastStoppedPosition.Line) { - if (!silent) - Assert.Fail ("CheckPosition failure: Wrong line Expected:" + (line + offset) + " Actual:" + lastStoppedPosition.Line + " in file:" + SourceFile.Name); - return false; - } - if (!string.IsNullOrEmpty (statement)) { - int position = SourceFile.GetPositionFromLineColumn (lastStoppedPosition.Line, lastStoppedPosition.Column); - string actualStatement = SourceFile.GetText (position, position + statement.Length); - if (statement != actualStatement) { - if (!silent) - Assert.AreEqual (statement, actualStatement); - return false; - } - } - } else { - if (!silent) - Assert.Fail ("CheckPosition failure: Wrong file Excpected:" + SourceFile.Name + " Actual:" + lastStoppedPosition.FileName); - return false; - } - return true; - } - - public void StepIn (string guid, string statement) - { - StepIn (guid, 0, statement); - } - - public void StepIn (string guid, int offset = 0, string statement = null) - { - targetStoppedEvent.Reset (); - Session.StepInstruction (); - CheckPosition (guid, offset, statement); - } - - public void StepOver (string guid, string statement) - { - StepOver (guid, 0, statement); - } - - public void StepOver (string guid, int offset = 0, string statement = null) - { - targetStoppedEvent.Reset (); - Session.NextInstruction (); - CheckPosition (guid, offset, statement); - } - - public void StepOut (string guid, string statement) - { - StepOut (guid, 0, statement); - } - - public void StepOut (string guid, int offset = 0, string statement = null) - { - targetStoppedEvent.Reset (); - Session.Finish (); - CheckPosition (guid, offset, statement); - } - - public void Continue (string guid, string statement) - { - Continue (guid, 0, statement); - } - - public void Continue (string guid, int offset = 0, string statement = null) - { - targetStoppedEvent.Reset (); - Session.Continue (); - CheckPosition (guid, offset, statement); - } - - public void StartTest (string methodName) - { - if (!targetStoppedEvent.WaitOne (3000)) { - Assert.Fail ("StartTest failure: Target stop timeout"); - } - Assert.AreEqual ('"' + methodName + '"', Eval ("NextMethodToCall = \"" + methodName + "\";").Value); - targetStoppedEvent.Reset (); - Session.Continue (); - } - - public void SetNextStatement (string guid, int offset = 0, string statement = null) - { - int line, column; - GetLineAndColumn (guid, offset, statement, out line, out column); - Session.SetNextStatement (SourceFile.Name, line, column); - } - - public void AddCatchpoint (string exceptionName, bool includeSubclasses) - { - Session.Breakpoints.Add (new Catchpoint (exceptionName, includeSubclasses)); - } - } - - static class EvalHelper - { - public static bool AtLeast (this Version ver, int major, int minor) { - if ((ver.Major > major) || ((ver.Major == major && ver.Minor >= minor))) - return true; - else - return false; - } - - public static ObjectValue Sync (this ObjectValue val) - { - if (!val.IsEvaluating) - return val; - - object locker = new object (); - EventHandler h = delegate { - lock (locker) { - Monitor.PulseAll (locker); - } - }; - - val.ValueChanged += h; - - lock (locker) { - while (val.IsEvaluating) { - if (!Monitor.Wait (locker, 8000)) - throw new Exception ("Timeout while waiting for value evaluation"); - } - } - - val.ValueChanged -= h; - return val; - } - - public static ObjectValue GetChildSync (this ObjectValue val, string name, EvaluationOptions ops) - { - var result = val.GetChild (name, ops); - - return result != null ? result.Sync () : null; - } - - public static ObjectValue[] GetAllChildrenSync (this ObjectValue val) - { - var children = val.GetAllChildren (); - foreach (var child in children) { - child.Sync (); - } - return children; - } - } -} diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs deleted file mode 100644 index ffda5ad636..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs +++ /dev/null @@ -1,2459 +0,0 @@ -// -// EvaluationTests.cs -// -// Author: -// Lluis Sanchez Gual <lluis@novell.com> -// -// Copyright (c) 2009 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -using Mono.Debugging.Client; -using NUnit.Framework; -using Mono.Debugging.Soft; - -namespace MonoDevelop.Debugger.Tests -{ - [TestFixture] - public abstract class EvaluationTests: DebugTests - { - protected EvaluationTests (string de, bool allowTargetInvokes) : base (de) - { - AllowTargetInvokes = allowTargetInvokes; - } - - [TestFixtureSetUp] - public override void SetUp () - { - base.SetUp (); - - Start ("TestEvaluation"); - Session.TypeResolverHandler = ResolveType; - } - - static string ResolveType (string identifier, SourceLocation location) - { - switch (identifier) { - case "SomeClassInNamespace": - return "MonoDevelop.Debugger.Tests.TestApp.SomeClassInNamespace"; - case "ParentNestedClass": - return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluationParent.ParentNestedClass"; - case "NestedClass": - return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass"; - case "TestEvaluation": - return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation"; - case "NestedGenericClass`2": - return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedGenericClass"; - case "Dictionary`2": - return "System.Collections.Generic.Dictionary"; - case "Thing`1": - return "Thing"; - case "A": - return "A"; - case "B": - return "B"; - case "C": - return "C"; - case "System": - return "System"; - case "MonoDevelop": - return "MonoDevelop"; - case "SomeEnum": - return "SomeEnum"; - case "IFoo": - return "MonoDevelop.Debugger.Tests.TestApp.IFoo"; - case "IBar": - return "MonoDevelop.Debugger.Tests.TestApp.IBar"; - case "Bo": - return "MonoDevelop.Debugger.Tests.TestApp.Bo"; - } - return null; - } - - [Test] - public void This () - { - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - ObjectValue val = Eval ("this"); - Assert.AreEqual ("{MonoDevelop.Debugger.Tests.TestApp.TestEvaluationChild}", val.Value); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluationChild", val.TypeName); - } - - [Test] - public void UnaryOperators () - { - ObjectValue val = Eval ("~1234"); - Assert.AreEqual ((~1234).ToString (), val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("!true"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("!false"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("-1234"); - Assert.AreEqual ("-1234", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("+1234"); - Assert.AreEqual ("1234", val.Value); - Assert.AreEqual ("int", val.TypeName); - } - - [Test] - public void TypeReference () - { - ObjectValue val; - val = Eval ("System.String"); - Assert.AreEqual ("string", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("TestEvaluation"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("A"); - Assert.AreEqual ("A", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("NestedClass"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("NestedClass.DoubleNestedClass"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass.DoubleNestedClass", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("ParentNestedClass"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluationParent.ParentNestedClass", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("SomeClassInNamespace"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.SomeClassInNamespace", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("ClassWithCompilerGeneratedNestedClass"); - Assert.AreEqual ("ClassWithCompilerGeneratedNestedClass", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - var children = val.GetAllChildrenSync (); - Assert.AreEqual (2, children.Length); - Assert.AreEqual ("ClassWithCompilerGeneratedNestedClass.NestedClass", children [0].Value); - Assert.AreEqual ("<type>", children [0].TypeName); - Assert.AreEqual (ObjectValueFlags.Type, children [0].Flags & ObjectValueFlags.OriginMask); - } - - [Test] - public virtual void HiddenMembers () - { - IgnoreCorDebugger ("TODO"); - if (Session is SoftDebuggerSession) { - if (!((SoftDebuggerSession)Session).ProtocolVersion.AtLeast (2, 40)) { - Assert.Ignore ("Need newer Mono with SDB protocol 2.40+"); - } - } - ObjectValue val; - val = Eval ("HiddenField"); - Assert.AreEqual ("5", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("HiddenProperty"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("5", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("HiddenMethod()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("5", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("OverridenPropertyInt"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("6", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("OverridenMethodInt()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("6", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("OverridenPropertyString"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"6\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("OverridenMethodString()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"6\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - - - val = Eval ("testEvaluationChild.HiddenField"); - Assert.AreEqual ("6", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("testEvaluationChild.HiddenProperty"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("6", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("testEvaluationChild.HiddenMethod()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("6", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("testEvaluationChild.OverridenPropertyInt"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("6", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("testEvaluationChild.OverridenMethodInt()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("6", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("testEvaluationChild.OverridenPropertyString"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"6\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("testEvaluationChild.OverridenMethodString()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"6\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - } - - [Test] - public virtual void TypeReferenceGeneric () - { - ObjectValue val; - val = Eval ("System.Collections.Generic.Dictionary<string,int>"); - Assert.AreEqual ("System.Collections.Generic.Dictionary<string,int>", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - val = Eval ("Thing<string>.Done<int>"); - Assert.AreEqual ("Thing<string>.Done<int>", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - } - - [Test] - public virtual void Typeof () - { - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - var val = Eval ("typeof(System.Console)"); - Assert.IsTrue (val.TypeName == "System.MonoType" || val.TypeName == "System.RuntimeType", "Incorrect type name: " + val.TypeName); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.Value == "{System.MonoType}" || val.Value == "{System.RuntimeType}"); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("{System.Console}", val.Value); - } - - [Test] - public void MethodInvoke () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("TestMethod ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("TestMethod (\"23\")"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("24", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("TestMethod (42)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("43", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("TestMethod (false)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("this.TestMethod ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("this.TestMethod (\"23\")"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("24", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("this.TestMethod (42)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("43", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("System.Int32.Parse (\"67\")"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("67", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("this.BoxingTestMethod (43)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"43\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("objWithMethodA.MethodA()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"AbstractImplementation\"", val.Value); - Assert.AreEqual ("string", val.TypeName);
- - IgnoreCorDebugger("TODO: CorDebugger support explicit interfaces"); - - val = Eval ("((IInterfaceWithMethodA)objWithMethodA).MethodA()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"InterfaceImplementation\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("true.ToString()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - - Assert.AreEqual ("\"True\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - } - - [Test] - public void GenericMethodInvoke () - { - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - if (Session.GetType ().Name == "CorDebuggerSession") - Assert.Ignore ("TODO: Win32 support generic invokes"); - - if (!AllowTargetInvokes) - return; - - ObjectValue val; - val = Eval ("done.ReturnInt5()"); - Assert.AreEqual ("5", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("done.ReturnSame(3)"); - Assert.AreEqual ("3", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("ReturnSame(4)"); - Assert.AreEqual ("4", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("ReturnSame(\"someString\")"); - Assert.AreEqual ("\"someString\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("ReturnNew<WithToString>()"); - Assert.AreEqual ("{SomeString}", val.Value); - Assert.AreEqual ("WithToString", val.TypeName); - - val = Eval ("intZero"); - Assert.AreEqual ("0", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("intOne"); - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - // TODO: in, out, and ref params are not currently supported - //val = Eval ("Swap (ref intZero, ref intOne)"); - //Assert.AreEqual ("", val.Value); - - //val = Eval ("intZero"); - //Assert.AreEqual ("1", val.Value); - //Assert.AreEqual ("int", val.TypeName); - - //val = Eval ("intOne"); - //Assert.AreEqual ("0", val.Value); - //Assert.AreEqual ("int", val.TypeName); - - //Lets return in same state as before in case some other test will use - //val = Eval ("Swap (ref intZero, ref intOne)"); - //Assert.AreEqual ("", val.Value); - - val = Eval ("GenerateList(\"someString\", 5)"); - Assert.AreEqual ("Count=5", val.Value.Replace (" ", ""));//Remove spaces is for references source and old mono compatiblity - Assert.AreEqual ("System.Collections.Generic.List<string>", val.TypeName); - - val = Eval ("GenerateList(2.0, 6)"); - Assert.AreEqual ("Count=6", val.Value.Replace (" ", ""));//Remove spaces is for references source and old mono compatiblity - Assert.AreEqual ("System.Collections.Generic.List<double>", val.TypeName); - - val = Eval ("done.GetDefault()"); - Assert.AreEqual ("0", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("done.GetParentDefault()"); - Assert.AreEqual ("(null)", val.Value); - Assert.AreEqual ("object", val.TypeName); - - val = Eval ("new Dictionary<int,string>()"); - Assert.AreEqual ("Count=0", val.Value.Replace (" ", ""));//Remove spaces is for references source and old mono compatiblity - Assert.AreEqual ("System.Collections.Generic.Dictionary<int,string>", val.TypeName); - - val = Eval ("done.Property"); - Assert.AreEqual ("54", val.Value); - Assert.AreEqual ("int", val.TypeName); - } - - [Test] - public void Indexers () - { - ObjectValue val = Eval ("numbers[0]"); - Assert.AreEqual ("\"one\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("numbers[1]"); - Assert.AreEqual ("\"two\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("numbers[2]"); - Assert.AreEqual ("\"three\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("staticString[2]"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("'m'", val.Value); - Assert.AreEqual ("char", val.TypeName); - - val = Eval ("alist[0]"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("alist[1]"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"two\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("alist[2]"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("3", val.Value); - Assert.AreEqual ("int", val.TypeName); - - IgnoreCorDebugger("TODO: CorDebugger support explicit interfaces"); - - val = Eval ("FooBar[2]"); - Assert.IsTrue (val.IsUnknown); - //We have IFoo and IBar implementation but without typecasting and determening which implementation user wants - //we have to return error/Unknown instead of random implementation(FooBar[2] is not compilable anyway) - val = Eval ("((IFoo)FooBar)[2]"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("2", val.Value); - val = Eval ("((IBar)FooBar)[2]"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("-2", val.Value); - val = Eval ("Bar[3]"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("-3", val.Value); - val = Eval ("Foo[3]"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("3", val.Value); - } - - void CheckValue (string expected, string actual, bool isSimpleProperty) - { - if (AllowTargetInvokes || isSimpleProperty) - Assert.AreEqual (expected, actual); - else - Assert.AreEqual ("Implicit evaluation is disabled", actual); - } - - [Test] - public void MemberReference () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("\"someString\".Length"); - if (!AllowTargetInvokes && soft == null) { - // Note: this is a simple property which gets evaluated client-side by the SDB backend - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("10", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("numbers.Length"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("3", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("\"someString\".GetHashCode()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("numbers.GetHashCode()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("\"someString\".EndsWith (\"ing\")"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("alist.Count"); - if (!AllowTargetInvokes) { - // Note: this is a simple property which gets evaluated client-side by the SDB backend - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("3", val.Value); - Assert.AreEqual ("int", val.TypeName); - - Eval ("var tt = this"); - - // FIXME: this errors out when target invokes are disabled - if (AllowTargetInvokes) { - val = Eval ("tt.someString"); - Assert.AreEqual ("\"hi\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - } - - val = Eval ("MonoDevelop.Debugger.Tests"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests", val.Value); - Assert.AreEqual ("<namespace>", val.TypeName); - - val = Eval ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - - val = Eval ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.staticString"); - Assert.AreEqual ("\"some static\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("richObject"); - Assert.AreEqual ("{RichClass}", val.Value); - Assert.AreEqual ("RichClass", val.TypeName); - - var richChildren = val.GetAllChildrenSync (); - Assert.AreEqual (13, richChildren.Length); - Assert.AreEqual ("publicInt1", richChildren [0].Name); - Assert.AreEqual ("int", richChildren [0].TypeName); - Assert.AreEqual ("1", richChildren [0].Value); - Assert.AreEqual ("publicInt2", richChildren [1].Name); - Assert.AreEqual ("int", richChildren [1].TypeName); - Assert.AreEqual ("2", richChildren [1].Value); - Assert.AreEqual ("publicInt3", richChildren [2].Name); - Assert.AreEqual ("int", richChildren [2].TypeName); - Assert.AreEqual ("3", richChildren [2].Value); - Assert.AreEqual ("publicPropInt1", richChildren [3].Name); - Assert.AreEqual ("int", richChildren [3].TypeName); - CheckValue ("1", richChildren [3].Value, soft != null); - Assert.AreEqual ("publicPropInt2", richChildren [4].Name); - Assert.AreEqual ("int", richChildren [4].TypeName); - CheckValue ("2", richChildren [4].Value, soft != null); - Assert.AreEqual ("publicPropInt3", richChildren [5].Name); - Assert.AreEqual ("int", richChildren [5].TypeName); - CheckValue ("3", richChildren [5].Value, soft != null); - Assert.AreEqual ("publicPropStringA", richChildren [6].Name); - Assert.AreEqual ("string", richChildren [6].TypeName); - CheckValue ("\"stringA\"", richChildren [6].Value, soft != null); - Assert.AreEqual ("publicPropStringB", richChildren [7].Name); - Assert.AreEqual ("string", richChildren [7].TypeName); - CheckValue ("\"stringB\"", richChildren [7].Value, soft != null); - Assert.AreEqual ("publicPropStringC", richChildren [8].Name); - Assert.AreEqual ("string", richChildren [8].TypeName); - CheckValue ("\"stringC\"", richChildren [8].Value, soft != null); - Assert.AreEqual ("publicStringA", richChildren [9].Name); - Assert.AreEqual ("string", richChildren [9].TypeName); - Assert.AreEqual ("\"stringA\"", richChildren [9].Value); - Assert.AreEqual ("publicStringB", richChildren [10].Name); - Assert.AreEqual ("string", richChildren [10].TypeName); - Assert.AreEqual ("\"stringB\"", richChildren [10].Value); - Assert.AreEqual ("publicStringC", richChildren [11].Name); - Assert.AreEqual ("string", richChildren [11].TypeName); - Assert.AreEqual ("\"stringC\"", richChildren [11].Value); - Assert.AreEqual ("Non-public members", richChildren [12].Name); - - richChildren = richChildren [12].GetAllChildrenSync (); - Assert.AreEqual (12, richChildren.Length); - Assert.AreEqual ("privateInt1", richChildren [0].Name); - Assert.AreEqual ("int", richChildren [0].TypeName); - Assert.AreEqual ("1", richChildren [0].Value); - Assert.AreEqual ("privateInt2", richChildren [1].Name); - Assert.AreEqual ("int", richChildren [1].TypeName); - Assert.AreEqual ("2", richChildren [1].Value); - Assert.AreEqual ("privateInt3", richChildren [2].Name); - Assert.AreEqual ("int", richChildren [2].TypeName); - Assert.AreEqual ("3", richChildren [2].Value); - Assert.AreEqual ("privatePropInt1", richChildren [3].Name); - Assert.AreEqual ("int", richChildren [3].TypeName); - CheckValue ("1", richChildren [3].Value, soft != null); - Assert.AreEqual ("privatePropInt2", richChildren [4].Name); - Assert.AreEqual ("int", richChildren [4].TypeName); - CheckValue ("2", richChildren [4].Value, soft != null); - Assert.AreEqual ("privatePropInt3", richChildren [5].Name); - Assert.AreEqual ("int", richChildren [5].TypeName); - CheckValue ("3", richChildren [5].Value, soft != null); - Assert.AreEqual ("privatePropStringA", richChildren [6].Name); - Assert.AreEqual ("string", richChildren [6].TypeName); - CheckValue ("\"stringA\"", richChildren [6].Value, soft != null); - Assert.AreEqual ("privatePropStringB", richChildren [7].Name); - Assert.AreEqual ("string", richChildren [7].TypeName); - CheckValue ("\"stringB\"", richChildren [7].Value, soft != null); - Assert.AreEqual ("privatePropStringC", richChildren [8].Name); - Assert.AreEqual ("string", richChildren [8].TypeName); - CheckValue ("\"stringC\"", richChildren [8].Value, soft != null); - Assert.AreEqual ("privateStringA", richChildren [9].Name); - Assert.AreEqual ("string", richChildren [9].TypeName); - Assert.AreEqual ("\"stringA\"", richChildren [9].Value); - Assert.AreEqual ("privateStringB", richChildren [10].Name); - Assert.AreEqual ("string", richChildren [10].TypeName); - Assert.AreEqual ("\"stringB\"", richChildren [10].Value); - Assert.AreEqual ("privateStringC", richChildren [11].Name); - Assert.AreEqual ("string", richChildren [11].TypeName); - Assert.AreEqual ("\"stringC\"", richChildren [11].Value); - - if (AllowTargetInvokes) { - val = Eval ("richObject.publicStringB=\"changedTextB\""); - Assert.AreEqual ("string", val.TypeName); - Assert.AreEqual ("\"changedTextB\"", val.Value); - val = Eval ("richObject.publicStringB"); - Assert.AreEqual ("string", val.TypeName); - Assert.AreEqual ("\"changedTextB\"", val.Value); - - val = Eval ("richObject"); - Assert.AreEqual ("{RichClass}", val.Value); - Assert.AreEqual ("RichClass", val.TypeName); - richChildren = val.GetAllChildrenSync (); - Assert.AreEqual ("publicPropStringB", richChildren [7].Name); - Assert.AreEqual ("string", richChildren [7].TypeName); - Assert.AreEqual ("\"stringB\"", richChildren [7].Value); - } - - val = Eval ("numbers.GetLength(0)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("3", val.Value); - Assert.AreEqual ("int", val.TypeName);
- - IgnoreCorDebugger("TODO: CorDebugger support explicit interfaces"); - - val = Eval ("Bar.Prop"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("1", val.Value); - val = Eval ("Foo.Prop"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("2", val.Value); - val = Eval ("FooBar.Prop"); - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("3", val.Value); - val = Eval ("((Bo)FooBar).Prop"); - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("4", val.Value); - val = Eval ("FooBar"); - richChildren = val.GetAllChildrenSync (); - Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.FooBar)", richChildren [0].Name); - Assert.AreEqual ("int", richChildren [0].TypeName); - Assert.AreEqual ("3", richChildren [0].Value); - Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.Bo)", richChildren [1].Name); - Assert.AreEqual ("int", richChildren [1].TypeName); - Assert.AreEqual ("4", richChildren [1].Value); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (richChildren [2].IsImplicitNotSupported); - richChildren [2].Refresh (options); - richChildren [2] = richChildren [2].Sync (); - Assert.IsTrue (richChildren [3].IsImplicitNotSupported); - richChildren [3].Refresh (options); - richChildren [3] = richChildren [3].Sync (); - } - //TODO: Include interface names into sorting - if ("Prop (MonoDevelop.Debugger.Tests.TestApp.IFoo)" == richChildren [2].Name) { - Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.IFoo)", richChildren [2].Name); - Assert.AreEqual ("int", richChildren [2].TypeName); - Assert.AreEqual ("2", richChildren [2].Value); - Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.IBar)", richChildren [3].Name); - Assert.AreEqual ("int", richChildren [3].TypeName); - Assert.AreEqual ("1", richChildren [3].Value); - } else { - Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.IFoo)", richChildren [3].Name); - Assert.AreEqual ("int", richChildren [3].TypeName); - Assert.AreEqual ("2", richChildren [3].Value); - Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.IBar)", richChildren [2].Name); - Assert.AreEqual ("int", richChildren [2].TypeName); - Assert.AreEqual ("1", richChildren [2].Value); - } - } - - [Test] - public void NullableEquality () - { - var val = Eval ("nullableBool == null"); - Assert.AreEqual ("false", val.Value); - - val = Eval ("nullableBool != null"); - Assert.AreEqual ("true", val.Value); - - val = Eval ("nullableBool != false"); - Assert.AreEqual ("true", val.Value); - - val = Eval ("nullableBool == true"); - Assert.AreEqual ("true", val.Value); - } - - [Test] - public void ConditionalExpression () - { - ObjectValue val = Eval ("true ? \"yes\" : \"no\""); - Assert.AreEqual ("\"yes\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("false ? \"yes\" : \"no\""); - Assert.AreEqual ("\"no\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - } - - [Test] - public void Cast () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("(int)19.7"); - Assert.AreEqual ("19", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("(byte)n"); - Assert.AreEqual ("32", val.Value); - Assert.AreEqual ("byte", val.TypeName); - - val = Eval ("(int)n"); - Assert.AreEqual ("32", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("(long)n"); - Assert.AreEqual ("32", val.Value); - Assert.AreEqual ("long", val.TypeName); - - val = Eval ("(float)n"); - Assert.AreEqual ("32", val.Value); - Assert.AreEqual ("float", val.TypeName); - - val = Eval ("(double)n"); - Assert.AreEqual ("32", val.Value); - Assert.AreEqual ("double", val.TypeName); - - val = Eval ("(string)staticString"); - Assert.AreEqual ("\"some static\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("(int)numbers"); - Assert.IsTrue (val.IsError); - - val = Eval ("(int)this"); - Assert.IsTrue (val.IsError); - - val = Eval ("(C)a"); - Assert.IsTrue (val.IsError); - - val = Eval ("(C)b"); - Assert.IsTrue (val.IsError); - - val = Eval ("(C)c"); - Assert.AreEqual ("{C}", val.Value); - Assert.AreEqual ("C", val.TypeName); - - val = Eval ("(B)a"); - Assert.IsTrue (val.IsError); - - val = Eval ("(B)b"); - Assert.AreEqual ("{B}", val.Value); - Assert.AreEqual ("B", val.TypeName); - - val = Eval ("(B)c"); - Assert.AreEqual ("{C}", val.Value); - Assert.AreEqual ("C", val.TypeName); - - val = Eval ("(A)a"); - Assert.AreEqual ("{A}", val.Value); - Assert.AreEqual ("A", val.TypeName); - - val = Eval ("(A)b"); - Assert.AreEqual ("{B}", val.Value); - Assert.AreEqual ("B", val.TypeName); - - val = Eval ("(A)c"); - Assert.AreEqual ("{C}", val.Value); - Assert.AreEqual ("C", val.TypeName); - - // Try cast - - val = Eval ("c as A"); - Assert.AreEqual ("{C}", val.Value); - Assert.AreEqual ("C", val.TypeName); - - val = Eval ("c as B"); - Assert.AreEqual ("{C}", val.Value); - Assert.AreEqual ("C", val.TypeName); - - val = Eval ("c as C"); - Assert.AreEqual ("{C}", val.Value); - Assert.AreEqual ("C", val.TypeName); - - val = Eval ("b as A"); - Assert.AreEqual ("{B}", val.Value); - Assert.AreEqual ("B", val.TypeName); - - val = Eval ("b as B"); - Assert.AreEqual ("{B}", val.Value); - Assert.AreEqual ("B", val.TypeName); - - val = Eval ("b as C"); - Assert.AreEqual ("null", val.Value); - Assert.AreEqual ("C", val.TypeName); - - val = Eval ("a as A"); - Assert.AreEqual ("{A}", val.Value); - Assert.AreEqual ("A", val.TypeName); - - val = Eval ("a as B"); - Assert.AreEqual ("null", val.Value); - Assert.AreEqual ("B", val.TypeName); - - val = Eval ("a as C"); - Assert.AreEqual ("null", val.Value); - Assert.AreEqual ("C", val.TypeName); - - val = Eval ("a as string"); - Assert.AreEqual ("null", val.Value); - Assert.AreEqual ("System.String", val.TypeName); - - - // Is operator - - val = Eval ("c is A"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("c is B"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("c is C"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("b is A"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("b is B"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("b is C"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("a is A"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("a is B"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("a is C"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("a is string"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - // Enum cast - - val = Eval ("(int)SomeEnum.two"); - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("(long)SomeEnum.two"); - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("long", val.TypeName); - - val = Eval ("(SomeEnum)2"); - Assert.AreEqual ("SomeEnum.two", val.Value); - Assert.AreEqual ("two", val.DisplayValue); - Assert.AreEqual ("SomeEnum", val.TypeName); - - val = Eval ("(SomeEnum)3"); - Assert.AreEqual ("SomeEnum.one | SomeEnum.two", val.Value); - Assert.AreEqual ("one | two", val.DisplayValue); - Assert.AreEqual ("SomeEnum", val.TypeName); - - IgnoreCorDebugger ("CorDebugger: Implicit casting"); - - // Casting primitive <-> custom class via implicit operator - val = Eval ("(myNint)3"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("{3}", val.Value); - Assert.AreEqual ("myNint", val.TypeName); - - val = Eval ("(int)(myNint)4"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("4", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("TestCastingArgument(4)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"4\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("new RichClass(5).publicPropInt1"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("5", val.Value); - Assert.AreEqual ("int", val.TypeName); - } - - [Test] - public void BinaryOperators () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - // Boolean - - val = Eval ("true && true"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("true && false"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("false && true"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("false && false"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("false || false"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("false || true"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("true || false"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("true || true"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("false || 1"); - Assert.IsTrue (val.IsError); - - val = Eval ("1 || true"); - Assert.IsTrue (val.IsError); - - val = Eval ("true && 1"); - Assert.IsTrue (val.IsError); - - val = Eval ("1 && true"); - Assert.IsTrue (val.IsError); - - // Concat string - - val = Eval ("\"a\" + \"b\""); - Assert.AreEqual ("\"ab\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("\"a\" + 2"); - Assert.AreEqual ("\"a2\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("2 + \"a\""); - Assert.AreEqual ("\"2a\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("this + \"a\""); - Assert.AreEqual ("\"MonoDevelop.Debugger.Tests.TestApp.TestEvaluationChilda\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - // Equality - - val = Eval ("2 == 2"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("2 == 3"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("(long)2 == (int)2"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("SomeEnum.two == SomeEnum.one"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("SomeEnum.one != SomeEnum.one"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - // Arithmetic - - val = Eval ("2 + 3"); - Assert.AreEqual ("5", val.Value); - - val = Eval ("2 + 2 == 4"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("(2 * 1.5f) / 2"); - Assert.AreEqual ("1.5", val.Value); - Assert.AreEqual ("float", val.TypeName); - } - - [Test] - public void BinaryOperatorOverrides () - { - ObjectValue val; - - if (!AllowTargetInvokes) - return; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("Requires a newer version of the Mono runtime."); - - val = Eval ("ops1 == ops3"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("ops1 != ops3"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("ops2 == ops3"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("ops2 != ops3"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("ops1 <= ops2"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("ops1 < ops2"); - Assert.AreEqual ("true", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("ops1 >= ops2"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("ops1 > ops2"); - Assert.AreEqual ("false", val.Value); - Assert.AreEqual ("bool", val.TypeName); - - val = Eval ("ops1 + ops2"); - Assert.AreEqual ("{[BinaryOperatorOverrides 3]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops1 - ops2"); - Assert.AreEqual ("{[BinaryOperatorOverrides -1]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops1 * ops2"); - Assert.AreEqual ("{[BinaryOperatorOverrides 2]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops2 / ops1"); - Assert.AreEqual ("{[BinaryOperatorOverrides 2]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops1 % ops2"); - Assert.AreEqual ("{[BinaryOperatorOverrides 1]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops1 & ops2"); - Assert.AreEqual ("{[BinaryOperatorOverrides 0]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops1 | ops2"); - Assert.AreEqual ("{[BinaryOperatorOverrides 3]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops1 ^ ops2"); - Assert.AreEqual ("{[BinaryOperatorOverrides 3]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops1 << 1"); - Assert.AreEqual ("{[BinaryOperatorOverrides 2]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - - val = Eval ("ops2 >> 1"); - Assert.AreEqual ("{[BinaryOperatorOverrides 1]}", val.Value); - Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName); - } - - void AssertAssignment (string assignment, string variable, string value, string type) - { - ObjectValue val; - - val = Eval (assignment); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - - Assert.AreEqual (value, val.Value); - Assert.AreEqual (type, val.TypeName); - - val = Eval (variable); - if (!AllowTargetInvokes && val.IsImplicitNotSupported) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - val.Refresh (options); - val = val.Sync (); - } - - Assert.AreEqual (value, val.Value); - Assert.AreEqual (type, val.TypeName); - } - - [Test] - public void MethodParameters () - { - ObjectValue val; - val = Eval ("stringParam"); - Assert.AreEqual ("\"testString\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - val = Eval ("intParam"); - Assert.AreEqual ("55", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("intParam2"); - Assert.AreEqual ("66", val.Value); - Assert.AreEqual ("int", val.TypeName); - } - - [Test] - public virtual void Assignment () - { - AssertAssignment ("n = 6", "n", "6", "int"); - AssertAssignment ("n = 32", "n", "32", "int"); - - AssertAssignment ("someString = \"test\"", "someString", "\"test\"", "string"); - AssertAssignment ("someString = \"hi\"", "someString", "\"hi\"", "string"); - - AssertAssignment ("numbers[0] = \"test\"", "numbers[0]", "\"test\"", "string"); - AssertAssignment ("numbers[0] = \"one\"", "numbers[0]", "\"one\"", "string"); - - AssertAssignment ("alist[0] = 6", "alist[0]", "6", "int"); - AssertAssignment ("alist[0] = 1", "alist[0]", "1", "int"); - - AssertAssignment ("ProtectedStringProperty = \"test\"", "ProtectedStringProperty", "\"test\"", "string"); - AssertAssignment ("ProtectedStringProperty = \"hi\"", "ProtectedStringProperty", "\"hi\"", "string"); - } - - [Test] - public virtual void AssignmentStatic () - { - AssertAssignment ("staticString = \"test\"", "staticString", "\"test\"", "string"); - AssertAssignment ("staticString = \"some static\"", "staticString", "\"some static\"", "string"); - } - - [Test] - public void FormatBool () - { - ObjectValue val; - - val = Eval ("true"); - Assert.AreEqual ("true", val.Value); - - val = Eval ("false"); - Assert.AreEqual ("false", val.Value); - } - - [Test] - public void FormatNumber () - { - ObjectValue val; - val = Eval ("(int)123"); - Assert.AreEqual ("123", val.Value); - val = Eval ("(int)-123"); - Assert.AreEqual ("-123", val.Value); - - val = Eval ("(long)123"); - Assert.AreEqual ("123", val.Value); - val = Eval ("(long)-123"); - Assert.AreEqual ("-123", val.Value); - - val = Eval ("(byte)123"); - Assert.AreEqual ("123", val.Value); - - val = Eval ("(uint)123"); - Assert.AreEqual ("123", val.Value); - - val = Eval ("(ulong)123"); - Assert.AreEqual ("123", val.Value); - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - return; - - val = Eval ("dec"); - Assert.AreEqual ("123.456", val.Value); - } - - [Test] - public void FormatString () - { - ObjectValue val; - val = Eval ("\"hi\""); - Assert.AreEqual ("\"hi\"", val.Value); - - val = Eval ("EscapedStrings"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\" \\\" \\\\ \\a \\b \\f \\v \\n \\r \\t\"", val.Value); - - val = Eval ("\" \\\" \\\\ \\a \\b \\f \\v \\n \\r \\t\""); - Assert.AreEqual ("\" \\\" \\\\ \\a \\b \\f \\v \\n \\r \\t\"", val.Value); - } - - [Test] - public void FormatChar () - { - ObjectValue val; - val = Eval ("'A'"); - Assert.AreEqual ("'A'", val.Value); - Assert.AreEqual ("65 'A'", val.DisplayValue); - - val = Eval ("'\\0'"); - Assert.AreEqual ("'\\0'", val.Value); - Assert.AreEqual ("0 '\\0'", val.DisplayValue); - - val = Eval ("'\"'"); - Assert.AreEqual ("'\"'", val.Value); - Assert.AreEqual ("34 '\"'", val.DisplayValue); - - val = Eval ("'\\''"); - Assert.AreEqual ("'\\''", val.Value); - Assert.AreEqual ("39 '\\''", val.DisplayValue); - - val = Eval ("'\\\\'"); - Assert.AreEqual ("'\\\\'", val.Value); - Assert.AreEqual ("92 '\\\\'", val.DisplayValue); - - val = Eval ("'\\a'"); - Assert.AreEqual ("'\\a'", val.Value); - Assert.AreEqual ("7 '\\a'", val.DisplayValue); - - val = Eval ("'\\b'"); - Assert.AreEqual ("'\\b'", val.Value); - Assert.AreEqual ("8 '\\b'", val.DisplayValue); - - val = Eval ("'\\f'"); - Assert.AreEqual ("'\\f'", val.Value); - Assert.AreEqual ("12 '\\f'", val.DisplayValue); - - val = Eval ("'\\v'"); - Assert.AreEqual ("'\\v'", val.Value); - Assert.AreEqual ("11 '\\v'", val.DisplayValue); - - val = Eval ("'\\n'"); - Assert.AreEqual ("'\\n'", val.Value); - Assert.AreEqual ("10 '\\n'", val.DisplayValue); - - val = Eval ("'\\r'"); - Assert.AreEqual ("'\\r'", val.Value); - Assert.AreEqual ("13 '\\r'", val.DisplayValue); - - val = Eval ("'\\t'"); - Assert.AreEqual ("'\\t'", val.Value); - Assert.AreEqual ("9 '\\t'", val.DisplayValue); - } - - [Test] - public void FormatObject () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("c"); - Assert.AreEqual ("{C}", val.Value); - Assert.AreEqual ("C", val.TypeName); - - val = Eval ("withDisplayString"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.AreEqual ("{WithDisplayString}", val.Value); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("Some one Value 2 End", val.Value); - Assert.AreEqual ("WithDisplayString", val.TypeName); - - val = Eval ("withProxy"); - Assert.AreEqual ("{WithProxy}", val.Value); - Assert.AreEqual ("WithProxy", val.TypeName); - -/* val = Eval ("withToString"); - Assert.AreEqual ("{SomeString}", val.Value); - Assert.AreEqual ("WithToString", val.TypeName);*/ - } - - [Test] - public void FormatArray () - { - ObjectValue val; - - val = Eval ("numbers"); - Assert.AreEqual ("{string[3]}", val.Value); - Assert.AreEqual ("string[]", val.TypeName); - - val = Eval ("numbersArrays"); - Assert.AreEqual ("{int[2][]}", val.Value); - Assert.AreEqual ("int[][]", val.TypeName); - - IgnoreCorDebugger ("Randomly fails"); - - val = Eval ("arrayWithLowerBounds"); - Assert.AreEqual ("int[,,]", val.TypeName); - Assert.AreEqual ("{int[3,4,5]}", val.Value); - - val = Eval ("numbersMulti"); - Assert.AreEqual ("{int[3,4,5]}", val.Value); - Assert.AreEqual ("int[,,]", val.TypeName); - Assert.IsFalse (val.IsNull); - - val = Eval ("nulledByteArray"); - Assert.AreEqual ("(null)", val.Value); - Assert.AreEqual ("byte[]", val.TypeName); - Assert.IsTrue (val.IsNull); - } - - [Test] - public void FormatGeneric () - { - ObjectValue val; - - try { - Session.Options.EvaluationOptions.AllowTargetInvoke = false; - val = Eval ("dict"); - } finally { - Session.Options.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes; - } - Assert.AreEqual ("{System.Collections.Generic.Dictionary<int,string[]>}", val.Value); - Assert.AreEqual ("System.Collections.Generic.Dictionary<int,string[]>", val.TypeName); - - try { - Session.Options.EvaluationOptions.AllowTargetInvoke = false; - val = Eval ("dictArray"); - } finally { - Session.Options.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes; - } - Assert.AreEqual ("{System.Collections.Generic.Dictionary<int,string[]>[2,3]}", val.Value); - Assert.AreEqual ("System.Collections.Generic.Dictionary<int,string[]>[,]", val.TypeName); - - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - return; - - val = Eval ("thing.done"); - Assert.AreEqual ("{Thing<string>.Done<int>[1]}", val.Value); - Assert.AreEqual ("Thing<string>.Done<int>[]", val.TypeName); - - val = Eval ("done"); - Assert.AreEqual ("{Thing<string>.Done<int>}", val.Value); - Assert.AreEqual ("Thing<string>.Done<int>", val.TypeName); - } - - [Test] - public void FormatEnum () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("SomeEnum.one"); - Assert.AreEqual ("SomeEnum.one", val.Value); - Assert.AreEqual ("one", val.DisplayValue); - - val = Eval ("SomeEnum.two"); - Assert.AreEqual ("SomeEnum.two", val.Value); - Assert.AreEqual ("two", val.DisplayValue); - - val = Eval ("SomeEnum.one | SomeEnum.two"); - Assert.AreEqual ("SomeEnum.one | SomeEnum.two", val.Value); - Assert.AreEqual ("one | two", val.DisplayValue); - } - - [Test] - public void LambdaInvoke () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("action"); - Assert.AreEqual ("{System.Action}", val.Value); - Assert.AreEqual ("System.Action", val.TypeName); - - val = Eval ("modifyInLamda"); - Assert.AreEqual ("\"modified\"", val.Value); - Assert.AreEqual ("string", val.TypeName); - - } - - [Test] - public void Structures () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("simpleStruct"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.AreEqual ("{SimpleStruct}", val.Value); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("{str 45 }", val.Value); - Assert.AreEqual ("SimpleStruct", val.TypeName); - - val = Eval ("nulledSimpleStruct"); - Assert.AreEqual ("null", val.Value); - Assert.AreEqual ("SimpleStruct?", val.TypeName); - } - - [Test] - [Ignore ("TODO")] - public void SdbFailingTests () - { - ObjectValue val; - - val = Eval ("base.TestMethodBase (\"23\")"); - Assert.AreEqual ("25", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("base.TestMethodBase (42)"); - Assert.AreEqual ("44", val.Value); - Assert.AreEqual ("int", val.TypeName); - - //When fixed put into TypeReferenceGeneric - val = Eval ("Dictionary<string,NestedClass>"); - Assert.AreEqual ("System.Collections.Generic.Dictionary<string,MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass>", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - //When fixed put into TypeReferenceGeneric - val = Eval ("NestedGenericClass<int,string>"); - Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedGenericClass<int,string>", val.Value); - Assert.AreEqual ("<type>", val.TypeName); - Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - - } - - [Test] - public void ObjectCreation () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("new A().ConstructedBy"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"NoArg\"", val.Value); - - val = Eval ("new A(7).ConstructedBy"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"IntArg\"", val.Value); - - val = Eval ("new A(\"someString\").ConstructedBy"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"StringArg\"", val.Value); - } - - [Test] - public void StructCreation () - { - if (!AllowTargetInvokes) - return; - - var soft = Session as SoftDebuggerSession; - - if (soft == null) - Assert.Ignore ("TODO: Win32 support generic invokes"); - - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Inconclusive ("A newer version of the Mono runtime is required."); - - ObjectValue val; - - val = Eval ("new SimpleStruct()"); - Assert.AreEqual ("SimpleStruct", val.TypeName); - } - - [Test] - public void Inheriting () - { - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("a.Prop"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("a.PropNoVirt1"); - if (!AllowTargetInvokes && soft == null) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("a.PropNoVirt2"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("a.IntField"); - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("a.TestMethod ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("a.TestMethod (\"23\")"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("24", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("a.TestMethod (42)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("43", val.Value); - Assert.AreEqual ("int", val.TypeName); - - if (soft != null && soft.ProtocolVersion < new Version (2, 40)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("b.Prop"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("((B)b).PropNoVirt1"); - if (!AllowTargetInvokes && soft == null) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("((B)b).PropNoVirt2"); - if (!AllowTargetInvokes && soft == null) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("((B)b).IntField"); - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("this.TestMethodBase ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("this.TestMethodBase (\"23\")"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("24", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("this.TestMethodBase (42)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("43", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("this.TestMethodBaseNotOverrided ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("TestMethodBase ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("TestMethodBase (\"23\")"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("24", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("TestMethodBase (42)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("43", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("TestMethodBaseNotOverrided ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("b.TestMethod (\"23\")"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("25", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("base.TestMethodBaseNotOverrided ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval("base.TestMethodBase ()"); - if (!AllowTargetInvokes)
- { - var options = Session.Options.EvaluationOptions.Clone(); - options.AllowTargetInvoke = true; - - Assert.IsTrue(val.IsImplicitNotSupported); - val.Refresh(options); - val = val.Sync(); - } - Assert.AreEqual("2", val.Value); - Assert.AreEqual("int", val.TypeName); - - IgnoreCorDebugger("Not working on CorDebugger"); - - val = Eval("b.PropNoVirt2"); - if (!AllowTargetInvokes)
- { - var options = Session.Options.EvaluationOptions.Clone(); - options.AllowTargetInvoke = true; - - Assert.IsTrue(val.IsImplicitNotSupported); - val.Refresh(options); - val = val.Sync(); - } - Assert.AreEqual("1", val.Value); - Assert.AreEqual("int", val.TypeName); - - val = Eval("b.IntField"); - Assert.AreEqual("1", val.Value); - Assert.AreEqual("int", val.TypeName);
-
- val = Eval("b.PropNoVirt1"); - if (!AllowTargetInvokes && soft == null)
- { - var options = Session.Options.EvaluationOptions.Clone(); - options.AllowTargetInvoke = true; - - Assert.IsTrue(val.IsImplicitNotSupported); - val.Refresh(options); - val = val.Sync(); - } - Assert.AreEqual("1", val.Value); - Assert.AreEqual("int", val.TypeName); - - val = Eval ("System.Text.Encoding.UTF8.GetPreamble ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("byte[]", val.TypeName); - Assert.AreEqual ("{byte[3]}", val.Value); - var bytes = ((RawValueArray)val.GetRawValue ()).ToArray (); - Assert.AreEqual (239, bytes.GetValue (0)); - Assert.AreEqual (187, bytes.GetValue (1)); - Assert.AreEqual (191, bytes.GetValue (2)); - - val = Eval ("b.TestMethod ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - - val = Eval ("b.TestMethod (42)"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("43", val.Value); - Assert.AreEqual ("int", val.TypeName); - } - - [Test] - public void Lists () - { - ObjectValue[] children; - ObjectValue val; - - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - val = Eval ("dict"); - children = val.GetAllChildrenSync (); - - if (AllowTargetInvokes) { - // AllowTargetInvokes also allows debugger proxies - Assert.AreEqual (2, children.Length); - Assert.AreEqual ("[0]", children [0].Name); - Assert.AreEqual ("{[5, System.String[]]}", children [0].Value); - Assert.AreEqual ("Raw View", children [1].Name); - - children = children [0].GetAllChildrenSync (); - Assert.AreEqual ("Key", children [0].Name); - Assert.AreEqual ("5", children [0].Value); - Assert.AreEqual ("int", children [0].TypeName); - Assert.AreEqual ("Value", children [1].Name); - Assert.AreEqual ("{string[2]}", children [1].Value); - - children = children [1].GetAllChildrenSync (); - Assert.AreEqual ("\"a\"", children [0].Value); - Assert.AreEqual ("string", children [0].TypeName); - Assert.AreEqual ("\"b\"", children [1].Value); - } else { - // when AllowTargetInvokes is disabled, it also disables debugger proxies - Assert.AreEqual (18, children.Length); - Assert.AreEqual ("Comparer", children [0].Name); - Assert.AreEqual ("Static members", children [15].Name); - Assert.AreEqual ("Non-public members", children [16].Name); - Assert.AreEqual ("IEnumerator", children [17].Name); - } - - val = Eval ("stringList"); - children = val.GetAllChildrenSync (); - - if (AllowTargetInvokes) { - // AllowTargetInvokes also allows debugger proxies - Assert.AreEqual (4, children.Length); - Assert.AreEqual ("[0]", children [0].Name); - Assert.AreEqual ("[1]", children [1].Name); - Assert.AreEqual ("[2]", children [2].Name); - Assert.AreEqual ("Raw View", children [3].Name); - Assert.AreEqual ("\"aaa\"", children [0].Value); - Assert.AreEqual ("\"bbb\"", children [1].Value); - Assert.AreEqual ("\"ccc\"", children [2].Value); - } else { - // when AllowTargetInvokes is disabled, it also disables debugger proxies - Assert.AreEqual (10, children.Length); - Assert.AreEqual ("Capacity", children [0].Name); - Assert.AreEqual ("Static members", children [7].Name); - Assert.AreEqual ("Non-public members", children [8].Name); - Assert.AreEqual ("IEnumerator", children [9].Name); - } - - val = Eval ("alist"); - children = val.GetAllChildrenSync (); - - if (AllowTargetInvokes) { - // AllowTargetInvokes also allows debugger proxies - Assert.AreEqual (4, children.Length); - Assert.AreEqual ("[0]", children [0].Name); - Assert.AreEqual ("[1]", children [1].Name); - Assert.AreEqual ("[2]", children [2].Name); - Assert.AreEqual ("Raw View", children [3].Name); - Assert.AreEqual ("1", children [0].Value); - Assert.AreEqual ("\"two\"", children [1].Value); - Assert.AreEqual ("3", children [2].Value); - } else { - // when AllowTargetInvokes is disabled, it also disables debugger proxies - Assert.AreEqual (9, children.Length); - Assert.AreEqual ("Capacity", children [0].Name); - Assert.AreEqual ("Count", children [1].Name); - Assert.AreEqual ("IsFixedSize", children [2].Name); - Assert.AreEqual ("IsReadOnly", children [3].Name); - Assert.AreEqual ("IsSynchronized", children [4].Name); - Assert.AreEqual ("SyncRoot", children [5].Name); - Assert.AreEqual ("Static members", children [6].Name); - Assert.AreEqual ("Non-public members", children [7].Name); - Assert.AreEqual ("IEnumerator", children [8].Name); - } - } - - [Test] - [Ignore ("TODO: Evaluating dynamic objects")] - public void DynamicObjects () - { - ObjectValue val; - val = Eval ("dynObj.someInt"); - Assert.AreEqual ("dynamic {int}", val.TypeName); - Assert.AreEqual ("53", val.Value); - - val = Eval ("dynObj.someString"); - Assert.AreEqual ("dynamic {string}", val.TypeName); - Assert.AreEqual ("\"Hello dynamic objects!\"", val.Value); - } - - [Test] - public void GetTypeTest () - { - if (Session.GetType ().Name == "CorDebuggerSession") { - Assert.Ignore ("TODO: GetType() is not implemented in CorDebugger"); - } - ObjectValue val; - val = Eval ("a.GetType()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.IsTrue (val.TypeName == "System.MonoType" || val.TypeName == "System.RuntimeType", "Incorrect type name: " + val.TypeName); - Assert.AreEqual ("{A}", val.Value); - - val = Eval ("this.GetType()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsImplicitNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.IsTrue (val.TypeName == "System.MonoType" || val.TypeName == "System.RuntimeType", "Incorrect type name: " + val.TypeName); - Assert.AreEqual ("{MonoDevelop.Debugger.Tests.TestApp.TestEvaluationChild}", val.Value); - } - - [Test] - [Ignore ("Operator \"is\" is not implemented")] - public void IsOperatorTest () - { - ObjectValue val; - val = Eval ("b is A"); - Assert.AreEqual ("bool", val.TypeName); - Assert.AreEqual ("true", val.Value); - - val = Eval ("b is B"); - Assert.AreEqual ("bool", val.TypeName); - Assert.AreEqual ("true", val.Value); - - val = Eval ("b is C"); - Assert.AreEqual ("bool", val.TypeName); - Assert.AreEqual ("false", val.Value); - } - - [Test] - public void DebugDisplayTest () - { - ObjectValue val; - if (AllowTargetInvokes) { - val = Eval ("debugDisplayMethodTest"); - Assert.AreEqual ("DebuggerDisplayMethodTest", val.TypeName); - Assert.AreEqual ("First Int:32 Second Int:43", val.Value); - } - } - - [Test] - public void ArrayTests () - { - ObjectValue val; - - val = Eval ("numbersMulti[1,2,3]"); - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("133", val.Value); - - val = Eval ("numbersArrays[0][7]"); - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("24", val.Value); - - val = Eval ("arrayWithLowerBounds[5,6,7]"); - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("114", val.Value); - - if (AllowTargetInvokes) { - val = Eval ("arrayWithLowerBounds.GetValue(5,6,7)"); - Assert.AreEqual ("int", val.TypeName); - Assert.AreEqual ("114", val.Value); - } - - var children = Eval ("arrayWithLowerBounds").GetAllChildrenSync (); - Assert.AreEqual ("[5, ...]", children [0].Name); - } - } -} diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj index 1693728b7b..a1f9144212 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\..\..\..\MonoDevelop.props" /> <PropertyGroup> @@ -38,17 +38,11 @@ <Reference Include="System.Core" /> </ItemGroup> <ItemGroup> - <Compile Include="DebugTests.cs" /> - <Compile Include="SdbEvaluationTests.cs" /> - <Compile Include="EvaluationTests.cs" /> - <Compile Include="StackFrameTests.cs" /> - <Compile Include="SdbStackFrameTests.cs" /> - <Compile Include="CorEvaluationTests.cs" /> - <Compile Include="CorStackFrameTests.cs" /> - <Compile Include="BreakpointsAndSteppingTests.cs" /> - <Compile Include="CorBreakpointsAndSteppingTests.cs" /> - <Compile Include="SdbBreakpointsAndSteppingTests.cs" /> - <Compile Include="AdvancedEvaluationTests.cs" /> + <Compile Include="..\..\..\..\external\debugger-libs\UnitTests\Mono.Debugging.Tests\Shared\*.cs"> + <Link>Shared\Placeholder</Link> + </Compile> + <Compile Include="DebugTests.MonoDevelop.cs" /> + <Compile Include="TextFile.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\MonoDevelop.Debugger.csproj"> @@ -66,7 +60,7 @@ <Name>MonoDevelop.Ide</Name> <Private>False</Private> </ProjectReference> - <ProjectReference Include="..\MonoDevelop.Debugger.Tests.TestApp\MonoDevelop.Debugger.Tests.TestApp.csproj"> + <ProjectReference Include="..\..\..\..\external\debugger-libs\UnitTests\MonoDevelop.Debugger.Tests.TestApp\MonoDevelop.Debugger.Tests.TestApp.csproj"> <Project>{05EDFE55-C8D1-47E4-BB61-0BC809CD82E2}</Project> <Name>MonoDevelop.Debugger.Tests.TestApp</Name> <Private>False</Private> diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbBreakpointsAndSteppingTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbBreakpointsAndSteppingTests.cs deleted file mode 100644 index 0b63c22913..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbBreakpointsAndSteppingTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -//
-// SdbBreakpointsAndSteppingTests.cs
-//
-// Author:
-// David Karlaš <david.karlas@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using NUnit.Framework;
-
-namespace MonoDevelop.Debugger.Tests.Soft
-{
- [TestFixture]
- [Ignore("Sdb has many failings until resolved ignore all")]
- public class SdbBreakpointsAndSteppingTests: BreakpointsAndSteppingTests
- {
- public SdbBreakpointsAndSteppingTests () : base ("Mono.Debugger.Soft")
- {
- }
- }
-}
-
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbEvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbEvaluationTests.cs deleted file mode 100644 index d475c985d9..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbEvaluationTests.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// SdbEvaluationTests.cs -// -// Author: -// Lluis Sanchez Gual <lluis@novell.com> -// -// Copyright (c) 2009 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using NUnit.Framework; - -namespace MonoDevelop.Debugger.Tests.Soft -{ - [TestFixture] - public class SdbEvaluationAllowTargetInvokesTests: EvaluationTests - { - public SdbEvaluationAllowTargetInvokesTests (): base ("Mono.Debugger.Soft", true) - { - } - } - - [TestFixture] - public class SdbEvaluationNoTargetInvokesTests: EvaluationTests - { - public SdbEvaluationNoTargetInvokesTests (): base ("Mono.Debugger.Soft", false) - { - } - } -} diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbStackFrameTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbStackFrameTests.cs deleted file mode 100644 index 4ce7bf1490..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbStackFrameTests.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// SdbStackFrameTests.cs -// -// Author: -// Lluis Sanchez Gual <lluis@novell.com> -// -// Copyright (c) 2010 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using NUnit.Framework; - -namespace MonoDevelop.Debugger.Tests.Soft -{ - [TestFixture] - public class SdbStackFrameAllowTargetInvokesTests : StackFrameTests - { - public SdbStackFrameAllowTargetInvokesTests (): base ("Mono.Debugger.Soft", true) - { - } - } - - [TestFixture] - public class SdbStackFrameNoTargetInvokesTests : StackFrameTests - { - public SdbStackFrameNoTargetInvokesTests (): base ("Mono.Debugger.Soft", false) - { - } - } -} diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/StackFrameTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/StackFrameTests.cs deleted file mode 100644 index 79fa7ca824..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/StackFrameTests.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// StackFrameTests.cs -// -// Author: -// Lluis Sanchez Gual <lluis@novell.com> -// -// Copyright (c) 2010 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -using Mono.Debugging.Soft; -using Mono.Debugging.Client; - -using NUnit.Framework; - -namespace MonoDevelop.Debugger.Tests -{ - [TestFixture] - public abstract class StackFrameTests: DebugTests - { - protected StackFrameTests (string de, bool allowTargetInvoke): base (de) - { - AllowTargetInvokes = allowTargetInvoke; - } - - [TestFixtureSetUp] - public override void SetUp () - { - base.SetUp (); - - Start ("TestEvaluation"); - } - - [Test] - public void VirtualProperty () - { - var soft = Session as SoftDebuggerSession; - if (soft != null && soft.ProtocolVersion < new Version (2, 31)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - - var ops = EvaluationOptions.DefaultOptions.Clone (); - ops.FlattenHierarchy = false; - - ObjectValue val = Frame.GetExpressionValue ("c", ops); - Assert.IsNotNull (val); - val = val.Sync (); - Assert.IsFalse (val.IsError); - Assert.IsFalse (val.IsUnknown); - - // The C class does not have a Prop property - - ObjectValue prop = val.GetChildSync ("Prop", ops); - Assert.IsNull (prop); - - prop = val.GetChildSync ("PropNoVirt1", ops); - Assert.IsNull (prop); - - prop = val.GetChildSync ("PropNoVirt2", ops); - Assert.IsNull (prop); - - val = val.GetChildSync ("base", ops); - Assert.IsNotNull (val); - val.WaitHandle.WaitOne (); - Assert.IsFalse (val.IsError); - Assert.IsFalse (val.IsUnknown); - - // The B class has a Prop property, value is 2 - - prop = val.GetChildSync ("Prop", ops); - Assert.IsNotNull (prop); - Assert.AreEqual ("2", prop.Value); - - prop = val.GetChildSync ("PropNoVirt1", ops); - Assert.IsNotNull (prop); - Assert.AreEqual ("2", prop.Value); - - prop = val.GetChildSync ("PropNoVirt2", ops); - Assert.IsNotNull (prop); - Assert.AreEqual ("2", prop.Value); - - val = val.GetChildSync ("base", ops); - Assert.IsNotNull (val); - val.WaitHandle.WaitOne (); - Assert.IsFalse (val.IsError); - Assert.IsFalse (val.IsUnknown); - - // The A class has a Prop property, value is 1, but must return 2 becasue it is overriden - - prop = val.GetChildSync ("Prop", ops); - Assert.IsNotNull (prop); - Assert.AreEqual ("2", prop.Value); - - prop = val.GetChildSync ("PropNoVirt1", ops); - Assert.IsNotNull (prop); - Assert.AreEqual ("1", prop.Value); - - prop = val.GetChildSync ("PropNoVirt2", ops); - Assert.IsNotNull (prop); - Assert.AreEqual ("1", prop.Value); - } - } -} diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/TextFile.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/TextFile.cs new file mode 100644 index 0000000000..4a674bf417 --- /dev/null +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/TextFile.cs @@ -0,0 +1,77 @@ +using MDTextFile = MonoDevelop.Projects.Text.TextFile;
+
+namespace Mono.Debugging.Tests
+{
+ public class TextFile : ITextFile
+ {
+ readonly MDTextFile file;
+
+ public TextFile (MDTextFile file)
+ {
+ this.file = file;
+ }
+
+ /// <summary>
+ /// Content of the file
+ /// </summary>
+ public string Text
+ {
+ get{
+ return file.Text;
+ }
+ }
+
+ /// <summary>
+ /// Full path to file
+ /// </summary>
+ public string Name
+ {
+ get{
+ return file.Name;
+ }
+ }
+
+ /// <summary>
+ /// Returns line and column (1-based) by given offset (0-based)
+ /// </summary>
+ /// <param name="offset">0-based</param>
+ /// <param name="line">1-based</param>
+ /// <param name="col">1-based</param>
+ public void GetLineColumnFromPosition (int offset, out int line, out int col)
+ {
+ file.GetLineColumnFromPosition (offset, out line, out col);
+ }
+
+ /// <summary>
+ /// Returns offset by given line and column (1-based)
+ /// </summary>
+ /// <param name="line">line (1-based)</param>
+ /// <param name="column">column (1-based)</param>
+ /// <returns>offset (0-based)</returns>
+ public int GetPositionFromLineColumn (int line, int column)
+ {
+ return file.GetPositionFromLineColumn (line, column);
+ }
+
+ /// <summary>
+ /// Returns the text starting from <paramref name="offset"/> with length=<paramref name="length"/>
+ /// </summary>
+ /// <param name="offset">0-based starting offset</param>
+ /// <param name="length">length of text</param>
+ /// <returns></returns>
+ public string GetText (int offset, int length)
+ {
+ return file.GetText (offset, length);
+ }
+
+ /// <summary>
+ /// Returns length of the given line (1-based)
+ /// </summary>
+ /// <param name="line">1-based line</param>
+ /// <returns></returns>
+ public int GetLineLength (int line)
+ {
+ return file.GetLineLength (line);
+ }
+ }
+}
\ No newline at end of file |