| 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "compiler_helper.dart"; | 6 import "compiler_helper.dart"; |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 | 8 |
| 9 const String SOURCE = """ | 9 const String SOURCE = """ |
| 10 class Foo { | 10 class Foo { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 @Foo('y') | 23 @Foo('y') |
| 24 class MyClass {} | 24 class MyClass {} |
| 25 | 25 |
| 26 main() { | 26 main() { |
| 27 } | 27 } |
| 28 """; | 28 """; |
| 29 | 29 |
| 30 main() { | 30 main() { |
| 31 Uri uri = Uri.parse('test:code'); | 31 Uri uri = Uri.parse('test:code'); |
| 32 var compiler1 = compilerFor(SOURCE, uri, analyzeAll: false); | 32 var compiler1 = compilerFor(SOURCE, uri, analyzeAll: false); |
| 33 asyncTest(() => compiler1.runCompiler(uri).then((_) { | 33 asyncTest(() => compiler1.run(uri).then((compilationSucceded) { |
| 34 Expect.isFalse(compiler1.compilationFailed); | 34 Expect.isTrue(compilationSucceded); |
| 35 print(compiler1.warnings); | 35 print(compiler1.warnings); |
| 36 Expect.isTrue(compiler1.warnings.isEmpty, 'unexpected warnings'); | 36 Expect.isTrue(compiler1.warnings.isEmpty, 'unexpected warnings'); |
| 37 Expect.isTrue(compiler1.errors.isEmpty, 'unexpected errors'); | 37 Expect.isTrue(compiler1.errors.isEmpty, 'unexpected errors'); |
| 38 })); | 38 })); |
| 39 | 39 |
| 40 var compiler2 = compilerFor(SOURCE, uri, analyzeAll: true); | 40 var compiler2 = compilerFor(SOURCE, uri, analyzeAll: true); |
| 41 asyncTest(() => compiler2.runCompiler(uri).then((_) { | 41 asyncTest(() => compiler2.run(uri).then((compilationSucceded) { |
| 42 Expect.isTrue(compiler2.compilationFailed); | 42 Expect.isFalse(compilationSucceded); |
| 43 Expect.isTrue(compiler2.warnings.isEmpty, | 43 Expect.isTrue(compiler2.warnings.isEmpty, |
| 44 'unexpected warnings: ${compiler2.warnings}'); | 44 'unexpected warnings: ${compiler2.warnings}'); |
| 45 Expect.equals(2, compiler2.errors.length, | 45 Expect.equals(2, compiler2.errors.length, |
| 46 'expected exactly two errors, but got ${compiler2.errors}'); | 46 'expected exactly two errors, but got ${compiler2.errors}'); |
| 47 | 47 |
| 48 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, | 48 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, |
| 49 compiler2.errors[0].message.kind); | 49 compiler2.errors[0].message.kind); |
| 50 Expect.equals("Foo", compiler2.errors[0].node.toString()); | 50 Expect.equals("Foo", compiler2.errors[0].node.toString()); |
| 51 | 51 |
| 52 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, | 52 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, |
| 53 compiler2.errors[1].message.kind); | 53 compiler2.errors[1].message.kind); |
| 54 Expect.equals("Foo", compiler2.errors[1].node.toString()); | 54 Expect.equals("Foo", compiler2.errors[1].node.toString()); |
| 55 })); | 55 })); |
| 56 } | 56 } |
| OLD | NEW |