public void Defect_1467570_Crash_In_Debug_Mode() { string src = @" class Test { IntArray : int[]; constructor FirstApproach(intArray : int[]) { IntArray = intArray; } def Transform(adjust : int) { return = Test.FirstApproach(this.IntArray + adjust); } } myTest = Test.FirstApproach({ 1, 2 }); myNeTwst = myTest.Transform(1); "; fsr.PreStart(src, runnerConfig); DebugRunner.VMState vms = fsr.Step(); // myTest = Test.FirstApproach({ 1, 2 }); ProtoCore.CodeModel.CodePoint cp = new ProtoCore.CodeModel.CodePoint { LineNo = 15, CharNo = 5 };
public ProtoCore.Mirror.RuntimeMirror LookupName(string name, int blockID) { // TODO Jun: The expression interpreter must be integrated into the mirror core.Rmem.PushConstructBlockId(blockID); core.DebugProps.CurrentBlockId = blockID; ProtoScript.Runners.ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core); List <ProtoCore.Core.CodeBlockCompilationSnapshot> snapShots = null; if (core.Options.IsDeltaExecution) { snapShots = ProtoCore.Core.CodeBlockCompilationSnapshot.CaptureCoreCompileState(core); } ProtoCore.DSASM.Mirror.ExecutionMirror mirror = watchRunner.Execute(name); if (core.Options.IsDeltaExecution && snapShots != null) { core.ResetDeltaCompileFromSnapshot(snapShots); } ProtoCore.Lang.Obj objExecVal = mirror.GetWatchValue(); ProtoCore.Mirror.RuntimeMirror runtimeMirror = new ProtoCore.Mirror.RuntimeMirror(new ProtoCore.Mirror.MirrorData(core, objExecVal.DsasmValue), core, core); Validity.Assert(runtimeMirror != null); return(runtimeMirror); }
public void cyclicdependancy_726() { string src = @"a = 1..3; c = a; b = [ Imperative ] { count = 0; for ( i in a ) { if ( i > 0 ) { a[count] = i + 1; } count = count+1; } return = a; } d = [ Imperative ] { count2 = 0; while (count2 <= 2 ) { if ( a[count2] > 0 ) { a[count2] = a[count2] + 1; } count2 = count2+1; } return = a; } e = b;"; fsr.PreStart(src, runnerConfig); DebugRunner.VMState vms = fsr.Step(); fsr.Run(); Assert.AreEqual(fsr.isEnded, true); ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core); ExecutionMirror mirror = watchRunner.Execute(@"a"); TestFrameWork.Verify(mirror, "b", null, 0); TestFrameWork.VerifyRuntimeWarning(ProtoCore.RuntimeData.WarningID.kCyclicDependency); }
public void TestWatchExpression1() { // Execute and verify the main script in a debug session fsr.PreStart( @" a = 1; b = 20; "); DebugRunner.VMState vms = fsr.Step(); vms = fsr.Step(); // Execute and verify the watch window expression script ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); Assert.Throws(typeof(ProtoCore.Exceptions.CompileErrorsOccured), () => { watchRunner.Execute(@"%"); }); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); Assert.IsTrue((Int64)objExecVal.Payload == 1); vms = fsr.Step(); // Execute and verify the watch window expression script watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); Assert.Throws(typeof(ProtoCore.Exceptions.CompileErrorsOccured), () => { watchRunner.Execute(@"%"); }); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"b"); objExecVal = mirror.GetWatchValue(); Assert.IsTrue((Int64)objExecVal.Payload == 20); }
public void Defect_IDE_464() { string src = @"class A { a : int[]; } def foo(x1 : A) { x1.a = -1; return = x1; } a1 = A.A(); a1.a = { 1, 2 }; b = a1.a; a1.a = -1;"; fsr.PreStart(src); fsr.Step(); // a1 = A.A(); DebugRunner.VMState vms = fsr.Step(); // a : int[]; fsr.Step(); fsr.Step(); fsr.Step(); vms = fsr.Step(); // a1.a = -1; ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b[0]"); Obj o1 = mirror.GetWatchValue(); Assert.AreEqual(1, (Int64)o1.Payload); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"b[1]"); o1 = mirror.GetWatchValue(); Assert.AreEqual(2, (Int64)o1.Payload); fsr.Step(); vms = fsr.Step(); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"b[0]"); o1 = mirror.GetWatchValue(); Assert.AreEqual(-1, (Int64)o1.Payload); }
public void TestWatchExpression2() { // Execute and verify the main script in a debug session fsr.PreStart( @" class Vector { x : var; y : var; constructor Vector() { x = 10; y = 20; } } p = Vector.Vector(); "); // Tracked by: http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-3990 string defectID = "MAGN-3990 Expression interpreter returns null when evaluates expression at end of script"; // Highlights "p = Vector.Vector()". DebugRunner.VMState vms = fsr.Step(); Assert.AreEqual(13, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(13, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(21, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight "x = 10;". Assert.AreEqual(8, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(8, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(16, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight "y = 20;". Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(9, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(16, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight the closing bracket of constructor "}". Assert.AreEqual(10, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(10, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(6, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight the "p = Vector.Vector();". Assert.AreEqual(13, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(13, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(21, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Ends execution. Assert.AreEqual(true, vms.isEnded); // Execute and verify the watch window expression script ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute("p.x"); Obj objExecVal = mirror.GetWatchValue(); Assert.AreNotEqual(null, objExecVal, defectID); Assert.IsTrue((Int64)objExecVal.Payload == 10, defectID); }
public void UseCase_Robert_simple_numeric_associative_2() { // Execute and verify the main script in a debug session fsr.PreStart( @" import(""ProtoGeometry.dll""); a : int; b : int; [Associative] { a = 10; b = 2 * a; a = a + 1; } "); DebugRunner.VMState vms = fsr.Step(); ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); TestFrameWork.Verify(mirror, "a", null, 0); vms = fsr.StepOver(); TestFrameWork.Verify(mirror, "a", 10, 0); vms = fsr.Step(); TestFrameWork.Verify(mirror, "b", 20, 0); vms = fsr.Step(); TestFrameWork.Verify(mirror, "a", 11, 0); vms = fsr.Step(); TestFrameWork.Verify(mirror, "b", 22, 0); }
public void TestWatchExpressionImperative3() { // Execute and verify the main script in a debug session fsr.PreStart( @" class Vector { x : var; y : var; constructor Vector() { x = 10; y = 20; } } [Imperative] { p = Vector.Vector(); t = 0; } "); // Highlights "p = Vector.Vector()". DebugRunner.VMState vms = fsr.Step(); Assert.AreEqual(15, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(15, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(25, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight "x = 10;". Assert.AreEqual(8, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(8, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(16, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight "y = 20;". Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(9, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(16, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight the closing bracket of constructor "}". Assert.AreEqual(10, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(10, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(6, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight the "p = Vector.Vector();". Assert.AreEqual(15, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(15, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(25, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight the "t = 0;" Assert.AreEqual(16, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(16, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(11, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight "}" of the "Imperative" block Assert.AreEqual(17, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(17, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(2, vms.ExecutionCursor.EndExclusive.CharNo); // Execute and verify the watch window expression script ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"p.x"); Obj objExecVal = mirror.GetWatchValue(); Assert.IsTrue((Int64)objExecVal.Payload == 10); }
public void StepIn_inlineconditional_Imperative_722_3() { string src = @"[Imperative] { def foo : int(a : int, b : int) { return = x = a > b ? a : b; } c1 = foo(10, 3); Print(c1); }"; fsr.PreStart(src); DebugRunner.VMState vms = fsr.Step(); vms = fsr.Step(); { ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); //TestFrameWork.Verify(mirror, "a", 10, 2); Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(10, (Int64)objExecVal.Payload); } { ExpressionInterpreterRunner watchRunner2 = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror2 = watchRunner2.Execute(@"b"); Obj objExecVal2 = mirror2.GetWatchValue(); //TestFrameWork.Verify(mirror2, "b", 3, 2); Assert.AreNotEqual(null, objExecVal2); Assert.AreEqual(3, (Int64)objExecVal2.Payload); } vms = fsr.Step(); vms = fsr.Step(); { ExpressionInterpreterRunner watchRunner3 = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror3 = watchRunner3.Execute(@"x"); Obj objExecVal3 = mirror3.GetWatchValue(); //TestFrameWork.Verify(mirror3, "x", 10, 2); Assert.AreNotEqual(null, objExecVal3); Assert.AreEqual(10, (Int64)objExecVal3.Payload); } vms = fsr.Step(); vms = fsr.Step(); { ExpressionInterpreterRunner watchRunner4 = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror4 = watchRunner4.Execute(@"c1"); Obj objExecVal4 = mirror4.GetWatchValue(); TestFrameWork.Verify(mirror4, "c1", 10, 1); } }
public void TestWatchExpressionInNestedBlock2_519_2() { // Execute and verify the defect IDE-519 fsr.PreStart( @"class test { f; constructor test() { [Associative] { [Imperative] { i = 3; } // The value of 'i' cannot be inspected here. // If this line is removed, then 'i' can be inspected. f = i; } } } a = test.test(); b = a.f; "); DebugRunner.VMState vms = fsr.StepOver();//Line 5 vms = fsr.Step();//Line 6 vms = fsr.Step();//Line 6 { // Get the value of "i". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"i"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(3, (Int64)objExecVal.Payload); } vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); //Line 7 { // Get the value of "i". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreEqual(null, objExecVal.Payload); } }
public void TestWatchExpressionInClassMember1() { // Execute and verify the defect IDE-476 fsr.PreStart( @"class A //line 1 { a : var; a2 : var; a4 : var; constructor A(x : var) { a2 = 3; a = x; } def update(x : var) { a = { x => a1; a1 > 10 ? true : false => a4; } return = x; } } a1 = A.A(0); a1 = A.A(); x = a1.update(1); y = { a1.a1, a1.a4 }; "); DebugRunner.VMState vms = fsr.StepOver();//Line 24 vms = fsr.Step();//Line 10 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 11 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreEqual((Int64)objExecVal.Payload, 3); } vms = fsr.Step();//Line 12 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreEqual((Int64)objExecVal.Payload, 3); } vms = fsr.Step();//Line 24 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 25 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 25 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 26 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 16 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 17 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 15 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 20 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 21 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 26 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 27 // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//ended // Get the value of "a2". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a2"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } }
public void SteppingOverinline_Imperative_723_6() { string src = @"import(""DSCoreNodes.dll""); x = -330; [Imperative] { a = x > 1 ? Math.Cos(60) : Math.Cos(45); b = 22; }"; fsr.PreStart(src); DebugRunner.VMState vms = fsr.Step(); vms = fsr.StepOver(); vms = fsr.StepOver(); { ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); TestFrameWork.Verify(mirror, "a", 0.707106, 1); } vms = fsr.StepOver(); { ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); TestFrameWork.Verify(mirror, "b", 22, 1); } }
public void HighlightingFunctionsInArrayAssociative2_Defect_IDE_578() { string src = @"class Dummy { value : var; constructor Dummy() { value = 5; } } def GetValue(d : Dummy) { return = d.value; } arr = {Dummy.Dummy(), Dummy.Dummy(), Dummy.Dummy(), Dummy.Dummy()}; val = GetValue(arr);"; fsr.PreStart(src); DebugRunner.VMState vms = fsr.Step(); Assert.AreEqual(15, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(15, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(68, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.StepOver(); ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"arr[0].value"); Obj o1 = mirror.GetWatchValue(); Assert.AreEqual(5, (Int64)o1.Payload); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"arr[1].value"); o1 = mirror.GetWatchValue(); Assert.AreEqual(5, (Int64)o1.Payload); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"arr[2].value"); o1 = mirror.GetWatchValue(); Assert.AreEqual(5, (Int64)o1.Payload); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"arr[3].value"); o1 = mirror.GetWatchValue(); Assert.AreEqual(5, (Int64)o1.Payload); }
public void TestWatchExpressionImperative4() { // Execute and verify the main script in a debug session fsr.PreStart( @" [Associative] { } [Imperative] { eee = 43420; } "); // First step should highlight closing bracket of "Associative" block. DebugRunner.VMState vms = fsr.StepOver(); Assert.AreEqual(4, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(4, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(2, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.StepOver(); // Highlight "eee = 43420;" Assert.AreEqual(8, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(8, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(17, vms.ExecutionCursor.EndExclusive.CharNo); // Get the value of "eee". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"eee"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.StepOver(); // Highlight closing bracket of "Imperative" block. Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(9, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(2, vms.ExecutionCursor.EndExclusive.CharNo); // Get the value of "eee". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"eee"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreNotEqual(null, objExecVal.Payload); Assert.AreEqual("43420", objExecVal.Payload.ToString()); } }
public void TestWatchExpressionInFunction() { // Execute and verify the main script in a debug session fsr.PreStart( @" def foo() { aaa = 4; return = null; } bbb = foo(); "); // First step should bring the exec cursor to "bbb = foo()". DebugRunner.VMState vms = fsr.StepOver(); Assert.AreEqual(8, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(8, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(13, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.Step(); // Highlight "aaa = 4;" Assert.AreEqual(4, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(4, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(13, vms.ExecutionCursor.EndExclusive.CharNo); // Get the value of "aaa". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"aaa"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.StepOver(); // Highlight "return = null;" Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(5, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(19, vms.ExecutionCursor.EndExclusive.CharNo); // Get the value of "aaa". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"aaa"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreNotEqual(null, objExecVal.Payload); Assert.AreEqual("4", objExecVal.Payload.ToString()); } }
public void TestWatchExpression5() { string sourceCode = @" a = { 1, 0, 0.0 }; // Line 2 b = { a, 1 }; // Line 3 [Imperative] // Line 5 { a[1] = 1; // Line 7 m = a; // Line 8 } // Line 9 "; fsr.PreStart(sourceCode); DebugRunner.VMState vms = fsr.StepOver(); Assert.AreEqual(2, vms.ExecutionCursor.StartInclusive.LineNo); vms = fsr.StepOver(); Assert.AreEqual(3, vms.ExecutionCursor.StartInclusive.LineNo); vms = fsr.StepOver(); Assert.AreEqual(7, vms.ExecutionCursor.StartInclusive.LineNo); vms = fsr.StepOver(); Assert.AreEqual(8, vms.ExecutionCursor.StartInclusive.LineNo); vms = fsr.StepOver(); Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.LineNo); // Get the value of "m[0]". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"m[0]"); Obj objExecVal = mirror.GetWatchValue(); // It should be "1". Assert.AreNotEqual(null, objExecVal); Assert.AreNotEqual(null, objExecVal.Payload); Assert.AreEqual("1", objExecVal.Payload.ToString()); } vms = fsr.StepOver(); // Causes "b = { a, 1 };" to execute. Assert.AreEqual(3, vms.ExecutionCursor.StartInclusive.LineNo); // Get the value of "m[0]". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"m[0]"); Obj objExecVal = mirror.GetWatchValue(); // It should still be "1". Assert.AreNotEqual(null, objExecVal); // Assert.AreEqual(null, objExecVal.Payload); } }
public void TestWatchExpression4() { // Execute and verify the main script in a debug session fsr.PreStart( @" def f : int(i : int, j : int) { a = 5; return = 7; } a = f(1, 2); b = 2; c = 3; "); // First step should bring the exec cursor to "a = f(1, 2)". DebugRunner.VMState vms = fsr.StepOver(); { // This is to simulate the event when "a" is added into the watch window // before it gets assigned a value. This should not cause subsequent stepping // to go wrong. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // This should not return a value since "a" is unassigned now. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } // Second step should bring it to "b = 2;". vms = fsr.StepOver(); { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // Now "a" should be "7" as the result of assignment from return value of "f". Assert.AreNotEqual(null, objExecVal); Assert.AreNotEqual(null, objExecVal.Payload); Assert.AreEqual("7", objExecVal.Payload.ToString()); } // Third step should bring it to "c = 3;". vms = fsr.StepOver(); // Final step ends the debug session. vms = fsr.StepOver(); Assert.AreEqual(true, vms.isEnded); }
public void TestWatchExpressionInNestedBlock1() { // Execute and verify the defect IDE-487 fsr.PreStart( @"class test { a = 1; } //line 1 c1 = [Imperative] { a = test.test(); b = [Associative] { return = test.test(); } c = a.a + b.a; return = c; } c2 = [Associative] { a = test.test(); b = [Imperative] { return = test.test(); } c = a.a + b.a; return = c; } "); DebugRunner.VMState vms = fsr.StepOver();//Line 5 vms = fsr.Step();//Line 1 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 5 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 8 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 1 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 8 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 9 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 6 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 11 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 12 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual((Int64)objExecVal.Payload, 2); } vms = fsr.Step();//Line 13 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual((Int64)objExecVal.Payload, 2); } vms = fsr.Step();//Line 3 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 17 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 1 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 17 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 20 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 1 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 20 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 21 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 18 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 23 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 24 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual((Int64)objExecVal.Payload, 2); } vms = fsr.Step();//Line 25 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Dictionary<string, Obj> os = vms.mirror.GetProperties(objExecVal); Assert.IsTrue(os.Count == 1); Assert.IsTrue((Int64)os["a"].Payload == 1); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual((Int64)objExecVal.Payload, 2); } vms = fsr.Step();//Line 15 { // 1. Get the value of "a". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 2. Get the value of "b". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } { // 3.Get the value of "c". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"c"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } }
public void Simple_debug() { // Execute and verify the main script in a debug session fsr.PreStart( @" class Tuple4 { public def Equals : bool (other : Tuple4) { return =true; } } t1 = Tuple4.Tuple4(); t2 = Tuple4.Tuple4(); b = t1.Equals(t2); "); DebugRunner.VMState vms = fsr.Step(); vms = fsr.StepOver(); vms = fsr.StepOver(); vms = fsr.StepOver(); ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); TestFrameWork.Verify(mirror, "b", true, 0); }
public void HighlightingFunctionsInArrayImperative_Defect_IDE_578() { string src = @" def f(a : int) { return = a; } [Imperative] { arr = { f(99), f(87) }; b = 2; }"; fsr.PreStart(src); DebugRunner.VMState vms = fsr.Step(); Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(9, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(28, vms.ExecutionCursor.EndExclusive.CharNo); vms = fsr.StepOver(); ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"arr[0]"); Obj o1 = mirror.GetWatchValue(); Assert.AreEqual(99, (Int64)o1.Payload); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"arr[1]"); o1 = mirror.GetWatchValue(); Assert.AreEqual(87, (Int64)o1.Payload); Assert.AreEqual(10, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(10, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(11, vms.ExecutionCursor.EndExclusive.CharNo); }
public void TestWatchExpressionInFunctionNestedInImperativeBlock() { // This comes from IDE-538 fsr.PreStart( @"z=[Imperative] //Line 1 { def GetNumberSquare(test:int) { result = test * test; return = result; } x = GetNumberSquare(5); return = x; } "); DebugRunner.VMState vms = fsr.StepOver();//Line 8 vms = fsr.Step();//Line 5 // Get the value of "result". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"result"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } // Get the value of "test". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"test"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(5, (Int64)objExecVal.Payload); } vms = fsr.Step();//Line 6 // Get the value of "result". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"result"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(25, (Int64)objExecVal.Payload); } // Get the value of "test". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"test"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(5, (Int64)objExecVal.Payload); } vms = fsr.Step();//Line 7 // Get the value of "result". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"result"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(25, (Int64)objExecVal.Payload); } // Get the value of "test". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"test"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(5, (Int64)objExecVal.Payload); } vms = fsr.Step();//Line 8 // Get the value of "result". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"result"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } // Get the value of "test". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"test"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } }
public void SteppingOverinline_Imperative_723_2() { string src = @"x = 30; def foo(y : int) { return = y + 222; } [Imperative] { a = x > foo(20) ? 44 : foo(55); //Line 10 b = 2; }"; fsr.PreStart(src); DebugRunner.VMState vms = fsr.Step(); vms = fsr.StepOver(); vms = fsr.StepOver(); { ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); TestFrameWork.Verify(mirror, "a", 277, 1); } vms = fsr.StepOver(); { ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); TestFrameWork.Verify(mirror, "b", 2, 1); } }
public void TestWatchExpressionInFunctionNestedWithImperativeBlock() { // This comes from IDE-544 fsr.PreStart( @"def func(d : int) //Line 1 { m : int; m = 10; temp = 0; // Line #5 [Imperative] { temp = m; // Line #8 } return = temp; // Line #10 } n = func(1); "); DebugRunner.VMState vms = fsr.StepOver();//Line 13 vms = fsr.Step();//Line 4 // Get the value of "m". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"m"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } // Get the value of "temp". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"temp"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 5 // Get the value of "m". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"m"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(10, (Int64)objExecVal.Payload); } // Get the value of "temp". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"temp"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } vms = fsr.Step();//Line 8 // Get the value of "m". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"m"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(10, (Int64)objExecVal.Payload); } // Get the value of "temp". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"temp"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(0, (Int64)objExecVal.Payload); } vms = fsr.Step();//Line 9 // Get the value of "m". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"m"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(10, (Int64)objExecVal.Payload); } // Get the value of "temp". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"temp"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(10, (Int64)objExecVal.Payload); } vms = fsr.Step();//Line 10 // Get the value of "m". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"m"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(10, (Int64)objExecVal.Payload); } // Get the value of "temp". { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"temp"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(10, (Int64)objExecVal.Payload); } }
public void SteppingOverinline_Imperative_723_4() { string src = @"x = 10; def foo(y : int) { return = y + 222; } a; [Imperative] { a = x > 20 ? foo(44) : foo(55); //Line 10 b = 2; }"; fsr.PreStart(src); DebugRunner.VMState vms = fsr.Step(); vms = fsr.StepOver(); vms = fsr.StepOver(); { ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); //TestFrameWork.Verify(mirror, "a", 277, 1); Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(277, (Int64)objExecVal.Payload); } vms = fsr.StepOver(); { ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"b"); Obj objExecVal = mirror.GetWatchValue(); //TestFrameWork.Verify(mirror, "b", 2, 1); Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(2, (Int64)objExecVal.Payload); } }
public void TestUpdateStaticMemberInClass() { String code = @" class A { static count : var = 0; constructor A() { count = count + 1; } } class B { static count : var = 0; constructor B() { count = count + 1; } } a1 = A.A(); "; fsr.PreStart(code); fsr.Step(); DebugRunner.VMState vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a1.count"); Obj objExecVal = mirror.GetWatchValue(); Assert.IsTrue((Int64)objExecVal.Payload == 1); Obj o = vms.mirror.GetDebugValue("a1"); string type = vms.mirror.GetType("a1"); Dictionary<string, Obj> os = vms.mirror.GetProperties(o); Assert.IsTrue(type == "A"); Assert.IsTrue(os.Count == 1); }
public void TestStepInSimpleFunction() { string src = @"def foo : int(a : int) { return = a; } c1 = foo(10);"; fsr.PreStart(src); DebugRunner.VMState vms = fsr.Step(); // c1 = foo(10); vms = fsr.Step(); // return = a; Assert.AreEqual(3, vms.ExecutionCursor.StartInclusive.LineNo); { ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(10, (Int64)objExecVal.Payload); } }
public void TestWatchExpressionImperative1() { // Execute and verify the main script in a debug session fsr.PreStart( @" [Imperative] { first = 1; second = 2; third = 3; fourth = 4; fifth = 5; } "); // First step should bring the exec cursor to "first = 1;". DebugRunner.VMState vms = fsr.StepOver(); Assert.AreEqual(4, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(4, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(15, vms.ExecutionCursor.EndExclusive.CharNo); { // This is to simulate the event when "first" is added into the watch window // before it gets assigned a value. This should not cause subsequent stepping // to go wrong. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"first"); Obj objExecVal = mirror.GetWatchValue(); // This should not return a valid payload as "first" is unassigned now. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(null, objExecVal.Payload); } // Second step should bring it to "second = 2;". vms = fsr.StepOver(); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(5, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(16, vms.ExecutionCursor.EndExclusive.CharNo); { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"first"); Obj objExecVal = mirror.GetWatchValue(); // This time "first" gets assigned a value of "1"... Assert.AreNotEqual(null, objExecVal); Assert.AreNotEqual(null, objExecVal.Payload); Assert.AreEqual("1", objExecVal.Payload.ToString()); } // Third step should bring it to "third = 3;". vms = fsr.StepOver(); Assert.AreEqual(6, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(6, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(15, vms.ExecutionCursor.EndExclusive.CharNo); { // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"second"); Obj objExecVal = mirror.GetWatchValue(); // This time "second" gets assigned a value of "2"... Assert.AreNotEqual(null, objExecVal); Assert.AreNotEqual(null, objExecVal.Payload); Assert.AreEqual("2", objExecVal.Payload.ToString()); } // Third step should bring it to "fourth = 4;". vms = fsr.StepOver(); Assert.AreEqual(7, vms.ExecutionCursor.StartInclusive.LineNo); Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo); Assert.AreEqual(7, vms.ExecutionCursor.EndExclusive.LineNo); Assert.AreEqual(16, vms.ExecutionCursor.EndExclusive.CharNo); }
public void TestWatchExpressionInNestedBlock2_519() { // Execute and verify the defect IDE-519 fsr.PreStart( @"[Imperative] { i = 3; [Associative] { f = i; } c = f; } "); DebugRunner.VMState vms = fsr.Step();//Line 5 vms = fsr.StepOver();//Line 6 { // Get the value of "i". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"i"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(3, (Int64)objExecVal.Payload); } vms = fsr.StepOver();//Line 7 { // Get the value of "i". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"i"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. object o = vms.mirror.GetDebugValue("f"); Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(3, (Int64)objExecVal.Payload); } }
public void TestWatchExpressionImperative2() { // Execute and verify the main script in a debug session fsr.PreStart( @" [Imperative] { a = 1; b = 20; } "); DebugRunner.VMState vms = fsr.Step(); vms = fsr.Step(); // Execute and verify the watch window expression script ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); Assert.IsTrue((Int64)objExecVal.Payload == 1); vms = fsr.Step(); // Execute and verify the watch window expression script watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"b"); objExecVal = mirror.GetWatchValue(); Assert.IsTrue((Int64)objExecVal.Payload == 20); }
public void Testprivatememberpropertyinwatch_476_3() { // Execute and verify the defect IDE-519 fsr.PreStart( @"class A { private a : var; a2 : var; a4 : var; constructor A(x : var) { a = x; } def update(x : var) { a = { x => a1; a1 > 10 ? true : false => a4; } return = x; } } AA = A.A(0); AA1 = A.A(); x = AA1.update(1); y = { AA1.a, AA1.a4 }; "); DebugRunner.VMState vms = fsr.StepOver();//Line 5 vms = fsr.Step();//Line 6 vms = fsr.Step(); { // Get the value of "i". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"a"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(0, (Int64)objExecVal.Payload); } vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); vms = fsr.Step(); //Line 7 { // Get the value of "i". // This is to simulate the refresh of watch window as a result of "Step" button. ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"x"); Obj objExecVal = mirror.GetWatchValue(); // It should not be available. Assert.AreEqual(1, (Int64)objExecVal.Payload); } }
public void LanguageBlockInsideFunction5() { string src = @"gg = 0; def foo () { arr = { { } }; [Imperative] { for(i in {0, 1}) { [Associative] { gg = i; arr[i] = {1, 2}; } } } return = arr; } test = foo();"; fsr.PreStart(src); fsr.Step(); // gg = 0; DebugRunner.VMState vms = fsr.Step(); // test = foo(); //Obj o = vms.mirror.GetDebugValue("gg"); ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"gg"); Obj o = mirror.GetWatchValue(); Assert.IsTrue((Int64)o.Payload == 0); fsr.Step(); // arr = { { } }; vms = fsr.Step(); //o = vms.mirror.GetDebugValue("arr"); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"arr"); //Assert.IsTrue(vms.mirror.GetType("arr") == "array"); Assert.IsTrue(mirror.GetType("arr") == "array"); fsr.Step(); fsr.Step(); fsr.Step(); vms = fsr.Step(); // gg = i; //o = vms.mirror.GetDebugValue("i"); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"i"); o = mirror.GetWatchValue(); Assert.IsTrue((Int64)o.Payload == 0); vms = fsr.Step(); // arr[i] = {1, 2}; //o = vms.mirror.GetDebugValue("gg"); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"gg"); o = mirror.GetWatchValue(); Assert.IsTrue((Int64)o.Payload == 0); vms = fsr.Step(); //o = vms.mirror.GetDebugValue("arr"); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"arr"); o = mirror.GetWatchValue(); List<Obj> ol = mirror.GetArrayElements(o); Assert.IsTrue(ol.Count == 1); List<Obj> ol_1 = mirror.GetArrayElements(ol[0]); Assert.IsTrue(ol_1.Count == 2); Assert.IsTrue((Int64)ol_1[0].Payload == 1); Assert.IsTrue((Int64)ol_1[1].Payload == 2); fsr.Step(); fsr.Step(); vms = fsr.Step(); fsr.Step(); // gg = i; //o = vms.mirror.GetDebugValue("i"); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"i"); o = mirror.GetWatchValue(); Assert.IsTrue((Int64)o.Payload == 1); vms = fsr.Step(); // arr[i] = {1, 2}; //o = vms.mirror.GetDebugValue("gg"); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"gg"); o = mirror.GetWatchValue(); Assert.IsTrue((Int64)o.Payload == 1); vms = fsr.Step(); //o = vms.mirror.GetDebugValue("arr"); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"arr"); o = mirror.GetWatchValue(); ol = vms.mirror.GetArrayElements(o); //Assert.IsTrue(ol.Count == 2); List<Obj> ol_2 = vms.mirror.GetArrayElements(ol[1]); Assert.IsTrue(ol_2.Count == 2); Assert.IsTrue((Int64)ol_2[0].Payload == 1); Assert.IsTrue((Int64)ol_2[1].Payload == 2); fsr.Step(); fsr.Step(); fsr.Step(); fsr.Step(); fsr.Step(); vms = fsr.Step(); fsr.Step(); //o = vms.mirror.GetDebugValue("test"); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"test"); o = mirror.GetWatchValue(); ol = vms.mirror.GetArrayElements(o); Assert.IsTrue(ol.Count == 2); ol_1 = vms.mirror.GetArrayElements(ol[0]); Assert.IsTrue(ol_1.Count == 2); Assert.IsTrue((Int64)ol_1[0].Payload == 1); Assert.IsTrue((Int64)ol_1[1].Payload == 2); ol_2 = vms.mirror.GetArrayElements(ol[1]); Assert.IsTrue(ol_2.Count == 2); Assert.IsTrue((Int64)ol_2[0].Payload == 1); Assert.IsTrue((Int64)ol_2[1].Payload == 2); }