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

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: 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
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..be1ca507e2b0906aadd643e15bc825926997703a 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -1990,6 +1990,43 @@ 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.
hausner 2014/07/10 22:57:26 Maybe add a sentence why that is significant?
rmacnak 2014/07/10 23:17:37 Added.
+ 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";
hausner 2014/07/10 22:57:26 Nit: alignment.
+ LoadScript(kScriptChars);
+ Dart_FinalizeLoading();
hausner 2014/07/10 22:57:26 Why not moving the FinalizeLoading call into the h
rmacnak 2014/07/10 23:17:37 Some tests fail, mostly related to snapshots.
+
+ 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') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698