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

Unified Diff: runtime/vm/debugger_api_impl_test.cc

Issue 23825006: Fix debugger expression evaluation for top-level functions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | « no previous file | runtime/vm/object.cc » ('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
===================================================================
--- runtime/vm/debugger_api_impl_test.cc (revision 27310)
+++ runtime/vm/debugger_api_impl_test.cc (working copy)
@@ -1558,6 +1558,19 @@
EXPECT(Dart_IsDouble(r));
EXPECT_EQ(50.0, ToDouble(r));
+ Dart_Handle closure =
+ Dart_EvaluateExpr(point, NewString("() => _factor * sqrt(x*x + y*y))"));
+ EXPECT_VALID(closure);
+ EXPECT(Dart_IsClosure(closure));
+ r = Dart_InvokeClosure(closure, 0, NULL);
+ EXPECT_EQ(50.0, ToDouble(r));
+
+ r = Dart_EvaluateExpr(point,
+ NewString("(() => _factor * sqrt(x*x + y*y))()"));
+ EXPECT_VALID(r);
+ EXPECT(Dart_IsDouble(r));
+ EXPECT_EQ(50.0, ToDouble(r));
+
Dart_Handle len = Dart_EvaluateExpr(point, NewString("l.length"));
EXPECT_VALID(len);
EXPECT(Dart_IsNumber(len));
@@ -1583,6 +1596,20 @@
EXPECT_VALID(len);
EXPECT(Dart_IsNumber(len));
EXPECT_EQ(6, ToInt64(len));
+
+ closure = Dart_EvaluateExpr(script_lib, NewString("(x) => l.length + x"));
+ EXPECT_VALID(closure);
+ EXPECT(Dart_IsClosure(closure));
+ Dart_Handle args[1] = { Dart_NewInteger(1) };
+ len = Dart_InvokeClosure(closure, 1, args);
+ EXPECT_VALID(len);
+ EXPECT(Dart_IsNumber(len));
+ EXPECT_EQ(6, ToInt64(len));
+
+ len = Dart_EvaluateExpr(script_lib, NewString("((x) => l.length + x)(1)"));
+ EXPECT_VALID(len);
+ EXPECT(Dart_IsNumber(len));
+ EXPECT_EQ(6, ToInt64(len));
}
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698