| 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 library pub_update_test; | 5 library pub_update_test; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:isolate'; | 8 import 'dart:isolate'; |
| 9 | 9 |
| 10 import '../../pub/lock_file.dart'; | 10 import '../../pub/lock_file.dart'; |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 class MockSource extends Source { | 442 class MockSource extends Source { |
| 443 final Map<String, Map<Version, Package>> _packages; | 443 final Map<String, Map<Version, Package>> _packages; |
| 444 | 444 |
| 445 final String name; | 445 final String name; |
| 446 bool get shouldCache => true; | 446 bool get shouldCache => true; |
| 447 | 447 |
| 448 MockSource(this.name) | 448 MockSource(this.name) |
| 449 : _packages = <String, Map<Version, Package>>{}; | 449 : _packages = <String, Map<Version, Package>>{}; |
| 450 | 450 |
| 451 Future<List<Version>> getVersions(String name, String description) { | 451 Future<List<Version>> getVersions(String name, String description) { |
| 452 return fakeAsync(() => _packages[description].getKeys()); | 452 return fakeAsync(() => _packages[description].keys); |
| 453 } | 453 } |
| 454 | 454 |
| 455 Future<Pubspec> describe(PackageId id) { | 455 Future<Pubspec> describe(PackageId id) { |
| 456 return fakeAsync(() { | 456 return fakeAsync(() { |
| 457 return _packages[id.name][id.version].pubspec; | 457 return _packages[id.name][id.version].pubspec; |
| 458 }); | 458 }); |
| 459 } | 459 } |
| 460 | 460 |
| 461 Future<bool> install(PackageId id, String path) { | 461 Future<bool> install(PackageId id, String path) { |
| 462 throw 'no'; | 462 throw 'no'; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); | 524 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); |
| 525 if (match == null) return new Pair<String, Source>(name, source1); | 525 if (match == null) return new Pair<String, Source>(name, source1); |
| 526 switch (match[2]) { | 526 switch (match[2]) { |
| 527 case 'mock1': return new Pair<String, Source>(match[1], source1); | 527 case 'mock1': return new Pair<String, Source>(match[1], source1); |
| 528 case 'mock2': return new Pair<String, Source>(match[1], source2); | 528 case 'mock2': return new Pair<String, Source>(match[1], source2); |
| 529 case 'root': return new Pair<String, Source>(match[1], rootSource); | 529 case 'root': return new Pair<String, Source>(match[1], rootSource); |
| 530 case 'versionless': | 530 case 'versionless': |
| 531 return new Pair<String, Source>(match[1], versionlessSource); | 531 return new Pair<String, Source>(match[1], versionlessSource); |
| 532 } | 532 } |
| 533 } | 533 } |
| OLD | NEW |