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

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

Issue 2690063002: Refactor CompilerOutput (Closed)
Patch Set: Cleanup. Created 3 years, 10 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
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 "dart:async"; 5 import "dart:async";
6 6
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import 'package:compiler/compiler.dart'; 8 import 'package:compiler/compiler.dart';
9 import "package:compiler/src/elements/elements.dart"; 9 import "package:compiler/src/elements/elements.dart";
10 import "package:compiler/src/old_to_new_api.dart";
10 import "package:expect/expect.dart"; 11 import "package:expect/expect.dart";
11 12
12 import "mock_compiler.dart"; 13 import "mock_compiler.dart";
13 14
14 Future testErrorHandling() { 15 Future testErrorHandling() {
15 // Test that compiler.currentElement is set correctly when 16 // Test that compiler.currentElement is set correctly when
16 // reporting errors/warnings. 17 // reporting errors/warnings.
17 MockCompiler compiler = new MockCompiler.internal(); 18 MockCompiler compiler = new MockCompiler.internal();
18 return compiler.init().then((_) { 19 return compiler.init().then((_) {
19 compiler.parseScript('NoSuchPrefix.NoSuchType foo() {}'); 20 compiler.parseScript('NoSuchPrefix.NoSuchType foo() {}');
20 FunctionElement foo = compiler.mainApp.find('foo'); 21 FunctionElement foo = compiler.mainApp.find('foo');
21 compiler.diagnosticHandler = 22 compiler.diagnosticHandler = new LegacyCompilerDiagnostics(
22 (Uri uri, int begin, int end, String message, Diagnostic kind) { 23 (Uri uri, int begin, int end, String message, Diagnostic kind) {
23 if (kind == Diagnostic.WARNING) { 24 if (kind == Diagnostic.WARNING) {
24 Expect.equals(foo, compiler.currentElement); 25 Expect.equals(foo, compiler.currentElement);
25 } 26 }
26 }; 27 });
27 foo.computeType(compiler.resolution); 28 foo.computeType(compiler.resolution);
28 Expect.equals(1, compiler.diagnosticCollector.warnings.length); 29 Expect.equals(1, compiler.diagnosticCollector.warnings.length);
29 }); 30 });
30 } 31 }
31 32
32 main() { 33 main() {
33 asyncTest(() => testErrorHandling()); 34 asyncTest(() => testErrorHandling());
34 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698