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_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 |
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; |
16 import '../lib/src/source/cached.dart'; | 16 import '../lib/src/source/cached.dart'; |
17 import '../lib/src/system_cache.dart'; | 17 import '../lib/src/system_cache.dart'; |
18 import '../lib/src/utils.dart'; | 18 import '../lib/src/utils.dart'; |
19 import '../lib/src/version.dart'; | 19 import '../lib/src/version.dart'; |
20 import '../lib/src/solver/version_solver.dart'; | 20 import '../lib/src/solver/version_solver.dart'; |
21 import 'test_pub.dart'; | 21 import 'test_pub.dart'; |
22 | 22 |
23 MockSource source1; | 23 MockSource source1; |
24 MockSource source2; | 24 MockSource source2; |
25 | 25 |
26 main() { | 26 main() { |
27 initConfig(); | 27 initConfig(); |
28 | 28 |
29 // Uncomment this to debug failing tests. | 29 // Uncomment this to debug failing tests. |
30 // log.showSolver(); | 30 // log.verbosity = log.Verbosity.SOLVER; |
31 | 31 |
32 // Since this test isn't run from the SDK, it can't find the "version" file | 32 // Since this test isn't run from the SDK, it can't find the "version" file |
33 // to load. Instead, just manually inject a version. | 33 // to load. Instead, just manually inject a version. |
34 sdk.version = new Version(1, 2, 3); | 34 sdk.version = new Version(1, 2, 3); |
35 | 35 |
36 group('basic graph', basicGraph); | 36 group('basic graph', basicGraph); |
37 group('with lockfile', withLockFile); | 37 group('with lockfile', withLockFile); |
38 group('root dependency', rootDependency); | 38 group('root dependency', rootDependency); |
39 group('dev dependency', devDependency); | 39 group('dev dependency', devDependency); |
40 group('unsolvable', unsolvable); | 40 group('unsolvable', unsolvable); |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 testResolve(String description, Map packages, { | 1060 testResolve(String description, Map packages, { |
1061 Map lockfile, Map overrides, Map result, FailMatcherBuilder error, | 1061 Map lockfile, Map overrides, Map result, FailMatcherBuilder error, |
1062 int maxTries}) { | 1062 int maxTries}) { |
1063 _testResolve(test, description, packages, lockfile: lockfile, | 1063 _testResolve(test, description, packages, lockfile: lockfile, |
1064 overrides: overrides, result: result, error: error, maxTries: maxTries); | 1064 overrides: overrides, result: result, error: error, maxTries: maxTries); |
1065 } | 1065 } |
1066 | 1066 |
1067 solo_testResolve(String description, Map packages, { | 1067 solo_testResolve(String description, Map packages, { |
1068 Map lockfile, Map overrides, Map result, FailMatcherBuilder error, | 1068 Map lockfile, Map overrides, Map result, FailMatcherBuilder error, |
1069 int maxTries}) { | 1069 int maxTries}) { |
1070 log.showSolver(); | 1070 log.verbosity = log.Verbosity.SOLVER; |
1071 _testResolve(solo_test, description, packages, lockfile: lockfile, | 1071 _testResolve(solo_test, description, packages, lockfile: lockfile, |
1072 overrides: overrides, result: result, error: error, maxTries: maxTries); | 1072 overrides: overrides, result: result, error: error, maxTries: maxTries); |
1073 } | 1073 } |
1074 | 1074 |
1075 _testResolve(void testFn(String description, Function body), | 1075 _testResolve(void testFn(String description, Function body), |
1076 String description, Map packages, { | 1076 String description, Map packages, { |
1077 Map lockfile, Map overrides, Map result, FailMatcherBuilder error, | 1077 Map lockfile, Map overrides, Map result, FailMatcherBuilder error, |
1078 int maxTries}) { | 1078 int maxTries}) { |
1079 if (maxTries == null) maxTries = 1; | 1079 if (maxTries == null) maxTries = 1; |
1080 | 1080 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 } | 1473 } |
1474 | 1474 |
1475 var source = "mock1"; | 1475 var source = "mock1"; |
1476 if (match[7] != null) { | 1476 if (match[7] != null) { |
1477 source = match[7]; | 1477 source = match[7]; |
1478 if (source == "root") source = null; | 1478 if (source == "root") source = null; |
1479 } | 1479 } |
1480 | 1480 |
1481 return new PackageId(name, source, parsedVersion, description); | 1481 return new PackageId(name, source, parsedVersion, description); |
1482 } | 1482 } |
OLD | NEW |