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

Side by Side Diff: sdk/lib/_internal/pub/test/version_solver_test.dart

Issue 15889005: Jump past disjoint package on disjoint constraint. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove some debug code. Created 7 years, 7 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 | « sdk/lib/_internal/pub/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 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 691 }
692 } 692 }
693 693
694 testResolve('complex backtrack', map, result: { 694 testResolve('complex backtrack', map, result: {
695 'myapp from root': '0.0.0', 695 'myapp from root': '0.0.0',
696 'foo': '0.9.0', 696 'foo': '0.9.0',
697 'bar': '9.0.0', 697 'bar': '9.0.0',
698 'baz': '0.0.0' 698 'baz': '0.0.0'
699 }, maxTries: 100); 699 }, maxTries: 100);
700 700
701 // If there's a disjoint constraint on a package, then selecting other
702 // versions of it is a waste of time: no possible versions can match. We need
703 // to jump past it to the most recent package that affected the constraint.
704 testResolve('backjump past failed package on disjoint constraint', {
705 'myapp 0.0.0': {
706 'a': 'any',
707 'foo': '>2.0.0'
708 },
709 'a 1.0.0': {
710 'foo': 'any' // ok
711 },
712 'a 2.0.0': {
713 'foo': '<1.0.0' // disjoint with myapp's constraint on foo
714 },
715 'foo 2.0.0': {},
716 'foo 2.0.1': {},
717 'foo 2.0.2': {},
718 'foo 2.0.3': {},
719 'foo 2.0.4': {}
720 }, result: {
721 'myapp from root': '0.0.0',
722 'a': '1.0.0',
723 'foo': '2.0.4'
724 }, maxTries: 2);
725
701 // TODO(rnystrom): More tests. In particular: 726 // TODO(rnystrom): More tests. In particular:
702 // - Tests that demonstrate backtracking for every case that can cause a 727 // - Tests that demonstrate backtracking for every case that can cause a
703 // solution to fail (no versions, disjoint, etc.) 728 // solution to fail (no versions, disjoint, etc.)
704 // - Tests where there are multiple valid solutions and "best" is possibly 729 // - Tests where there are multiple valid solutions and "best" is possibly
705 // ambiguous to nail down which order the backtracker tries solutions. 730 // ambiguous to nail down which order the backtracker tries solutions.
706 } 731 }
707 732
708 sdkConstraint() { 733 sdkConstraint() {
709 var badVersion = '0.0.0-nope'; 734 var badVersion = '0.0.0-nope';
710 var goodVersion = sdk.version.toString(); 735 var goodVersion = sdk.version.toString();
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 var source = "mock1"; 1191 var source = "mock1";
1167 var match = new RegExp(r"(.*) from (.*)").firstMatch(description); 1192 var match = new RegExp(r"(.*) from (.*)").firstMatch(description);
1168 if (match != null) { 1193 if (match != null) {
1169 name = match[1]; 1194 name = match[1];
1170 source = match[2]; 1195 source = match[2];
1171 if (source == "root") source = null; 1196 if (source == "root") source = null;
1172 } 1197 }
1173 1198
1174 callback(isDev, name, source); 1199 callback(isDev, name, source);
1175 } 1200 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698