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

Unified Diff: runtime/vm/debugger_api_impl_test.cc

Issue 379353003: Implement Evaluate without creating new classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 5 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/compiler_test.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_api_impl_test.cc
diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc
index 04ad02945703de8daae73dc1cf113885cbc6dad2..4ce3f12ea4cdf3dbdfa72d14afa3bf14714b2b0a 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -1990,6 +1990,45 @@ TEST_CASE(Debug_EvaluateExpr) {
}
+static void EvaluateInActivationOfEvaluateHandler(Dart_IsolateId isolate_id,
+ Dart_Handle exception_object,
+ Dart_StackTrace trace) {
+ breakpoint_hit_counter++;
+ Dart_ActivationFrame top_frame = 0;
+ Dart_Handle result = Dart_GetActivationFrame(trace, 0, &top_frame);
+ EXPECT_VALID(result);
+
+ result = Dart_ActivationFrameEvaluate(top_frame, NewString("p.r"));
+ EXPECT_VALID(result);
+ EXPECT_EQ(5.0, ToDouble(result));
+}
+
+
+TEST_CASE(Debug_EvaluateInActivationOfEvaluate) {
+ // This library deliberately declares no top-level variables or methods. This
+ // exercises a path in eval where a library may have no top-level anonymous
+ // classes.
+ const char* kScriptChars =
+ "import 'dart:math'; \n"
+ "class Point { \n"
+ " var x, y; \n"
+ " Point(this.x, this.y); \n"
+ " get r => sqrt(x*x + y*y); \n"
+ "} \n";
+ LoadScript(kScriptChars);
+ Dart_FinalizeLoading();
+
+ Dart_SetExceptionThrownHandler(&EvaluateInActivationOfEvaluateHandler);
+ Dart_SetExceptionPauseInfo(kPauseOnAllExceptions);
+ breakpoint_hit_counter = 0;
+
+ Dart_Handle result = Dart_EvaluateExpr(script_lib, NewString(
+ "() { var p = new Point(3, 4); throw p; } ())"));
+ EXPECT(Dart_IsError(result));
+ EXPECT_EQ(1, breakpoint_hit_counter);
+}
+
+
TEST_CASE(Debug_GetClosureInfo) {
const char* kScriptChars =
"void foo() { return 43; } \n"
« no previous file with comments | « runtime/vm/compiler_test.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698