OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 import 'memory_source_file_helper.dart'; | 6 import 'memory_source_file_helper.dart'; |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 | 8 |
9 import 'package:compiler/compiler.dart' show Diagnostic; | 9 import 'package:compiler/compiler.dart' show Diagnostic; |
10 import 'package:compiler/src/options.dart' show CompilerOptions; | 10 import 'package:compiler/src/options.dart' show CompilerOptions; |
(...skipping 15 matching lines...) Expand all Loading... |
26 if (kind == Diagnostic.ERROR) { | 26 if (kind == Diagnostic.ERROR) { |
27 errorCount++; | 27 errorCount++; |
28 } else if (kind == Diagnostic.WARNING) { | 28 } else if (kind == Diagnostic.WARNING) { |
29 warningCount++; | 29 warningCount++; |
30 } else { | 30 } else { |
31 throw 'unexpected diagnostic $kind: $message'; | 31 throw 'unexpected diagnostic $kind: $message'; |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 CompilerImpl compiler = new CompilerImpl( | 35 CompilerImpl compiler = new CompilerImpl( |
36 new LegacyCompilerInput(provider.readStringFromUri), | 36 new LegacyCompilerInput(provider.readUtf8BytesFromUri), |
37 new LegacyCompilerOutput(), | 37 new LegacyCompilerOutput(), |
38 new LegacyCompilerDiagnostics(diagnosticHandler), | 38 new LegacyCompilerDiagnostics(diagnosticHandler), |
39 new CompilerOptions(libraryRoot: libraryRoot, packageRoot: packageRoot)); | 39 new CompilerOptions(libraryRoot: libraryRoot, packageRoot: packageRoot)); |
40 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { | 40 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { |
41 Expect.isTrue(compiler.compilationFailed); | 41 Expect.isTrue(compiler.compilationFailed); |
42 Expect.equals(5, errorCount); | 42 Expect.equals(5, errorCount); |
43 Expect.equals(1, warningCount); | 43 Expect.equals(1, warningCount); |
44 })); | 44 })); |
45 } | 45 } |
46 | 46 |
(...skipping 10 matching lines...) Expand all Loading... |
57 } | 57 } |
58 | 58 |
59 for ((){}() in []) { | 59 for ((){}() in []) { |
60 } | 60 } |
61 | 61 |
62 for (1 in []) { | 62 for (1 in []) { |
63 } | 63 } |
64 } | 64 } |
65 """ | 65 """ |
66 }; | 66 }; |
OLD | NEW |