| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 func = test_lib.LookupFunctionInSource(script_url, 6); | 191 func = test_lib.LookupFunctionInSource(script_url, 6); |
| 192 EXPECT(func.IsNull()); | 192 EXPECT(func.IsNull()); |
| 193 func = test_lib.LookupFunctionInSource(script_url, 10); | 193 func = test_lib.LookupFunctionInSource(script_url, 10); |
| 194 EXPECT(func.IsNull()); | 194 EXPECT(func.IsNull()); |
| 195 | 195 |
| 196 Dart_Handle libs = Dart_GetLibraryURLs(); | 196 Dart_Handle libs = Dart_GetLibraryURLs(); |
| 197 EXPECT(Dart_IsList(libs)); | 197 EXPECT(Dart_IsList(libs)); |
| 198 intptr_t num_libs; | 198 intptr_t num_libs; |
| 199 Dart_ListLength(libs, &num_libs); | 199 Dart_ListLength(libs, &num_libs); |
| 200 EXPECT(num_libs > 0); | 200 EXPECT(num_libs > 0); |
| 201 for (intptr_t i = 0; i < num_libs; i++) { | 201 for (int i = 0; i < num_libs; i++) { |
| 202 Dart_Handle lib_url = Dart_ListGetAt(libs, i); | 202 Dart_Handle lib_url = Dart_ListGetAt(libs, i); |
| 203 EXPECT(Dart_IsString(lib_url)); | 203 EXPECT(Dart_IsString(lib_url)); |
| 204 char const* chars; | 204 char const* chars; |
| 205 Dart_StringToCString(lib_url, &chars); | 205 Dart_StringToCString(lib_url, &chars); |
| 206 printf("Lib %ld: %s\n", i, chars); | 206 printf("Lib %d: %s\n", i, chars); |
| 207 | 207 |
| 208 Dart_Handle scripts = Dart_GetScriptURLs(lib_url); | 208 Dart_Handle scripts = Dart_GetScriptURLs(lib_url); |
| 209 EXPECT(Dart_IsList(scripts)); | 209 EXPECT(Dart_IsList(scripts)); |
| 210 intptr_t num_scripts; | 210 intptr_t num_scripts; |
| 211 Dart_ListLength(scripts, &num_scripts); | 211 Dart_ListLength(scripts, &num_scripts); |
| 212 EXPECT(num_scripts >= 0); | 212 EXPECT(num_scripts >= 0); |
| 213 for (intptr_t i = 0; i < num_scripts; i++) { | 213 for (intptr_t i = 0; i < num_scripts; i++) { |
| 214 Dart_Handle script_url = Dart_ListGetAt(scripts, i); | 214 Dart_Handle script_url = Dart_ListGetAt(scripts, i); |
| 215 char const* chars; | 215 char const* chars; |
| 216 Dart_StringToCString(script_url, &chars); | 216 Dart_StringToCString(script_url, &chars); |
| 217 printf(" script %ld: '%s'\n", i + 1, chars); | 217 printf(" script %d: '%s'\n", i + 1, chars); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 Dart_Handle lib_url = Dart_NewString(TestCase::url()); | 221 Dart_Handle lib_url = Dart_NewString(TestCase::url()); |
| 222 Dart_Handle source = Dart_GetScriptSource(lib_url, lib_url); | 222 Dart_Handle source = Dart_GetScriptSource(lib_url, lib_url); |
| 223 EXPECT(Dart_IsString(source)); | 223 EXPECT(Dart_IsString(source)); |
| 224 char const* source_chars; | 224 char const* source_chars; |
| 225 Dart_StringToCString(source, &source_chars); | 225 Dart_StringToCString(source, &source_chars); |
| 226 printf("\n=== source: ===\n%s", source_chars); | 226 printf("\n=== source: ===\n%s", source_chars); |
| 227 EXPECT_STREQ(kScriptChars, source_chars); | 227 EXPECT_STREQ(kScriptChars, source_chars); |
| 228 } | 228 } |
| 229 | 229 |
| 230 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 230 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 231 | 231 |
| 232 } // namespace dart | 232 } // namespace dart |
| OLD | NEW |