| OLD | NEW |
| 1 // Copyright (c) 2015, 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 library package_config.discovery_analysis_test; | 5 library package_config.discovery_analysis_test; |
| 6 | 6 |
| 7 import "dart:async"; | 7 import "dart:async"; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 | 9 |
| 10 import "package:package_config/discovery_analysis.dart"; | 10 import "package:package_config/discovery_analysis.dart"; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 expect(resolver, isNotNull); | 71 expect(resolver, isNotNull); |
| 72 expect(resolver.resolve(pkg("foo", "bar/baz")), | 72 expect(resolver.resolve(pkg("foo", "bar/baz")), |
| 73 equals(location.resolve("packages/foo/bar/baz"))); | 73 equals(location.resolve("packages/foo/bar/baz"))); |
| 74 expect(resolver.resolve(pkg("bar", "baz/qux")), | 74 expect(resolver.resolve(pkg("bar", "baz/qux")), |
| 75 equals(location.resolve("packages/bar/baz/qux"))); | 75 equals(location.resolve("packages/bar/baz/qux"))); |
| 76 expect(resolver.resolve(pkg("baz", "qux/foo")), | 76 expect(resolver.resolve(pkg("baz", "qux/foo")), |
| 77 equals(location.resolve("packages/baz/qux/foo"))); | 77 equals(location.resolve("packages/baz/qux/foo"))); |
| 78 if (location.scheme == "file") { | 78 if (location.scheme == "file") { |
| 79 expect(resolver.packages, unorderedEquals(["foo", "bar", "baz"])); | 79 expect(resolver.packages, unorderedEquals(["foo", "bar", "baz"])); |
| 80 } else { | 80 } else { |
| 81 expect(() => resolver.packages, throws); | 81 expect(() => resolver.packages, throwsUnsupportedError); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 Uri pkg(String packageName, String packagePath) { | 85 Uri pkg(String packageName, String packagePath) { |
| 86 var path; | 86 var path; |
| 87 if (packagePath.startsWith('/')) { | 87 if (packagePath.startsWith('/')) { |
| 88 path = "$packageName$packagePath"; | 88 path = "$packageName$packagePath"; |
| 89 } else { | 89 } else { |
| 90 path = "$packageName/$packagePath"; | 90 path = "$packageName/$packagePath"; |
| 91 } | 91 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 116 if (content is Map) { | 116 if (content is Map) { |
| 117 Directory subDir = new Directory(path.join(target.path, name)); | 117 Directory subDir = new Directory(path.join(target.path, name)); |
| 118 subDir.createSync(); | 118 subDir.createSync(); |
| 119 _createFiles(subDir, content); | 119 _createFiles(subDir, content); |
| 120 } else { | 120 } else { |
| 121 File file = new File(path.join(target.path, name)); | 121 File file = new File(path.join(target.path, name)); |
| 122 file.writeAsStringSync(content, flush: true); | 122 file.writeAsStringSync(content, flush: true); |
| 123 } | 123 } |
| 124 }); | 124 }); |
| 125 } | 125 } |
| OLD | NEW |