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 |
|
ahe
2013/09/02 15:24:41
This test need to use async_helper.dart.
Johnni Winther
2013/09/03 07:51:39
Done.
| |
| 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 "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import '../../sdk/lib/_internal/compiler/compiler.dart'; | 9 import '../../sdk/lib/_internal/compiler/compiler.dart'; |
| 10 | 10 |
| 11 const CORE_LIB = """ | 11 const CORE_LIB = """ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 } else if (uri.path.endsWith('_patch.dart')) { | 79 } else if (uri.path.endsWith('_patch.dart')) { |
| 80 source = ''; | 80 source = ''; |
| 81 } else if (uri.path.endsWith('isolate_helper.dart')) { | 81 } else if (uri.path.endsWith('isolate_helper.dart')) { |
| 82 source = 'class _WorkerStub {}'; | 82 source = 'class _WorkerStub {}'; |
| 83 } else if (uri.path.endsWith('interceptors.dart')) { | 83 } else if (uri.path.endsWith('interceptors.dart')) { |
| 84 source = INTERCEPTORS_LIB; | 84 source = INTERCEPTORS_LIB; |
| 85 } else { | 85 } else { |
| 86 source = "library lib${uri.path.replaceAll('/', '.')};"; | 86 source = "library lib${uri.path.replaceAll('/', '.')};"; |
| 87 } | 87 } |
| 88 } else { | 88 } else { |
| 89 throw "unexpected URI $uri"; | 89 return new Future.error("unexpected URI $uri"); |
| 90 } | 90 } |
| 91 return new Future.value(source); | 91 return new Future.value(source); |
| 92 } | 92 } |
| 93 | 93 |
| 94 int warningCount = 0; | 94 int warningCount = 0; |
| 95 int errorCount = 0; | 95 int errorCount = 0; |
| 96 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { | 96 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { |
| 97 if (uri != null) { | 97 if (uri != null) { |
| 98 // print('$uri:$begin:$end: $kind: $message'); | 98 // print('$uri:$begin:$end: $kind: $message'); |
| 99 Expect.equals('main', uri.scheme); | 99 Expect.equals('main', uri.scheme); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 116 Expect.isNull(code); | 116 Expect.isNull(code); |
| 117 Expect.isTrue(10 < count); | 117 Expect.isTrue(10 < count); |
| 118 // Two warnings for each time RECURSIVE_MAIN is read, except the | 118 // Two warnings for each time RECURSIVE_MAIN is read, except the |
| 119 // first time. | 119 // first time. |
| 120 Expect.equals(2 * (count - 1), warningCount); | 120 Expect.equals(2 * (count - 1), warningCount); |
| 121 Expect.equals(1, errorCount); | 121 Expect.equals(1, errorCount); |
| 122 }, onError: (e) { | 122 }, onError: (e) { |
| 123 throw 'Compilation failed'; | 123 throw 'Compilation failed'; |
| 124 }); | 124 }); |
| 125 } | 125 } |
| OLD | NEW |