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

Side by Side Diff: test/version_solver_test.dart

Issue 2276943003: Improve circular dependency overrides. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 3 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
« no previous file with comments | « lib/src/solver/backtracking_solver.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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:path/path.dart' as p; 7 import 'package:path/path.dart' as p;
8 import 'package:scheduled_test/scheduled_test.dart'; 8 import 'package:scheduled_test/scheduled_test.dart';
9 9
10 import 'package:pub/src/lock_file.dart'; 10 import 'package:pub/src/lock_file.dart';
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 'dependency_overrides': {'foo': '>=1.0.0 <2.0.0'} 1209 'dependency_overrides': {'foo': '>=1.0.0 <2.0.0'}
1210 }) 1210 })
1211 ]).create(); 1211 ]).create();
1212 1212
1213 expectResolves( 1213 expectResolves(
1214 error: 'Package foo has no versions that match >=1.0.0 <2.0.0 derived ' 1214 error: 'Package foo has no versions that match >=1.0.0 <2.0.0 derived '
1215 'from:\n' 1215 'from:\n'
1216 '- myapp depends on version >=1.0.0 <2.0.0'); 1216 '- myapp depends on version >=1.0.0 <2.0.0');
1217 }); 1217 });
1218 1218
1219 integration('override a bad source without error', () { 1219 integration('overrides a bad source without error', () {
1220 servePackages((builder) { 1220 servePackages((builder) {
1221 builder.serve('foo', '0.0.0'); 1221 builder.serve('foo', '0.0.0');
1222 }); 1222 });
1223 1223
1224 d.dir(appPath, [ 1224 d.dir(appPath, [
1225 d.pubspec({ 1225 d.pubspec({
1226 'name': 'myapp', 1226 'name': 'myapp',
1227 'dependencies': {'foo': {'bad': 'any'}}, 1227 'dependencies': {'foo': {'bad': 'any'}},
1228 'dependency_overrides': {'foo': 'any'} 1228 'dependency_overrides': {'foo': 'any'}
1229 }) 1229 })
1230 ]).create(); 1230 ]).create();
1231 1231
1232 expectResolves(result: {'foo': '0.0.0'}); 1232 expectResolves(result: {'foo': '0.0.0'});
1233 }); 1233 });
1234
1235 integration('overrides an unmatched root dependency', () {
1236 servePackages((builder) {
1237 builder.serve('foo', '0.0.0', deps: {'myapp': '1.0.0'});
1238 });
1239
1240 d.dir(appPath, [
1241 d.pubspec({
1242 'name': 'myapp',
1243 'version': '2.0.0',
1244 'dependency_overrides': {'foo': 'any'}
1245 })
1246 ]).create();
1247
1248 expectResolves(result: {'foo': '0.0.0'});
1249 });
1234 } 1250 }
1235 1251
1236 void downgrade() { 1252 void downgrade() {
1237 integration("downgrades a dependency to the lowest matching version", () { 1253 integration("downgrades a dependency to the lowest matching version", () {
1238 servePackages((builder) { 1254 servePackages((builder) {
1239 builder.serve('foo', '1.0.0'); 1255 builder.serve('foo', '1.0.0');
1240 builder.serve('foo', '2.0.0-dev'); 1256 builder.serve('foo', '2.0.0-dev');
1241 builder.serve('foo', '2.0.0'); 1257 builder.serve('foo', '2.0.0');
1242 builder.serve('foo', '2.1.0'); 1258 builder.serve('foo', '2.1.0');
1243 }); 1259 });
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 dep = registry.hosted 1329 dep = registry.hosted
1314 .refFor(dep.name, url: await globalPackageServer.url) 1330 .refFor(dep.name, url: await globalPackageServer.url)
1315 .withConstraint(dep.constraint); 1331 .withConstraint(dep.constraint);
1316 } 1332 }
1317 expect(dep.allows(id), isTrue, reason: "Expected $id to match $dep."); 1333 expect(dep.allows(id), isTrue, reason: "Expected $id to match $dep.");
1318 } 1334 }
1319 1335
1320 expect(ids, isEmpty, reason: "Expected no additional packages."); 1336 expect(ids, isEmpty, reason: "Expected no additional packages.");
1321 }); 1337 });
1322 } 1338 }
OLDNEW
« no previous file with comments | « lib/src/solver/backtracking_solver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698