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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 891053004: Make Dart_Invoke work for private static functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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/dart_api_impl.cc ('k') | runtime/vm/resolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 2247055bee6a3ad1aaa8047ce8df1582e48df3ef..92779da178d804dd353117a34b5c8938727ecbe2 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -5112,7 +5112,7 @@ TEST_CASE(Invoke) {
"did not find static method 'Methods.staticMethod'");
// Hidden static method.
- name = PrivateLibName(lib, "_staticMethod");
+ name = NewString("_staticMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
result = Dart_Invoke(type, name, 1, args);
@@ -5141,7 +5141,7 @@ TEST_CASE(Invoke) {
"2 passed, 1 expected.");
// Hidden top-level method.
- name = PrivateLibName(lib, "_topMethod");
+ name = NewString("_topMethod");
EXPECT(Dart_IsError(Dart_Invoke(type, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
result = Dart_Invoke(lib, name, 1, args);
@@ -5151,6 +5151,32 @@ TEST_CASE(Invoke) {
}
+TEST_CASE(Invoke_PrivateStatic) {
+ const char* kScriptChars =
+ "class Methods {\n"
+ " static _staticMethod(arg) => 'hidden static $arg';\n"
+ "}\n"
+ "\n";
+
+ // Shared setup.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ Dart_Handle type = Dart_GetType(lib, NewString("Methods"), 0, NULL);
+ Dart_Handle result;
+ EXPECT_VALID(type);
+ Dart_Handle name = NewString("_staticMethod");
+ EXPECT_VALID(name);
+
+ Dart_Handle args[1];
+ args[0] = NewString("!!!");
+ result = Dart_Invoke(type, name, 1, args);
+ EXPECT_VALID(result);
+
+ const char* str = NULL;
+ result = Dart_StringToCString(result, &str);
+ EXPECT_STREQ("hidden static !!!", str);
+}
+
+
TEST_CASE(Invoke_FunnyArgs) {
const char* kScriptChars =
"test(arg) => 'hello $arg';\n";
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698