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

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
« no previous file with comments | « runtime/vm/debugger_api_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "class Test5<A, B, C> extends Test4<A, B> {\n"
1464 "}\n"
1465 "int main() {\n"
1466 "}\n";
1467
1468 Isolate* isolate = Isolate::Current();
1469 LoadScript(kScriptChars);
1470 ASSERT(script_lib != NULL);
1471 ASSERT(Dart_IsLibrary(script_lib));
1472 Dart_Handle core_lib = Dart_LookupLibrary(NewString("dart:core"));
1473
1474 Dart_Handle Test_name = Dart_NewStringFromCString("Test");
1475 Dart_Handle Test1_name = Dart_NewStringFromCString("Test1");
1476 Dart_Handle Test2_name = Dart_NewStringFromCString("Test2");
1477 Dart_Handle Test3_name = Dart_NewStringFromCString("Test3");
1478 Dart_Handle Test4_name = Dart_NewStringFromCString("Test4");
1479 Dart_Handle Test5_name = Dart_NewStringFromCString("Test5");
1480 Dart_Handle object_name = Dart_NewStringFromCString("Object");
1481 Dart_Handle int_name = Dart_NewStringFromCString("int");
1482
1483 Dart_Handle object_type = Dart_GetType(core_lib, object_name, 0, NULL);
1484 Dart_Handle int_type = Dart_GetType(core_lib, int_name, 0, NULL);
1485 EXPECT_VALID(int_type);
1486 Dart_Handle Test_type = Dart_GetType(script_lib, Test_name, 0, NULL);
1487 Dart_Handle Test1_type = Dart_GetType(script_lib, Test1_name, 0, NULL);
1488 Dart_Handle type_args = Dart_NewList(1);
1489 Dart_ListSetAt(type_args, 0, int_type);
1490 Dart_Handle Test2_int_type = Dart_GetType(script_lib,
1491 Test2_name,
1492 1,
1493 &type_args);
1494 Dart_Handle Test3_type = Dart_GetType(script_lib, Test3_name, 0, NULL);
1495 type_args = Dart_NewList(2);
1496 Dart_ListSetAt(type_args, 0, int_type);
1497 Dart_ListSetAt(type_args, 1, int_type);
1498 Dart_Handle Test4_int_type = Dart_GetType(script_lib,
1499 Test4_name,
1500 2,
1501 &type_args);
1502 type_args = Dart_NewList(3);
1503 Dart_ListSetAt(type_args, 0, int_type);
1504 Dart_ListSetAt(type_args, 1, int_type);
1505 Dart_ListSetAt(type_args, 2, int_type);
1506 Dart_Handle Test5_int_type = Dart_GetType(script_lib,
1507 Test5_name,
1508 3,
1509 &type_args);
1510 {
1511 Dart_Handle super_type = Dart_GetSupertype(object_type);
1512 EXPECT(super_type == Dart_Null());
1513 }
1514 {
1515 Dart_Handle super_type = Dart_GetSupertype(Test1_type);
1516 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test_type);
1517 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
1518 EXPECT(expected_type.raw() == actual_type.raw());
1519 }
1520 {
1521 Dart_Handle super_type = Dart_GetSupertype(Test3_type);
1522 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test2_int_type);
1523 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
1524 EXPECT(expected_type.raw() == actual_type.raw());
1525 }
1526 {
1527 Dart_Handle super_type = Dart_GetSupertype(Test4_int_type);
1528 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test2_int_type);
1529 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
1530 EXPECT(expected_type.raw() == actual_type.raw());
1531 }
1532 {
1533 Dart_Handle super_type = Dart_GetSupertype(Test5_int_type);
1534 const Type& expected_type = Api::UnwrapTypeHandle(isolate, Test4_int_type);
1535 const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
1536 EXPECT(expected_type.raw() == actual_type.raw());
1537 }
1538 }
1539
1450 } // namespace dart 1540 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698