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

Unified Diff: vm/dart_api_impl_test.cc

Issue 10115034: Add a missing arity check for top-level methods in Dart_Invoke. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | « vm/dart_api_impl.cc ('k') | vm/unit_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_api_impl_test.cc
===================================================================
--- vm/dart_api_impl_test.cc (revision 6699)
+++ vm/dart_api_impl_test.cc (working copy)
@@ -3197,6 +3197,9 @@
EXPECT_VALID(instance);
Dart_Handle args[1];
args[0] = Dart_NewString("!!!");
+ Dart_Handle bad_args[2];
+ bad_args[0] = Dart_NewString("bad1");
+ bad_args[1] = Dart_NewString("bad2");
Dart_Handle result;
Dart_Handle name;
const char* str;
@@ -3210,6 +3213,10 @@
result = Dart_StringToCString(result, &str);
EXPECT_STREQ("instance !!!", str);
+ // Instance method, wrong arg count.
+ EXPECT_ERROR(Dart_Invoke(instance, name, 2, bad_args),
+ "did not find instance method 'Methods.instanceMethod'");
+
// Hidden instance method.
name = Dart_NewString("_instanceMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
@@ -3237,6 +3244,10 @@
result = Dart_StringToCString(result, &str);
EXPECT_STREQ("static !!!", str);
+ // Static method, wrong arg count.
+ EXPECT_ERROR(Dart_Invoke(cls, name, 2, bad_args),
+ "did not find static method 'Methods.staticMethod'");
+
// Hidden static method.
name = Dart_NewString("_staticMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
@@ -3261,6 +3272,10 @@
result = Dart_StringToCString(result, &str);
EXPECT_STREQ("top !!!", str);
+ // Top-level method, wrong arg count.
+ EXPECT_ERROR(Dart_Invoke(lib, name, 2, bad_args),
+ "did not find top-level function 'topMethod'");
+
// Hidden top-level method.
name = Dart_NewString("_topMethod");
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
« no previous file with comments | « vm/dart_api_impl.cc ('k') | vm/unit_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698