Chromium Code Reviews| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 func = test_lib.LookupFunctionInSource(script_url, 3); | 185 func = test_lib.LookupFunctionInSource(script_url, 3); |
| 186 EXPECT(!func.IsNull()); | 186 EXPECT(!func.IsNull()); |
| 187 EXPECT_STREQ("foo", String::Handle(func.name()).ToCString()); | 187 EXPECT_STREQ("foo", String::Handle(func.name()).ToCString()); |
| 188 | 188 |
| 189 func = test_lib.LookupFunctionInSource(script_url, 1); | 189 func = test_lib.LookupFunctionInSource(script_url, 1); |
| 190 EXPECT(func.IsNull()); | 190 EXPECT(func.IsNull()); |
| 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 | |
| 196 Dart_Handle libs = Dart_GetLibraryURLs(); | |
| 197 EXPECT(Dart_IsList(libs)); | |
| 198 intptr_t num_libs; | |
| 199 Dart_ListLength(libs, &num_libs); | |
| 200 EXPECT(num_libs > 0); | |
| 201 for (intptr_t i = 0; i < num_libs; i++) { | |
| 202 Dart_Handle lib_url = Dart_ListGetAt(libs, i); | |
| 203 EXPECT(Dart_IsString(lib_url)); | |
| 204 char const* chars; | |
| 205 Dart_StringToCString(lib_url, &chars); | |
| 206 printf("Lib %d: %s\n", i, chars); | |
|
siva
2012/01/24 18:37:14
instead of printf would it make sense to do an EXP
hausner
2012/01/24 21:34:42
Yes, if I knew what the expected library names are
| |
| 207 | |
| 208 Dart_Handle scripts = Dart_GetScriptURLs(lib_url); | |
| 209 EXPECT(Dart_IsList(scripts)); | |
| 210 intptr_t num_scripts; | |
| 211 Dart_ListLength(scripts, &num_scripts); | |
| 212 EXPECT(num_scripts >= 0); | |
| 213 for (intptr_t i = 0; i < num_scripts; i++) { | |
| 214 Dart_Handle script_url = Dart_ListGetAt(scripts, i); | |
| 215 char const* chars; | |
| 216 Dart_StringToCString(script_url, &chars); | |
| 217 printf(" script %d: '%s'\n", i + 1, chars); | |
|
siva
2012/01/24 18:37:14
Ditto.
hausner
2012/01/24 21:34:42
Ditto regarding script urls.
| |
| 218 } | |
| 219 } | |
| 220 | |
| 221 Dart_Handle lib_url = Dart_NewString(TestCase::url()); | |
| 222 Dart_Handle source = Dart_GetScriptSource(lib_url, lib_url); | |
| 223 EXPECT(Dart_IsString(source)); | |
| 224 char const* source_chars; | |
| 225 Dart_StringToCString(source, &source_chars); | |
| 226 printf("\n=== source: ===\n%s", source_chars); | |
| 227 EXPECT_STREQ(kScriptChars, source_chars); | |
| 195 } | 228 } |
| 196 | 229 |
| 197 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 230 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 198 | 231 |
| 199 } // namespace dart | 232 } // namespace dart |
| OLD | NEW |