OLD | NEW |
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 "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 EXPECT(Dart_IsInteger(h)); | 1515 EXPECT(Dart_IsInteger(h)); |
1516 EXPECT_EQ(10, ToInt64(h)); | 1516 EXPECT_EQ(10, ToInt64(h)); |
1517 | 1517 |
1518 // Check that the side effect of the previous expression is | 1518 // Check that the side effect of the previous expression is |
1519 // persistent. | 1519 // persistent. |
1520 h = Dart_EvaluateExpr(p, NewString("_factor")); | 1520 h = Dart_EvaluateExpr(p, NewString("_factor")); |
1521 EXPECT_VALID(h); | 1521 EXPECT_VALID(h); |
1522 EXPECT(Dart_IsInteger(h)); | 1522 EXPECT(Dart_IsInteger(h)); |
1523 EXPECT_EQ(10, ToInt64(h)); | 1523 EXPECT_EQ(10, ToInt64(h)); |
1524 | 1524 |
| 1525 // Check that we return an error on invalid expressions. |
| 1526 EXPECT(Dart_IsError(Dart_EvaluateExpr(p, NewString("1; 2")))); |
| 1527 EXPECT(Dart_IsError(Dart_EvaluateExpr(p, NewString("int x")))); |
| 1528 EXPECT(Dart_IsError(Dart_EvaluateExpr(p, NewString("var x")))); |
| 1529 |
1525 breakpoint_hit = true; | 1530 breakpoint_hit = true; |
1526 breakpoint_hit_counter++; | 1531 breakpoint_hit_counter++; |
1527 } | 1532 } |
1528 | 1533 |
1529 | 1534 |
1530 TEST_CASE(Debug_EvaluateExpr) { | 1535 TEST_CASE(Debug_EvaluateExpr) { |
1531 const char* kScriptChars = | 1536 const char* kScriptChars = |
1532 "import 'dart:math'; \n" | 1537 "import 'dart:math'; \n" |
1533 "main() { \n" | 1538 "main() { \n" |
1534 " var p = new Point(3, 4); \n" | 1539 " var p = new Point(3, 4); \n" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 | 1770 |
1766 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); | 1771 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); |
1767 Dart_Handle super_type = Dart_GetSupertype(list_type); | 1772 Dart_Handle super_type = Dart_GetSupertype(list_type); |
1768 EXPECT(!Dart_IsError(super_type)); | 1773 EXPECT(!Dart_IsError(super_type)); |
1769 super_type = Dart_GetSupertype(super_type); | 1774 super_type = Dart_GetSupertype(super_type); |
1770 EXPECT(!Dart_IsError(super_type)); | 1775 EXPECT(!Dart_IsError(super_type)); |
1771 EXPECT(super_type == Dart_Null()); | 1776 EXPECT(super_type == Dart_Null()); |
1772 } | 1777 } |
1773 | 1778 |
1774 } // namespace dart | 1779 } // namespace dart |
OLD | NEW |