@@ -1558,6 +1558,94 @@ async Task<Result> _invoke_getter(string obj_id, string property_name, bool expe
1558
1558
}
1559
1559
}
1560
1560
1561
+ [ Fact ]
1562
+ public async Task CreateGoodBreakpointAndHitAndRemoveAndDontHit ( )
1563
+ {
1564
+ var insp = new Inspector ( ) ;
1565
+
1566
+ //Collect events
1567
+ var scripts = SubscribeToScripts ( insp ) ;
1568
+
1569
+ await Ready ( ) ;
1570
+ await insp . Ready ( async ( cli , token ) =>
1571
+ {
1572
+ ctx = new DebugTestContext ( cli , insp , token , scripts ) ;
1573
+
1574
+ var bp = await SetBreakpoint ( "dotnet://debugger-test.dll/debugger-test.cs" , 10 , 8 ) ;
1575
+ var bp2 = await SetBreakpoint ( "dotnet://debugger-test.dll/debugger-test.cs" , 12 , 8 ) ;
1576
+ var pause_location = await EvaluateAndCheck (
1577
+ "window.setTimeout(function() { invoke_add(); invoke_add()}, 1);" ,
1578
+ "dotnet://debugger-test.dll/debugger-test.cs" , 10 , 8 ,
1579
+ "IntAdd" ) ;
1580
+
1581
+ Assert . Equal ( "other" , pause_location [ "reason" ] ? . Value < string > ( ) ) ;
1582
+ Assert . Equal ( bp . Value [ "breakpointId" ] ? . ToString ( ) , pause_location [ "hitBreakpoints" ] ? [ 0 ] ? . Value < string > ( ) ) ;
1583
+
1584
+ await RemoveBreakpoint ( bp . Value [ "breakpointId" ] ? . ToString ( ) ) ;
1585
+ await SendCommandAndCheck ( JObject . FromObject ( new { } ) , "Debugger.resume" , "dotnet://debugger-test.dll/debugger-test.cs" , 12 , 8 , "IntAdd" ) ;
1586
+ await SendCommandAndCheck ( JObject . FromObject ( new { } ) , "Debugger.resume" , "dotnet://debugger-test.dll/debugger-test.cs" , 12 , 8 , "IntAdd" ) ;
1587
+ } ) ;
1588
+ }
1589
+
1590
+ [ Fact ]
1591
+ public async Task CreateGoodBreakpointAndHitAndRemoveTwice ( )
1592
+ {
1593
+ var insp = new Inspector ( ) ;
1594
+
1595
+ //Collect events
1596
+ var scripts = SubscribeToScripts ( insp ) ;
1597
+
1598
+ await Ready ( ) ;
1599
+ await insp . Ready ( async ( cli , token ) =>
1600
+ {
1601
+ ctx = new DebugTestContext ( cli , insp , token , scripts ) ;
1602
+
1603
+ var bp = await SetBreakpoint ( "dotnet://debugger-test.dll/debugger-test.cs" , 10 , 8 ) ;
1604
+ var bp2 = await SetBreakpoint ( "dotnet://debugger-test.dll/debugger-test.cs" , 12 , 8 ) ;
1605
+ var pause_location = await EvaluateAndCheck (
1606
+ "window.setTimeout(function() { invoke_add(); invoke_add()}, 1);" ,
1607
+ "dotnet://debugger-test.dll/debugger-test.cs" , 10 , 8 ,
1608
+ "IntAdd" ) ;
1609
+
1610
+ Assert . Equal ( "other" , pause_location [ "reason" ] ? . Value < string > ( ) ) ;
1611
+ Assert . Equal ( bp . Value [ "breakpointId" ] ? . ToString ( ) , pause_location [ "hitBreakpoints" ] ? [ 0 ] ? . Value < string > ( ) ) ;
1612
+
1613
+ await RemoveBreakpoint ( bp . Value [ "breakpointId" ] ? . ToString ( ) ) ;
1614
+ await RemoveBreakpoint ( bp . Value [ "breakpointId" ] ? . ToString ( ) ) ;
1615
+ } ) ;
1616
+ }
1617
+
1618
+ [ Fact ]
1619
+ public async Task CreateGoodBreakpointAndHitAndRemoveAndDontHitAndCreateAgainAndHit ( )
1620
+ {
1621
+ var insp = new Inspector ( ) ;
1622
+
1623
+ //Collect events
1624
+ var scripts = SubscribeToScripts ( insp ) ;
1625
+
1626
+ await Ready ( ) ;
1627
+ await insp . Ready ( async ( cli , token ) =>
1628
+ {
1629
+ ctx = new DebugTestContext ( cli , insp , token , scripts ) ;
1630
+
1631
+ var bp = await SetBreakpoint ( "dotnet://debugger-test.dll/debugger-test.cs" , 10 , 8 ) ;
1632
+ var bp2 = await SetBreakpoint ( "dotnet://debugger-test.dll/debugger-test.cs" , 12 , 8 ) ;
1633
+ var pause_location = await EvaluateAndCheck (
1634
+ "window.setTimeout(function() { invoke_add(); invoke_add(); invoke_add(); invoke_add()}, 1);" ,
1635
+ "dotnet://debugger-test.dll/debugger-test.cs" , 10 , 8 ,
1636
+ "IntAdd" ) ;
1637
+
1638
+ Assert . Equal ( "other" , pause_location [ "reason" ] ? . Value < string > ( ) ) ;
1639
+ Assert . Equal ( bp . Value [ "breakpointId" ] ? . ToString ( ) , pause_location [ "hitBreakpoints" ] ? [ 0 ] ? . Value < string > ( ) ) ;
1640
+
1641
+ await RemoveBreakpoint ( bp . Value [ "breakpointId" ] ? . ToString ( ) ) ;
1642
+ await SendCommandAndCheck ( JObject . FromObject ( new { } ) , "Debugger.resume" , "dotnet://debugger-test.dll/debugger-test.cs" , 12 , 8 , "IntAdd" ) ;
1643
+ await SendCommandAndCheck ( JObject . FromObject ( new { } ) , "Debugger.resume" , "dotnet://debugger-test.dll/debugger-test.cs" , 12 , 8 , "IntAdd" ) ;
1644
+ bp = await SetBreakpoint ( "dotnet://debugger-test.dll/debugger-test.cs" , 10 , 8 ) ;
1645
+ await SendCommandAndCheck ( JObject . FromObject ( new { } ) , "Debugger.resume" , "dotnet://debugger-test.dll/debugger-test.cs" , 10 , 8 , "IntAdd" ) ;
1646
+
1647
+ } ) ;
1648
+ }
1561
1649
//TODO add tests covering basic stepping behavior as step in/out/over
1562
1650
}
1563
1651
}
0 commit comments