| 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 | 8 |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 devDependencies.add(dep); | 1165 devDependencies.add(dep); |
| 1166 } else { | 1166 } else { |
| 1167 dependencies.add(dep); | 1167 dependencies.add(dep); |
| 1168 } | 1168 } |
| 1169 }); | 1169 }); |
| 1170 }); | 1170 }); |
| 1171 | 1171 |
| 1172 var name = description.replaceFirst(new RegExp(r"-[^-]+$"), ""); | 1172 var name = description.replaceFirst(new RegExp(r"-[^-]+$"), ""); |
| 1173 var pubspec = new Pubspec( | 1173 var pubspec = new Pubspec( |
| 1174 name, new Version.parse(version), dependencies, devDependencies, | 1174 name, new Version.parse(version), dependencies, devDependencies, |
| 1175 new PubspecEnvironment(sdkConstraint)); | 1175 new PubspecEnvironment(sdkConstraint), []); |
| 1176 return new Package.inMemory(pubspec); | 1176 return new Package.inMemory(pubspec); |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 void parseSource(String description, | 1179 void parseSource(String description, |
| 1180 callback(bool isDev, String name, String source)) { | 1180 callback(bool isDev, String name, String source)) { |
| 1181 var isDev = false; | 1181 var isDev = false; |
| 1182 | 1182 |
| 1183 if (description.startsWith("(dev) ")) { | 1183 if (description.startsWith("(dev) ")) { |
| 1184 description = description.substring("(dev) ".length); | 1184 description = description.substring("(dev) ".length); |
| 1185 isDev = true; | 1185 isDev = true; |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 var name = description; | 1188 var name = description; |
| 1189 var source = "mock1"; | 1189 var source = "mock1"; |
| 1190 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); | 1190 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); |
| 1191 if (match != null) { | 1191 if (match != null) { |
| 1192 name = match[1]; | 1192 name = match[1]; |
| 1193 source = match[2]; | 1193 source = match[2]; |
| 1194 if (source == "root") source = null; | 1194 if (source == "root") source = null; |
| 1195 } | 1195 } |
| 1196 | 1196 |
| 1197 callback(isDev, name, source); | 1197 callback(isDev, name, source); |
| 1198 } | 1198 } |
| OLD | NEW |