OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // This test forks a second vm process that runs this dart script as |
| 6 // a debug target. |
| 7 // Run this test with option --wire to see the json messages sent |
| 8 // between the processes. |
| 9 // Run this test with option --verbose to see the stdout and stderr output |
| 10 // of the debug target process. |
| 11 |
| 12 // This test checks that a breakpoint can be set and is hit in a closure |
| 13 // inside a mixin function. Regression test for issue 15325. |
| 14 |
| 15 import "debug_lib.dart"; |
| 16 |
| 17 class S { } |
| 18 |
| 19 class M { |
| 20 m() { |
| 21 var sum = 0; |
| 22 [1,2,3].forEach((e) { |
| 23 sum += e; // Breakpoint here. |
| 24 }); |
| 25 return sum; |
| 26 } |
| 27 } |
| 28 |
| 29 class A = S with M; |
| 30 |
| 31 main(List<String> arguments) { |
| 32 if (RunScript(testScript, arguments)) return; |
| 33 var a = new A(); |
| 34 print(a.m()); |
| 35 } |
| 36 |
| 37 // Expected debugger events and commands. |
| 38 var testScript = [ |
| 39 MatchFrame(0, "main"), // Top frame in trace is function "main". |
| 40 SetBreakpoint(23), // Set breakpoint inside the forEach closure. |
| 41 Resume(), |
| 42 MatchFrames(["S&M.<anonymous closure>", "forEach", "S&M.m"], |
| 43 exactMatch: false), // First iteration. |
| 44 MatchLocals({"e": "1"}), |
| 45 Resume(), |
| 46 MatchFrames(["S&M.<anonymous closure>", "forEach", "S&M.m"], |
| 47 exactMatch: false), // Second iteration. |
| 48 MatchLocals({"e": "2"}), |
| 49 Resume(), |
| 50 MatchFrames(["S&M.<anonymous closure>", "forEach", "S&M.m"], |
| 51 exactMatch: false), // Third iteration. |
| 52 MatchLocals({"e": "3"}), |
| 53 Resume(), |
| 54 ]; |
OLD | NEW |