Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1234)

Unified Diff: tests/standalone/debugger/debug_lib.dart

Issue 933253003: VM: Fix issue with local variable values reported by the debugger. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser_test.cc ('k') | tests/standalone/debugger/local_variables_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/debugger/debug_lib.dart
===================================================================
--- tests/standalone/debugger/debug_lib.dart (revision 43843)
+++ tests/standalone/debugger/debug_lib.dart (working copy)
@@ -299,8 +299,9 @@
class LocalsMatcher extends Command {
Map locals = {};
+ int frame_index;
- LocalsMatcher(this.locals) {
+ LocalsMatcher(this.locals, this.frame_index) {
template = {"id": 0, "command": "getStackTrace", "params": {"isolateId": 0}};
}
@@ -310,8 +311,8 @@
List frames = getJsonValue(debugger.currentMessage, "result:callFrames");
assert(frames != null);
- String functionName = frames[0]['functionName'];
- List localsList = frames[0]['locals'];
+ String functionName = frames[frame_index]['functionName'];
+ List localsList = frames[frame_index]['locals'];
Map reportedLocals = {};
localsList.forEach((local) => reportedLocals[local['name']] = local['value']);
for (String key in locals.keys) {
@@ -333,11 +334,47 @@
}
-MatchLocals(Map localValues) {
- return new LocalsMatcher(localValues);
+MatchLocals(Map localValues, [int frame_index = 0]) {
hausner 2015/02/18 18:32:29 It doesn't look like you are using MatchLocals wit
Florian Schneider 2015/02/18 18:45:23 Yes, I only used to while testing. I'll remove it
+ return new LocalsMatcher(localValues, frame_index);
}
+class InvertedLocalsMatcher extends Command {
hausner 2015/02/18 18:32:28 Would you mind adding a one-liner comment what thi
Florian Schneider 2015/02/18 18:45:23 Added comment and renamed to AssertLocalsNotVisibl
+ List<String> locals;
+ int frame_index;
+
+ InvertedLocalsMatcher(this.locals, this.frame_index) {
+ template = {"id": 0, "command": "getStackTrace", "params": {"isolateId": 0}};
+ }
+
+ void matchResponse(Debugger debugger) {
+ super.matchResponse(debugger);
+
+ List frames = getJsonValue(debugger.currentMessage, "result:callFrames");
+ assert(frames != null);
+
+ String functionName = frames[frame_index]['functionName'];
+ List localsList = frames[frame_index]['locals'];
+ Map reportedLocals = {};
+ localsList.forEach((local) => reportedLocals[local['name']] = local['value']);
+ for (String key in locals) {
+ if (reportedLocals[key] != null) {
+ debugger.error("Error in $functionName(): local variable $key not "
+ "expected in scope (reported value "
+ "${reportedLocals[key]['text']})");
+ return;
+ }
+ }
+ print("Matched locals $locals");
+ }
+}
+
+
+AssertLocalsNotVisible(List<String> locals, [int frame_index = 0]) {
+ return new InvertedLocalsMatcher(locals, frame_index);
+}
+
+
class EventMatcher {
String eventName;
Map params;
« no previous file with comments | « runtime/vm/parser_test.cc ('k') | tests/standalone/debugger/local_variables_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698