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/diagnose_ambiguous_test.dart

Issue 23684057: Support new import rules. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. 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
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/message_kind_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 import "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 import 'memory_source_file_helper.dart'; 7 import 'memory_source_file_helper.dart';
8 8
9 import '../../../sdk/lib/_internal/compiler/compiler.dart' 9 import '../../../sdk/lib/_internal/compiler/compiler.dart'
10 show Diagnostic; 10 show Diagnostic;
11 11
12 import 'dart:json';
13
14 main() { 12 main() {
15 Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script)); 13 Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
16 Uri libraryRoot = script.resolve('../../../sdk/'); 14 Uri libraryRoot = script.resolve('../../../sdk/');
17 Uri packageRoot = script.resolve('./packages/'); 15 Uri packageRoot = script.resolve('./packages/');
18 16
19 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES); 17 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
20 var diagnostics = []; 18 var diagnostics = [];
21 void diagnosticHandler(Uri uri, int begin, int end, 19 void diagnosticHandler(Uri uri, int begin, int end,
22 String message, Diagnostic kind) { 20 String message, Diagnostic kind) {
23 if (kind == Diagnostic.VERBOSE_INFO) { 21 if (kind == Diagnostic.VERBOSE_INFO) {
24 return; 22 return;
25 } 23 }
26 diagnostics.add('$uri:$begin:$end:$message:$kind'); 24 diagnostics.add('$uri:$begin:$end:$message:$kind');
27 } 25 }
28 26
29 Compiler compiler = new Compiler(provider.readStringFromUri, 27 Compiler compiler = new Compiler(provider.readStringFromUri,
30 (name, extension) => null, 28 (name, extension) => null,
31 diagnosticHandler, 29 diagnosticHandler,
32 libraryRoot, 30 libraryRoot,
33 packageRoot, 31 packageRoot,
34 ['--analyze-only']); 32 ['--analyze-only']);
35 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { 33 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
36 diagnostics.sort(); 34 diagnostics.sort();
37 var expected = [ 35 var expected = [
38 'memory:exporter.dart:43:47:Info: "function(hest)" is defined here.' 36 'memory:exporter.dart:43:47:Info: "function(hest)" is defined here.'
39 ':info', 37 ':info',
40 'memory:library.dart:14:19:Info: "class(Fisk)" is (re)exported by '
41 'multiple libraries.:info',
42 'memory:library.dart:30:34:Info: "function(fisk)" is (re)exported by '
43 'multiple libraries.:info',
44 'memory:library.dart:41:45:Info: "function(hest)" is defined here.' 38 'memory:library.dart:41:45:Info: "function(hest)" is defined here.'
45 ':info', 39 ':info',
46 'memory:main.dart:0:22:Info: "class(Fisk)" is imported here.:info',
47 'memory:main.dart:0:22:Info: "function(fisk)" is imported here.:info',
48 'memory:main.dart:0:22:Info: "function(hest)" is imported here.:info', 40 'memory:main.dart:0:22:Info: "function(hest)" is imported here.:info',
49 'memory:main.dart:23:46:Info: "class(Fisk)" is imported here.:info',
50 'memory:main.dart:23:46:Info: "function(fisk)" is imported here.:info',
51 'memory:main.dart:23:46:Info: "function(hest)" is imported here.:info', 41 'memory:main.dart:23:46:Info: "function(hest)" is imported here.:info',
52 'memory:main.dart:59:63:Warning: Duplicate import of "Fisk".:warning',
53 'memory:main.dart:76:80:Error: Duplicate import of "fisk".:error',
54 'memory:main.dart:86:90:Error: Duplicate import of "hest".:error' 42 'memory:main.dart:86:90:Error: Duplicate import of "hest".:error'
55 ]; 43 ];
56 Expect.listEquals(expected, diagnostics); 44 Expect.listEquals(expected, diagnostics);
57 Expect.isTrue(compiler.compilationFailed); 45 Expect.isTrue(compiler.compilationFailed);
58 })); 46 }));
59 } 47 }
60 48
61 const Map MEMORY_SOURCE_FILES = const { 49 const Map MEMORY_SOURCE_FILES = const {
62 'main.dart': """ 50 'main.dart': """
63 import 'library.dart'; 51 import 'library.dart';
(...skipping 16 matching lines...) Expand all
80 hest() {} 68 hest() {}
81 """, 69 """,
82 'exporter.dart': """ 70 'exporter.dart': """
83 library exporter; 71 library exporter;
84 72
85 export 'library.dart'; 73 export 'library.dart';
86 74
87 hest() {} 75 hest() {}
88 """, 76 """,
89 }; 77 };
OLDNEW
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/message_kind_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698