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

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

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased 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 "../../async_helper.dart";
7 8
8 const String SOURCE = """ 9 const String SOURCE = """
9 class Foo { 10 class Foo {
10 // Deliberately not const to ensure compile error. 11 // Deliberately not const to ensure compile error.
11 Foo(_); 12 Foo(_);
12 } 13 }
13 14
14 @Bar() 15 @Bar()
15 class Bar { 16 class Bar {
16 const Bar(); 17 const Bar();
17 } 18 }
18 19
19 @Foo('x') 20 @Foo('x')
20 typedef void VoidFunction(); 21 typedef void VoidFunction();
21 22
22 @Foo('y') 23 @Foo('y')
23 class MyClass {} 24 class MyClass {}
24 25
25 main() { 26 main() {
26 } 27 }
27 """; 28 """;
28 29
29 main() { 30 main() {
30 Uri uri = Uri.parse('test:code'); 31 Uri uri = Uri.parse('test:code');
31 var compiler = compilerFor(SOURCE, uri, analyzeAll: false); 32 asyncStart();
32 compiler.runCompiler(uri); 33 var compiler1 = compilerFor(SOURCE, uri, analyzeAll: false);
33 Expect.isFalse(compiler.compilationFailed); 34 compiler1.runCompiler(uri).then((_) {
34 print(compiler.warnings); 35 Expect.isFalse(compiler1.compilationFailed);
35 Expect.isTrue(compiler.warnings.isEmpty, 'unexpected warnings'); 36 print(compiler1.warnings);
36 Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors'); 37 Expect.isTrue(compiler1.warnings.isEmpty, 'unexpected warnings');
37 compiler = compilerFor(SOURCE, uri, analyzeAll: true); 38 Expect.isTrue(compiler1.errors.isEmpty, 'unexpected errors');
38 compiler.runCompiler(uri); 39 }).whenComplete(() => asyncEnd());
39 Expect.isTrue(compiler.compilationFailed);
40 Expect.isTrue(compiler.warnings.isEmpty, 'unexpected warnings');
41 Expect.equals(2, compiler.errors.length,
42 'expected exactly two errors, but got ${compiler.errors}');
43 40
44 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, 41 asyncStart();
45 compiler.errors[0].message.kind); 42 var compiler2 = compilerFor(SOURCE, uri, analyzeAll: true);
46 Expect.equals("Foo", compiler.errors[0].node.toString()); 43 compiler2.runCompiler(uri).then((_) {
44 Expect.isTrue(compiler2.compilationFailed);
45 Expect.isTrue(compiler2.warnings.isEmpty, 'unexpected warnings');
46 Expect.equals(2, compiler2.errors.length,
47 'expected exactly two errors, but got ${compiler2.errors}');
47 48
48 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, 49 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
49 compiler.errors[1].message.kind); 50 compiler2.errors[0].message.kind);
50 Expect.equals("Foo", compiler.errors[1].node.toString()); 51 Expect.equals("Foo", compiler2.errors[0].node.toString());
52
53 Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
54 compiler2.errors[1].message.kind);
55 Expect.equals("Foo", compiler2.errors[1].node.toString());
56 }).whenComplete(() => asyncEnd());
51 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698