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

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

Issue 1235563003: Add interfaces for a new compiler API. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 5 years, 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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
6 import 'package:async_helper/async_helper.dart';
7 import 'package:compiler/compiler_new.dart' show Diagnostic;
8 import 'package:compiler/src/dart2jslib.dart';
5 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
6 import "package:async_helper/async_helper.dart"; 10 import 'memory_compiler.dart';
7 import 'memory_source_file_helper.dart';
8 11
9 import 'package:compiler/compiler.dart' 12 void main() {
10 show Diagnostic; 13 DiagnosticCollector collector = new DiagnosticCollector();
11 14 Compiler compiler = compilerFor(
12 main() { 15 MEMORY_SOURCE_FILES,
13 Uri script = currentDirectory.resolveUri(Platform.script); 16 diagnosticHandler: collector,
14 Uri libraryRoot = script.resolve('../../../sdk/'); 17 options: ['--analyze-all']);
15 Uri packageRoot = script.resolve('./packages/');
16
17 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
18 var diagnostics = [];
19 void diagnosticHandler(Uri uri, int begin, int end,
20 String message, Diagnostic kind) {
21 if (kind == Diagnostic.VERBOSE_INFO) {
22 return;
23 }
24 diagnostics.add('$uri:$begin:$end:$message:$kind');
25 }
26
27 Compiler compiler = new Compiler(provider.readStringFromUri,
28 (name, extension) => null,
29 diagnosticHandler,
30 libraryRoot,
31 packageRoot,
32 ['--analyze-all'],
33 {});
34 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { 18 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
19 List<String> diagnostics = <String>[];
20 collector.messages.forEach((DiagnosticMessage message) {
21 if (message.kind == Diagnostic.VERBOSE_INFO) return;
22 diagnostics.add(message.toString());
23 });
35 diagnostics.sort(); 24 diagnostics.sort();
36 var expected = [ 25 var expected = [
37 "memory:exporter.dart:43:47:'hest' is defined here.:info", 26 "memory:exporter.dart:43:47:'hest' is defined here.:info",
38 "memory:library.dart:41:45:'hest' is defined here.:info", 27 "memory:library.dart:41:45:'hest' is defined here.:info",
39 "memory:main.dart:0:22:'hest' is imported here.:info", 28 "memory:main.dart:0:22:'hest' is imported here.:info",
40 "memory:main.dart:23:46:'hest' is imported here.:info", 29 "memory:main.dart:23:46:'hest' is imported here.:info",
41 "memory:main.dart:86:92:Duplicate import of 'hest'.:warning", 30 "memory:main.dart:86:92:Duplicate import of 'hest'.:warning",
42 ]; 31 ];
43 Expect.listEquals(expected, diagnostics); 32 Expect.listEquals(expected, diagnostics);
44 Expect.isFalse(compiler.compilationFailed); 33 Expect.isFalse(compiler.compilationFailed);
(...skipping 22 matching lines...) Expand all
67 hest() {} 56 hest() {}
68 """, 57 """,
69 'exporter.dart': """ 58 'exporter.dart': """
70 library exporter; 59 library exporter;
71 60
72 export 'library.dart'; 61 export 'library.dart';
73 62
74 hest() {} 63 hest() {}
75 """, 64 """,
76 }; 65 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/deferred_not_in_main_test.dart ('k') | tests/compiler/dart2js/exit_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698