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

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

Issue 1131593006: Report malformed URIs in library dependencies (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 | « pkg/compiler/lib/src/warnings.dart ('k') | no next file » | 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) 2015, 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 // Test that the compiler can handle missing files used in imports, exports, 5 // Test that the compiler can handle missing files used in imports, exports,
6 // part tags or as the main source file. 6 // part tags or as the main source file.
7 7
8 library dart2js.test.import; 8 library dart2js.test.malformed_uri;
9 9
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
11 import "package:async_helper/async_helper.dart"; 11 import "package:async_helper/async_helper.dart";
12 import 'memory_compiler.dart'; 12 import 'memory_compiler.dart';
13 13
14 const MEMORY_SOURCE_FILES = const { 14 const MEMORY_SOURCE_FILES = const {
15 'main.dart': ''' 15 'main.dart': '''
16 import '../../Udyn[mic ils/expect.dart';
16 17
17 library main; 18 main () { print("Hi"); }
18
19 import 'dart:thisLibraryShouldNotExist';
20 import 'package:thisPackageShouldNotExist/thisPackageShouldNotExist.dart';
21 export 'foo.dart';
22
23 part 'bar.dart';
24
25 main() {
26 int i = "";
27 }
28 ''', 19 ''',
29 }; 20 };
30 21
31 testMissingImports() { 22 testMalformedUri() {
32 var collector = new DiagnosticCollector(); 23 var collector = new DiagnosticCollector();
33 var compiler = compilerFor(MEMORY_SOURCE_FILES, diagnosticHandler: collector); 24 var compiler = compilerFor(MEMORY_SOURCE_FILES, diagnosticHandler: collector);
34 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { 25 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
35 Expect.equals(4, collector.errors.length);
36 Expect.equals(1, collector.warnings.length);
37 }));
38 }
39
40 testMissingMain() {
41 var collector = new DiagnosticCollector();
42 var compiler = compilerFor({}, diagnosticHandler: collector);
43 asyncTest(() => compiler.run(Uri.parse('memory:missing.dart')).then((_) {
44 Expect.equals(1, collector.errors.length); 26 Expect.equals(1, collector.errors.length);
45 Expect.equals(0, collector.warnings.length);
46 })); 27 }));
47 } 28 }
48 29
49 void main() { 30 void main() {
50 testMissingImports(); 31 testMalformedUri();
51 testMissingMain(); 32 }
52 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/warnings.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698