Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tests/compiler/dart2js/analyze_all_test.dart

Issue 23512008: Call asyncEnd only on success. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11 matching lines...) Expand all
22 22
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 asyncStart();
33 var compiler1 = compilerFor(SOURCE, uri, analyzeAll: false); 32 var compiler1 = compilerFor(SOURCE, uri, analyzeAll: false);
34 compiler1.runCompiler(uri).then((_) { 33 asyncTest(() => compiler1.runCompiler(uri).then((_) {
35 Expect.isFalse(compiler1.compilationFailed); 34 Expect.isFalse(compiler1.compilationFailed);
36 print(compiler1.warnings); 35 print(compiler1.warnings);
37 Expect.isTrue(compiler1.warnings.isEmpty, 'unexpected warnings'); 36 Expect.isTrue(compiler1.warnings.isEmpty, 'unexpected warnings');
38 Expect.isTrue(compiler1.errors.isEmpty, 'unexpected errors'); 37 Expect.isTrue(compiler1.errors.isEmpty, 'unexpected errors');
39 }).whenComplete(() => asyncEnd()); 38 }));
40 39
41 asyncStart();
42 var compiler2 = compilerFor(SOURCE, uri, analyzeAll: true); 40 var compiler2 = compilerFor(SOURCE, uri, analyzeAll: true);
43 compiler2.runCompiler(uri).then((_) { 41 asyncTest(() => compiler2.runCompiler(uri).then((_) {
44 Expect.isTrue(compiler2.compilationFailed); 42 Expect.isTrue(compiler2.compilationFailed);
45 Expect.isTrue(compiler2.warnings.isEmpty, 'unexpected warnings'); 43 Expect.isTrue(compiler2.warnings.isEmpty, 'unexpected warnings');
46 Expect.equals(2, compiler2.errors.length, 44 Expect.equals(2, compiler2.errors.length,
47 'expected exactly two errors, but got ${compiler2.errors}'); 45 'expected exactly two errors, but got ${compiler2.errors}');
48 46
49 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, 47 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
50 compiler2.errors[0].message.kind); 48 compiler2.errors[0].message.kind);
51 Expect.equals("Foo", compiler2.errors[0].node.toString()); 49 Expect.equals("Foo", compiler2.errors[0].node.toString());
52 50
53 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, 51 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
54 compiler2.errors[1].message.kind); 52 compiler2.errors[1].message.kind);
55 Expect.equals("Foo", compiler2.errors[1].node.toString()); 53 Expect.equals("Foo", compiler2.errors[1].node.toString());
56 }).whenComplete(() => asyncEnd()); 54 }));
57 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698