Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: utils/tests/pub/version_solver_test.dart

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/tests/pub/validator/size_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 class MockSource extends Source { 474 class MockSource extends Source {
475 final Map<String, Map<Version, Package>> _packages; 475 final Map<String, Map<Version, Package>> _packages;
476 476
477 final String name; 477 final String name;
478 bool get shouldCache => true; 478 bool get shouldCache => true;
479 479
480 MockSource(this.name) 480 MockSource(this.name)
481 : _packages = <String, Map<Version, Package>>{}; 481 : _packages = <String, Map<Version, Package>>{};
482 482
483 Future<List<Version>> getVersions(String name, String description) { 483 Future<List<Version>> getVersions(String name, String description) {
484 return new Future.of(() => _packages[description].keys.toList()); 484 return new Future.sync(() => _packages[description].keys.toList());
485 } 485 }
486 486
487 Future<Pubspec> describe(PackageId id) { 487 Future<Pubspec> describe(PackageId id) {
488 return new Future.of(() => _packages[id.name][id.version].pubspec); 488 return new Future.sync(() => _packages[id.name][id.version].pubspec);
489 } 489 }
490 490
491 Future<bool> install(PackageId id, String path) { 491 Future<bool> install(PackageId id, String path) {
492 throw 'no'; 492 throw 'no';
493 } 493 }
494 494
495 Package mockPackage(String description, String version, 495 Package mockPackage(String description, String version,
496 Map dependencyStrings) { 496 Map dependencyStrings) {
497 // Build the pubspec dependencies. 497 // Build the pubspec dependencies.
498 var dependencies = <PackageRef>[]; 498 var dependencies = <PackageRef>[];
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 }; 543 };
544 544
545 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); 545 var match = new RegExp(r"(.*) from (.*)").firstMatch(description);
546 if (match != null) { 546 if (match != null) {
547 name = match[1]; 547 name = match[1];
548 source = sourceNames[match[2]]; 548 source = sourceNames[match[2]];
549 } 549 }
550 550
551 callback(isDev, name, source); 551 callback(isDev, name, source);
552 } 552 }
OLDNEW
« no previous file with comments | « utils/tests/pub/validator/size_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698