| 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_upgrade_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| 11 import '../lib/src/lock_file.dart'; | 11 import '../lib/src/lock_file.dart'; |
| 12 import '../lib/src/log.dart' as log; | 12 import '../lib/src/log.dart' as log; |
| 13 import '../lib/src/package.dart'; | 13 import '../lib/src/package.dart'; |
| 14 import '../lib/src/pubspec.dart'; | 14 import '../lib/src/pubspec.dart'; |
| 15 import '../lib/src/sdk.dart' as sdk; | 15 import '../lib/src/sdk.dart' as sdk; |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 throw new Exception('Pubspec for $id was already requested.'); | 1123 throw new Exception('Pubspec for $id was already requested.'); |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 _requestedPubspecs.putIfAbsent(id.description, () => new Set<Version>()); | 1126 _requestedPubspecs.putIfAbsent(id.description, () => new Set<Version>()); |
| 1127 _requestedPubspecs[id.description].add(id.version); | 1127 _requestedPubspecs[id.description].add(id.version); |
| 1128 | 1128 |
| 1129 return _packages[id.description][id.version].pubspec; | 1129 return _packages[id.description][id.version].pubspec; |
| 1130 }); | 1130 }); |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 Future<bool> install(PackageId id, String path) { | 1133 Future<bool> get(PackageId id, String path) { |
| 1134 throw new Exception('no'); | 1134 throw new Exception('no'); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 void addPackage(String description, Package package) { | 1137 void addPackage(String description, Package package) { |
| 1138 _packages.putIfAbsent(description, () => new Map<Version, Package>()); | 1138 _packages.putIfAbsent(description, () => new Map<Version, Package>()); |
| 1139 _packages[description][package.version] = package; | 1139 _packages[description][package.version] = package; |
| 1140 } | 1140 } |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 Package mockPackage(String description, String version, | 1143 Package mockPackage(String description, String version, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 var source = "mock1"; | 1188 var source = "mock1"; |
| 1189 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); | 1189 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); |
| 1190 if (match != null) { | 1190 if (match != null) { |
| 1191 name = match[1]; | 1191 name = match[1]; |
| 1192 source = match[2]; | 1192 source = match[2]; |
| 1193 if (source == "root") source = null; | 1193 if (source == "root") source = null; |
| 1194 } | 1194 } |
| 1195 | 1195 |
| 1196 callback(isDev, name, source); | 1196 callback(isDev, name, source); |
| 1197 } | 1197 } |
| OLD | NEW |