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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 return new Future<Pubspec>.immediate(_packages[id.description].pubspec); | 521 return new Future<Pubspec>.immediate(_packages[id.description].pubspec); |
522 } | 522 } |
523 | 523 |
524 void addPackage(Package package) { | 524 void addPackage(Package package) { |
525 _packages[package.name] = package; | 525 _packages[package.name] = package; |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 Future fakeAsync(callback()) { | 529 Future fakeAsync(callback()) { |
530 var completer = new Completer(); | 530 var completer = new Completer(); |
531 new Timer(0, (_) { | 531 Timer.run(() { |
532 completer.complete(callback()); | 532 completer.complete(callback()); |
533 }); | 533 }); |
534 | 534 |
535 return completer.future; | 535 return completer.future; |
536 } | 536 } |
537 | 537 |
538 Pair<String, Source> parseSource(String name) { | 538 Pair<String, Source> parseSource(String name) { |
539 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); | 539 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); |
540 if (match == null) return new Pair<String, Source>(name, source1); | 540 if (match == null) return new Pair<String, Source>(name, source1); |
541 switch (match[2]) { | 541 switch (match[2]) { |
542 case 'mock1': return new Pair<String, Source>(match[1], source1); | 542 case 'mock1': return new Pair<String, Source>(match[1], source1); |
543 case 'mock2': return new Pair<String, Source>(match[1], source2); | 543 case 'mock2': return new Pair<String, Source>(match[1], source2); |
544 case 'root': return new Pair<String, Source>(match[1], null); | 544 case 'root': return new Pair<String, Source>(match[1], null); |
545 case 'versionless': | 545 case 'versionless': |
546 return new Pair<String, Source>(match[1], versionlessSource); | 546 return new Pair<String, Source>(match[1], versionlessSource); |
547 } | 547 } |
548 } | 548 } |
OLD | NEW |