| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import '../../pub/lock_file.dart'; | 10 import '../../pub/lock_file.dart'; |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 class MockSource extends Source { | 471 class MockSource extends Source { |
| 472 final Map<String, Map<Version, Package>> _packages; | 472 final Map<String, Map<Version, Package>> _packages; |
| 473 | 473 |
| 474 final String name; | 474 final String name; |
| 475 bool get shouldCache => true; | 475 bool get shouldCache => true; |
| 476 | 476 |
| 477 MockSource(this.name) | 477 MockSource(this.name) |
| 478 : _packages = <String, Map<Version, Package>>{}; | 478 : _packages = <String, Map<Version, Package>>{}; |
| 479 | 479 |
| 480 Future<List<Version>> getVersions(String name, String description) { | 480 Future<List<Version>> getVersions(String name, String description) { |
| 481 return fakeAsync(() => _packages[description].keys); | 481 return fakeAsync(() => _packages[description].keys.toList()); |
| 482 } | 482 } |
| 483 | 483 |
| 484 Future<Pubspec> describe(PackageId id) { | 484 Future<Pubspec> describe(PackageId id) { |
| 485 return fakeAsync(() { | 485 return fakeAsync(() { |
| 486 return _packages[id.name][id.version].pubspec; | 486 return _packages[id.name][id.version].pubspec; |
| 487 }); | 487 }); |
| 488 } | 488 } |
| 489 | 489 |
| 490 Future<bool> install(PackageId id, String path) { | 490 Future<bool> install(PackageId id, String path) { |
| 491 throw 'no'; | 491 throw 'no'; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); | 553 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); |
| 554 if (match == null) return new Pair<String, Source>(name, source1); | 554 if (match == null) return new Pair<String, Source>(name, source1); |
| 555 switch (match[2]) { | 555 switch (match[2]) { |
| 556 case 'mock1': return new Pair<String, Source>(match[1], source1); | 556 case 'mock1': return new Pair<String, Source>(match[1], source1); |
| 557 case 'mock2': return new Pair<String, Source>(match[1], source2); | 557 case 'mock2': return new Pair<String, Source>(match[1], source2); |
| 558 case 'root': return new Pair<String, Source>(match[1], rootSource); | 558 case 'root': return new Pair<String, Source>(match[1], rootSource); |
| 559 case 'versionless': | 559 case 'versionless': |
| 560 return new Pair<String, Source>(match[1], versionlessSource); | 560 return new Pair<String, Source>(match[1], versionlessSource); |
| 561 } | 561 } |
| 562 } | 562 } |
| OLD | NEW |