| 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/package.dart'; | 5 import 'package:pub/src/package.dart'; |
| 8 import 'package:pub/src/pubspec.dart'; | 6 import 'package:pub/src/pubspec.dart'; |
| 9 import 'package:pub/src/source.dart'; | 7 import 'package:pub/src/source.dart'; |
| 10 import 'package:pub/src/source/path.dart'; | 8 import 'package:pub/src/source/path.dart'; |
| 11 import 'package:pub/src/source_registry.dart'; | 9 import 'package:pub/src/source_registry.dart'; |
| 10 import 'package:pub/src/system_cache.dart'; |
| 12 import 'package:pub_semver/pub_semver.dart'; | 11 import 'package:pub_semver/pub_semver.dart'; |
| 13 import 'package:test/test.dart'; | 12 import 'package:test/test.dart'; |
| 14 | 13 |
| 15 class MockSource extends Source { | 14 class MockSource extends Source { |
| 16 final String name = "mock"; | 15 final String name = "mock"; |
| 17 | 16 |
| 18 Future<List<PackageId>> doGetVersions(PackageRef ref) => | 17 LiveSource bind(SystemCache cache) => |
| 19 throw new UnsupportedError("Cannot get mock package versions."); | 18 throw new UnsupportedError("Cannot download mock packages."); |
| 20 | |
| 21 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( | |
| 22 "Cannot describe mock packages."); | |
| 23 | |
| 24 Future get(PackageId id, String symlink) => throw new UnsupportedError( | |
| 25 "Cannot get a mock package."); | |
| 26 | |
| 27 String getDirectory(PackageId id) => throw new UnsupportedError( | |
| 28 "Cannot get the directory for mock packages."); | |
| 29 | 19 |
| 30 PackageRef parseRef(String name, description, {String containingPath}) { | 20 PackageRef parseRef(String name, description, {String containingPath}) { |
| 31 if (description != 'ok') throw new FormatException('Bad'); | 21 if (description != 'ok') throw new FormatException('Bad'); |
| 32 return new PackageRef(name, this.name, description); | 22 return new PackageRef(name, this.name, description); |
| 33 } | 23 } |
| 34 | 24 |
| 35 PackageId parseId(String name, Version version, description) => | 25 PackageId parseId(String name, Version version, description) => |
| 36 new PackageId(name, this.name, version, description); | 26 new PackageId(name, this.name, version, description); |
| 37 | 27 |
| 38 bool descriptionsEqual(description1, description2) => | 28 bool descriptionsEqual(description1, description2) => |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 test("uses the key if the value is null", () { | 521 test("uses the key if the value is null", () { |
| 532 var pubspec = new Pubspec.parse(''' | 522 var pubspec = new Pubspec.parse(''' |
| 533 executables: | 523 executables: |
| 534 command: | 524 command: |
| 535 ''', sources); | 525 ''', sources); |
| 536 expect(pubspec.executables['command'], equals('command')); | 526 expect(pubspec.executables['command'], equals('command')); |
| 537 }); | 527 }); |
| 538 }); | 528 }); |
| 539 }); | 529 }); |
| 540 } | 530 } |
| OLD | NEW |