| 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:pub/src/lock_file.dart'; | 9 import 'package:pub/src/lock_file.dart'; |
| 10 import 'package:pub/src/log.dart' as log; | 10 import 'package:pub/src/log.dart' as log; |
| 11 import 'package:pub/src/package.dart'; | 11 import 'package:pub/src/package.dart'; |
| 12 import 'package:pub/src/pubspec.dart'; | 12 import 'package:pub/src/pubspec.dart'; |
| 13 import 'package:pub/src/sdk.dart' as sdk; | 13 import 'package:pub/src/sdk.dart' as sdk; |
| 14 import 'package:pub/src/solver/version_solver.dart'; | 14 import 'package:pub/src/solver/version_solver.dart'; |
| 15 import 'package:pub/src/source/cached.dart'; | 15 import 'package:pub/src/source/cached.dart'; |
| 16 import 'package:pub/src/system_cache.dart'; | 16 import 'package:pub/src/system_cache.dart'; |
| 17 import 'package:pub/src/utils.dart'; | 17 import 'package:pub/src/utils.dart'; |
| 18 import 'package:pub_semver/pub_semver.dart'; | 18 import 'package:pub_semver/pub_semver.dart'; |
| 19 import 'package:unittest/unittest.dart'; | 19 import 'package:test/test.dart'; |
| 20 | 20 |
| 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(); | |
| 28 | |
| 29 // Uncomment this to debug failing tests. | 27 // Uncomment this to debug failing tests. |
| 30 // log.verbosity = log.Verbosity.SOLVER; | 28 // log.verbosity = log.Verbosity.SOLVER; |
| 31 | 29 |
| 32 // Since this test isn't run from the SDK, it can't find the "version" file | 30 // 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. | 31 // to load. Instead, just manually inject a version. |
| 34 sdk.version = new Version(1, 2, 3); | 32 sdk.version = new Version(1, 2, 3); |
| 35 | 33 |
| 36 group('basic graph', basicGraph); | 34 group('basic graph', basicGraph); |
| 37 group('with lockfile', withLockFile); | 35 group('with lockfile', withLockFile); |
| 38 group('root dependency', rootDependency); | 36 group('root dependency', rootDependency); |
| (...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 var realLockFile = new LockFile.empty(); | 1169 var realLockFile = new LockFile.empty(); |
| 1172 if (lockfile != null) { | 1170 if (lockfile != null) { |
| 1173 lockfile.forEach((name, version) { | 1171 lockfile.forEach((name, version) { |
| 1174 version = new Version.parse(version); | 1172 version = new Version.parse(version); |
| 1175 realLockFile.packages[name] = | 1173 realLockFile.packages[name] = |
| 1176 new PackageId(name, source1.name, version, name); | 1174 new PackageId(name, source1.name, version, name); |
| 1177 }); | 1175 }); |
| 1178 } | 1176 } |
| 1179 | 1177 |
| 1180 // Resolve the versions. | 1178 // Resolve the versions. |
| 1179 log.verbosity = log.Verbosity.NONE; |
| 1181 var future = resolveVersions( | 1180 var future = resolveVersions( |
| 1182 downgrade ? SolveType.DOWNGRADE : SolveType.GET, | 1181 downgrade ? SolveType.DOWNGRADE : SolveType.GET, |
| 1183 cache.sources, root, lockFile: realLockFile); | 1182 cache.sources, root, lockFile: realLockFile); |
| 1184 | 1183 |
| 1185 var matcher; | 1184 var matcher; |
| 1186 if (result != null) { | 1185 if (result != null) { |
| 1187 matcher = new SolveSuccessMatcher(result, maxTries); | 1186 matcher = new SolveSuccessMatcher(result, maxTries); |
| 1188 } else if (error != null) { | 1187 } else if (error != null) { |
| 1189 matcher = error(maxTries); | 1188 matcher = error(maxTries); |
| 1190 } | 1189 } |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 } | 1532 } |
| 1534 | 1533 |
| 1535 var source = "mock1"; | 1534 var source = "mock1"; |
| 1536 if (match[7] != null) { | 1535 if (match[7] != null) { |
| 1537 source = match[7]; | 1536 source = match[7]; |
| 1538 if (source == "root") source = null; | 1537 if (source == "root") source = null; |
| 1539 } | 1538 } |
| 1540 | 1539 |
| 1541 return new PackageId(name, source, parsedVersion, description); | 1540 return new PackageId(name, source, parsedVersion, description); |
| 1542 } | 1541 } |
| OLD | NEW |