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

Unified Diff: runtime/vm/debugger_api_impl_test.cc

Issue 22287004: Added unit test cases to try and reproduce issue 12137 (Things (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | no next file » | 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 25803)
+++ runtime/vm/debugger_api_impl_test.cc (working copy)
@@ -1463,6 +1463,7 @@
"class Test5<A, B, C> extends Test4<A, B> {\n"
"}\n"
"var s = new Set();\n"
+ "var l = new List();\n"
"int main() {\n"
"}\n";
@@ -1482,6 +1483,7 @@
Dart_Handle int_name = Dart_NewStringFromCString("int");
Dart_Handle set_name = Dart_NewStringFromCString("Set");
Dart_Handle iterable_name = Dart_NewStringFromCString("IterableBase");
+ Dart_Handle list_name = Dart_NewStringFromCString("List");
Dart_Handle object_type = Dart_GetType(core_lib, object_name, 0, NULL);
Dart_Handle int_type = Dart_GetType(core_lib, int_name, 0, NULL);
@@ -1546,6 +1548,49 @@
const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
EXPECT(expected_type.raw() == actual_type.raw());
}
+ {
+ Dart_Handle list_type = Dart_GetType(core_lib, list_name, 0, NULL);
+ Dart_Handle super_type = Dart_GetSupertype(list_type);
+ EXPECT(!Dart_IsError(super_type));
+ super_type = Dart_GetSupertype(super_type);
+ EXPECT(!Dart_IsError(super_type));
+ EXPECT(super_type == Dart_Null());
+ }
}
+
+TEST_CASE(Debug_ListSuperType) {
+ const char* kScriptChars =
+ "List testMain() {"
+ " List a = new List();"
+ " a.add(10);"
+ " a.add(20);"
+ " a.add(30);"
+ " return a;"
+ "}"
+ ""
+ "List immutable() {"
+ " return const [0, 1, 2];"
+ "}";
+ Dart_Handle result;
+
+ // Create a test library and Load up a test script in it.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+
+ // Invoke a function which returns an object of type List.
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
+ EXPECT_VALID(result);
+
+ // First ensure that the returned object is a list.
+ Dart_Handle list_access_test_obj = result;
+ EXPECT(Dart_IsList(list_access_test_obj));
+
+ Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj);
+ Dart_Handle super_type = Dart_GetSupertype(list_type);
+ EXPECT(!Dart_IsError(super_type));
+ super_type = Dart_GetSupertype(super_type);
+ EXPECT(!Dart_IsError(super_type));
+ EXPECT(super_type == Dart_Null());
+}
+
} // namespace dart
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698