| 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 "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/unit_test.h" | 8 #include "vm/unit_test.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 Dart_Handle object_b = Invoke(lib, "get_b"); | 178 Dart_Handle object_b = Invoke(lib, "get_b"); |
| 179 | 179 |
| 180 EXPECT_NOT_ERROR(object_b); | 180 EXPECT_NOT_ERROR(object_b); |
| 181 | 181 |
| 182 Dart_Handle fields = Dart_GetInstanceFields(object_b); | 182 Dart_Handle fields = Dart_GetInstanceFields(object_b); |
| 183 EXPECT_NOT_ERROR(fields); | 183 EXPECT_NOT_ERROR(fields); |
| 184 EXPECT(Dart_IsList(fields)); | 184 EXPECT(Dart_IsList(fields)); |
| 185 intptr_t list_length = 0; | 185 intptr_t list_length = 0; |
| 186 Dart_Handle retval = Dart_ListLength(fields, &list_length); | 186 Dart_Handle retval = Dart_ListLength(fields, &list_length); |
| 187 EXPECT_NOT_ERROR(retval); | 187 EXPECT_NOT_ERROR(retval); |
| 188 EXPECT_EQ(2 * kNumObjectFields, list_length); | 188 int num_fields = list_length / 2; |
| 189 printf("Object has %d fields:\n", list_length / 2); | 189 EXPECT_EQ(kNumObjectFields, num_fields); |
| 190 printf("Object has %d fields:\n", num_fields); |
| 190 for (int i = 0; i + 1 < list_length; i += 2) { | 191 for (int i = 0; i + 1 < list_length; i += 2) { |
| 191 Dart_Handle name_handle = Dart_ListGetAt(fields, i); | 192 Dart_Handle name_handle = Dart_ListGetAt(fields, i); |
| 192 EXPECT_NOT_ERROR(name_handle); | 193 EXPECT_NOT_ERROR(name_handle); |
| 193 EXPECT(Dart_IsString(name_handle)); | 194 EXPECT(Dart_IsString(name_handle)); |
| 194 char const* name; | 195 char const* name; |
| 195 Dart_StringToCString(name_handle, &name); | 196 Dart_StringToCString(name_handle, &name); |
| 196 Dart_Handle value_handle = Dart_ListGetAt(fields, i + 1); | 197 Dart_Handle value_handle = Dart_ListGetAt(fields, i + 1); |
| 197 EXPECT_NOT_ERROR(value_handle); | 198 EXPECT_NOT_ERROR(value_handle); |
| 198 value_handle = Dart_ToString(value_handle); | 199 value_handle = Dart_ToString(value_handle); |
| 199 EXPECT_NOT_ERROR(value_handle); | 200 EXPECT_NOT_ERROR(value_handle); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 EXPECT(Dart_IsString(source)); | 338 EXPECT(Dart_IsString(source)); |
| 338 char const* source_chars; | 339 char const* source_chars; |
| 339 Dart_StringToCString(source, &source_chars); | 340 Dart_StringToCString(source, &source_chars); |
| 340 printf("\n=== source: ===\n%s", source_chars); | 341 printf("\n=== source: ===\n%s", source_chars); |
| 341 EXPECT_STREQ(kScriptChars, source_chars); | 342 EXPECT_STREQ(kScriptChars, source_chars); |
| 342 } | 343 } |
| 343 | 344 |
| 344 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 345 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 345 | 346 |
| 346 } // namespace dart | 347 } // namespace dart |
| OLD | NEW |