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

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

Issue 21544003: Handle missing imports/exports/parts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add example to warning. Created 7 years, 4 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that the compiler can handle missing files used in imports, exports,
6 // part tags or as the main source file.
7
8 library dart2js.test.import;
9
10 import 'package:expect/expect.dart';
11 import 'memory_compiler.dart';
12
13 const MEMORY_SOURCE_FILES = const {
14 'main.dart': '''
15
16 library main;
17
18 import 'dart:thisLibraryShouldNotExist';
19 import 'package:thisPackageShouldNotExist/thisPackageShouldNotExist.dart';
20 export 'foo.dart';
21
22 part 'bar.dart';
23
24 main() {
25 int i = "";
26 }
27 ''',
28 };
29
30 testMissingImports() {
31 var collector = new DiagnosticCollector();
32 var compiler = compilerFor(MEMORY_SOURCE_FILES, diagnosticHandler: collector);
33 compiler.run(Uri.parse('memory:main.dart'));
34 Expect.equals(4, collector.errors.length);
35 Expect.equals(1, collector.warnings.length);
36 }
37
38 testMissingMain() {
39 var collector = new DiagnosticCollector();
40 var compiler = compilerFor({}, diagnosticHandler: collector);
41 compiler.run(Uri.parse('memory:missing.dart'));
42 Expect.equals(1, collector.errors.length);
43 Expect.equals(0, collector.warnings.length);
44 }
45
46 void main() {
47 testMissingImports();
48 testMissingMain();
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698