| 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 // Test of "recursive" imports using the dart2js compiler API. | 5 // Test of "recursive" imports using the dart2js compiler API. |
| 6 | 6 |
| 7 import '../../sdk/lib/_internal/compiler/compiler.dart'; | 7 import '../../sdk/lib/_internal/compiler/compiler.dart'; |
| 8 import 'dart:uri'; | 8 import 'dart:uri'; |
| 9 | 9 |
| 10 const CORE_LIB = """ | 10 const CORE_LIB = """ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Simulate an OS error. | 45 // Simulate an OS error. |
| 46 throw 'Path length exceeded'; | 46 throw 'Path length exceeded'; |
| 47 } else if (uri.scheme == "main") { | 47 } else if (uri.scheme == "main") { |
| 48 count++; | 48 count++; |
| 49 source = RECURSIVE_MAIN; | 49 source = RECURSIVE_MAIN; |
| 50 } else if (uri.scheme == "lib") { | 50 } else if (uri.scheme == "lib") { |
| 51 if (uri.path.endsWith("/core.dart")) { | 51 if (uri.path.endsWith("/core.dart")) { |
| 52 source = CORE_LIB; | 52 source = CORE_LIB; |
| 53 } else if (uri.path.endsWith('_patch.dart')) { | 53 } else if (uri.path.endsWith('_patch.dart')) { |
| 54 source = ''; | 54 source = ''; |
| 55 } else if (uri.path.endsWith('isolate_helper.dart')) { |
| 56 source = 'class _WorkerStub {}'; |
| 55 } else { | 57 } else { |
| 56 source = "library lib${uri.path.replaceAll('/', '.')};"; | 58 source = "library lib${uri.path.replaceAll('/', '.')};"; |
| 57 } | 59 } |
| 58 } else { | 60 } else { |
| 59 throw "unexpected URI $uri"; | 61 throw "unexpected URI $uri"; |
| 60 } | 62 } |
| 61 completer.complete(source); | 63 completer.complete(source); |
| 62 return completer.future; | 64 return completer.future; |
| 63 } | 65 } |
| 64 | 66 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 82 new Uri.fromComponents(scheme: 'lib', path: '/'), | 84 new Uri.fromComponents(scheme: 'lib', path: '/'), |
| 83 new Uri.fromComponents(scheme: 'package', path: '/'), | 85 new Uri.fromComponents(scheme: 'package', path: '/'), |
| 84 provider, handler).value; | 86 provider, handler).value; |
| 85 Expect.isNull(code); | 87 Expect.isNull(code); |
| 86 Expect.isTrue(10 < count); | 88 Expect.isTrue(10 < count); |
| 87 // Two warnings for each time RECURSIVE_MAIN is read, except the | 89 // Two warnings for each time RECURSIVE_MAIN is read, except the |
| 88 // first time. | 90 // first time. |
| 89 Expect.equals(2 * (count - 1), warningCount); | 91 Expect.equals(2 * (count - 1), warningCount); |
| 90 Expect.equals(1, errorCount); | 92 Expect.equals(1, errorCount); |
| 91 } | 93 } |
| OLD | NEW |