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

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

Issue 277633003: Remember previously failed packages when backtracking. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
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_upgrade_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
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 'foo 2.0.1': {}, 773 'foo 2.0.1': {},
774 'foo 2.0.2': {}, 774 'foo 2.0.2': {},
775 'foo 2.0.3': {}, 775 'foo 2.0.3': {},
776 'foo 2.0.4': {} 776 'foo 2.0.4': {}
777 }, result: { 777 }, result: {
778 'myapp from root': '0.0.0', 778 'myapp from root': '0.0.0',
779 'a': '1.0.0', 779 'a': '1.0.0',
780 'foo': '2.0.4' 780 'foo': '2.0.4'
781 }, maxTries: 2); 781 }, maxTries: 2);
782 782
783 // TODO(rnystrom): More tests. In particular: 783 // This is a regression test for #18666. It was possible for the solver to
784 // - Tests that demonstrate backtracking for every case that can cause a 784 // "forget" that a package had previously led to an error. In that case, it
785 // solution to fail (no versions, disjoint, etc.) 785 // would backtrack over the failed package instead of trying different
786 // - Tests where there are multiple valid solutions and "best" is possibly 786 // versions of it.
787 // ambiguous to nail down which order the backtracker tries solutions. 787 testResolve("finds solution with less strict constraint", {
788 "myapp 1.0.0": {
789 "a": "any",
790 "c": "any",
791 "d": "any"
792 },
793 "a 2.0.0": {},
794 "a 1.0.0": {},
795 "b 1.0.0": {"a": "1.0.0"},
796 "c 1.0.0": {"b": "any"},
797 "d 2.0.0": {"myapp": "any"},
798 "d 1.0.0": {"myapp": "<1.0.0"}
799 }, result: {
800 'myapp from root': '1.0.0',
801 'a': '1.0.0',
802 'b': '1.0.0',
803 'c': '1.0.0',
804 'd': '2.0.0'
805 }, maxTries: 3);
788 } 806 }
789 807
790 sdkConstraint() { 808 sdkConstraint() {
791 var badVersion = '0.0.0-nope'; 809 var badVersion = '0.0.0-nope';
792 var goodVersion = sdk.version.toString(); 810 var goodVersion = sdk.version.toString();
793 811
794 testResolve('root matches SDK', { 812 testResolve('root matches SDK', {
795 'myapp 0.0.0': {'sdk': goodVersion } 813 'myapp 0.0.0': {'sdk': goodVersion }
796 }, result: { 814 }, result: {
797 'myapp from root': '0.0.0' 815 'myapp from root': '0.0.0'
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 } 1473 }
1456 1474
1457 var source = "mock1"; 1475 var source = "mock1";
1458 if (match[7] != null) { 1476 if (match[7] != null) {
1459 source = match[7]; 1477 source = match[7];
1460 if (source == "root") source = null; 1478 if (source == "root") source = null;
1461 } 1479 }
1462 1480
1463 return new PackageId(name, source, parsedVersion, description); 1481 return new PackageId(name, source, parsedVersion, description);
1464 } 1482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698