| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 'dart:async'; | |
| 6 | |
| 7 import 'package:pub/src/lock_file.dart'; | 5 import 'package:pub/src/lock_file.dart'; |
| 8 import 'package:pub/src/package.dart'; | 6 import 'package:pub/src/package.dart'; |
| 9 import 'package:pub/src/pubspec.dart'; | |
| 10 import 'package:pub/src/source.dart'; | 7 import 'package:pub/src/source.dart'; |
| 11 import 'package:pub/src/source_registry.dart'; | 8 import 'package:pub/src/source_registry.dart'; |
| 9 import 'package:pub/src/system_cache.dart'; |
| 12 import 'package:pub_semver/pub_semver.dart'; | 10 import 'package:pub_semver/pub_semver.dart'; |
| 13 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
| 14 import 'package:yaml/yaml.dart'; | 12 import 'package:yaml/yaml.dart'; |
| 15 | 13 |
| 16 class MockSource extends Source { | 14 class MockSource extends Source { |
| 17 final String name = 'mock'; | 15 final String name = 'mock'; |
| 18 | 16 |
| 19 Future<List<PackageId>> doGetVersions(PackageRef ref) => | 17 BoundSource bind(SystemCache cache) => |
| 20 throw new UnsupportedError("Cannot get mock package versions."); | 18 throw new UnsupportedError("Cannot download mock packages."); |
| 21 | |
| 22 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( | |
| 23 "Cannot describe mock packages."); | |
| 24 | |
| 25 Future get(PackageId id, String symlink) => throw new UnsupportedError( | |
| 26 "Cannot get a mock package."); | |
| 27 | |
| 28 String getDirectory(PackageId id) => throw new UnsupportedError( | |
| 29 "Cannot get the directory for mock packages."); | |
| 30 | 19 |
| 31 PackageRef parseRef(String name, description, {String containingPath}) { | 20 PackageRef parseRef(String name, description, {String containingPath}) { |
| 32 if (!description.endsWith(' desc')) throw new FormatException('Bad'); | 21 if (!description.endsWith(' desc')) throw new FormatException('Bad'); |
| 33 return new PackageRef(name, this.name, description); | 22 return new PackageRef(name, this.name, description); |
| 34 } | 23 } |
| 35 | 24 |
| 36 PackageId parseId(String name, Version version, description) { | 25 PackageId parseId(String name, Version version, description) { |
| 37 if (!description.endsWith(' desc')) throw new FormatException('Bad'); | 26 if (!description.endsWith(' desc')) throw new FormatException('Bad'); |
| 38 return new PackageId(name, this.name, version, description); | 27 return new PackageId(name, this.name, version, description); |
| 39 } | 28 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 'bar': { | 206 'bar': { |
| 218 'version': '3.2.1', | 207 'version': '3.2.1', |
| 219 'source': 'mock', | 208 'source': 'mock', |
| 220 'description': 'bar desc' | 209 'description': 'bar desc' |
| 221 } | 210 } |
| 222 } | 211 } |
| 223 })); | 212 })); |
| 224 }); | 213 }); |
| 225 }); | 214 }); |
| 226 } | 215 } |
| OLD | NEW |