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

Side by Side Diff: runtime/vm/debugger_api_impl_test.cc

Issue 18238003: Add Dart_GetSupertype to the dart debugger API so that the dartium (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/thread.h" 8 #include "vm/thread.h"
9 #include "vm/unit_test.h" 9 #include "vm/unit_test.h"
10 10
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 Dart_SetExceptionThrownHandler(&StackTraceDump2ExceptionHandler); 1440 Dart_SetExceptionThrownHandler(&StackTraceDump2ExceptionHandler);
1441 breakpoint_hit_counter = 0; 1441 breakpoint_hit_counter = 0;
1442 Dart_SetExceptionPauseInfo(kPauseOnAllExceptions); 1442 Dart_SetExceptionPauseInfo(kPauseOnAllExceptions);
1443 1443
1444 Dart_Handle retval = Invoke("main"); 1444 Dart_Handle retval = Invoke("main");
1445 EXPECT(Dart_IsError(retval)); 1445 EXPECT(Dart_IsError(retval));
1446 EXPECT(Dart_IsUnhandledExceptionError(retval)); 1446 EXPECT(Dart_IsUnhandledExceptionError(retval));
1447 EXPECT_EQ(1, breakpoint_hit_counter); 1447 EXPECT_EQ(1, breakpoint_hit_counter);
1448 } 1448 }
1449 1449
1450
1451 TEST_CASE(Debug_GetSupertype) {
1452 const char* kScriptChars =
1453 "class Test {\n"
1454 "}\n"
1455 "class Test1 extends Test {\n"
1456 "}\n"
1457 "class Test2<T> {\n"
1458 "}\n"
1459 "class Test3 extends Test2<int> {\n"
1460 "}\n"
1461 "class Test4<A, B> extends Test2<A> {\n"
1462 "}\n"
1463 "int main() {\n"
1464 "}\n";
1465
1466 Isolate* isolate = Isolate::Current();
1467 LoadScript(kScriptChars);
1468 ASSERT(script_lib != NULL);
1469 ASSERT(Dart_IsLibrary(script_lib));
1470 Dart_Handle core_lib = Dart_LookupLibrary(NewString("dart:core"));
1471
1472 Dart_Handle Test_name = Dart_NewStringFromCString("Test");
1473 Dart_Handle Test1_name = Dart_NewStringFromCString("Test1");
1474 Dart_Handle Test2_name = Dart_NewStringFromCString("Test2");
1475 Dart_Handle Test3_name = Dart_NewStringFromCString("Test3");
1476 Dart_Handle Test4_name = Dart_NewStringFromCString("Test4");
1477 Dart_Handle object_name = Dart_NewStringFromCString("Object");
1478 Dart_Handle int_name = Dart_NewStringFromCString("int");
1479
1480 Dart_Handle object_type = Dart_GetType(core_lib, object_name, 0, NULL);
1481 Dart_Handle int_type = Dart_GetType(core_lib, int_name, 0, NULL);
1482 EXPECT_VALID(int_type);
1483 Dart_Handle Test_type = Dart_GetType(script_lib, Test_name, 0, NULL);
1484 Dart_Handle Test1_type = Dart_GetType(script_lib, Test1_name, 0, NULL);
1485 Dart_Handle type_args = Dart_NewList(1);
1486 Dart_ListSetAt(type_args, 0, int_type);
1487 Dart_Handle Test2_int_type = Dart_GetType(script_lib,
1488 Test2_name,
1489 1,
1490 &type_args);
1491 Dart_Handle Test3_type = Dart_GetType(script_lib, Test3_name, 0, NULL);
1492 type_args = Dart_NewList(2);
1493 Dart_ListSetAt(type_args, 0, int_type);
1494 Dart_ListSetAt(type_args, 1, int_type);
1495 Dart_Handle Test4_int_type = Dart_GetType(script_lib,
1496 Test4_name,
1497 2,
1498 &type_args);
1499 {
1500 Dart_Handle super_type = Dart_GetSupertype(object_type);
1501 EXPECT(super_type == Dart_Null());
1502 }
1503 {
1504 Dart_Handle super_type = Dart_GetSupertype(Test1_type);
1505 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test_type);
1506 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
1507 EXPECT(expected_type.raw() == actual_type.raw());
1508 }
1509 {
1510 Dart_Handle super_type = Dart_GetSupertype(Test3_type);
1511 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test2_int_type);
1512 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
1513 EXPECT(expected_type.raw() == actual_type.raw());
1514 }
1515 {
1516 Dart_Handle super_type = Dart_GetSupertype(Test4_int_type);
1517 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test2_int_type);
1518 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
1519 EXPECT(expected_type.raw() == actual_type.raw());
1520 }
1521 }
1522
1450 } // namespace dart 1523 } // namespace dart
OLDNEW
« runtime/vm/debugger_api_impl.cc ('K') | « runtime/vm/debugger_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698