| OLD | NEW |
| 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 // Test that the compiler can handle imports when package root has not been set. | 5 // Test that the compiler can handle imports when package root has not been set. |
| 6 | 6 |
| 7 library dart2js.test.package_root; | 7 library dart2js.test.package_root; |
| 8 | 8 |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 import "package:async_helper/async_helper.dart"; | 10 import "package:async_helper/async_helper.dart"; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 EventSink<String> outputProvider(String name, String extension) { | 50 EventSink<String> outputProvider(String name, String extension) { |
| 51 if (name != '') throw 'Attempt to output file "$name.$extension"'; | 51 if (name != '') throw 'Attempt to output file "$name.$extension"'; |
| 52 return new NullSink('$name.$extension'); | 52 return new NullSink('$name.$extension'); |
| 53 } | 53 } |
| 54 | 54 |
| 55 Compiler compiler = new Compiler(provider, | 55 Compiler compiler = new Compiler(provider, |
| 56 outputProvider, | 56 outputProvider, |
| 57 diagnosticHandler, | 57 diagnosticHandler, |
| 58 libraryRoot, | 58 libraryRoot, |
| 59 null, | 59 null, |
| 60 []); | 60 [], |
| 61 {}); |
| 61 | 62 |
| 62 asyncTest(() => compiler.run(main).then((_) { | 63 asyncTest(() => compiler.run(main).then((_) { |
| 63 Expect.equals(1, errors.length); | 64 Expect.equals(1, errors.length); |
| 64 Expect.equals("Error: Cannot resolve 'package:foo/foo.dart'. " | 65 Expect.equals("Error: Cannot resolve 'package:foo/foo.dart'. " |
| 65 "Package root has not been set.", | 66 "Package root has not been set.", |
| 66 errors[0]); | 67 errors[0]); |
| 67 })); | 68 })); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void main() { | 71 void main() { |
| 71 runCompiler(Uri.parse('memory:main.dart')); | 72 runCompiler(Uri.parse('memory:main.dart')); |
| 72 runCompiler(Uri.parse('package:foo/foo.dart')); | 73 runCompiler(Uri.parse('package:foo/foo.dart')); |
| 73 } | 74 } |
| OLD | NEW |