dart-sdk/tests/standalone/debugger/mixin_closure_debugger_test.dart
hausner@google.com 70aa249370 VM debugger: fix closures in mixed-in functions
Avoid assertion in debugger when compiling closures in mixin
functions.

R=asiva@google.com

Review URL: https://codereview.chromium.org//102453002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30823 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-03 19:19:54 +00:00

55 lines
1.6 KiB
Dart

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// This test forks a second vm process that runs this dart script as
// a debug target.
// Run this test with option --wire to see the json messages sent
// between the processes.
// Run this test with option --verbose to see the stdout and stderr output
// of the debug target process.
// This test checks that a breakpoint can be set and is hit in a closure
// inside a mixin function. Regression test for issue 15325.
import "debug_lib.dart";
class S { }
class M {
m() {
var sum = 0;
[1,2,3].forEach((e) {
sum += e; // Breakpoint here.
});
return sum;
}
}
class A = S with M;
main(List<String> arguments) {
if (RunScript(testScript, arguments)) return;
var a = new A();
print(a.m());
}
// Expected debugger events and commands.
var testScript = [
MatchFrame(0, "main"), // Top frame in trace is function "main".
SetBreakpoint(23), // Set breakpoint inside the forEach closure.
Resume(),
MatchFrames(["S&M.<anonymous closure>", "forEach", "S&M.m"],
exactMatch: false), // First iteration.
MatchLocals({"e": "1"}),
Resume(),
MatchFrames(["S&M.<anonymous closure>", "forEach", "S&M.m"],
exactMatch: false), // Second iteration.
MatchLocals({"e": "2"}),
Resume(),
MatchFrames(["S&M.<anonymous closure>", "forEach", "S&M.m"],
exactMatch: false), // Third iteration.
MatchLocals({"e": "3"}),
Resume(),
];