OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS d.file |
| 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 d.file. |
| 4 |
| 5 import 'package:path/path.dart' as p; |
| 6 |
| 7 import 'package:scheduled_test/scheduled_test.dart'; |
| 8 |
| 9 import 'package:pub/src/exit_codes.dart' as exit_codes; |
| 10 |
| 11 import 'descriptor.dart' as d; |
| 12 import 'test_pub.dart'; |
| 13 |
| 14 main() { |
| 15 forBothPubGetAndUpgrade((command) { |
| 16 setUp(() { |
| 17 servePackages((builder) { |
| 18 builder.serve('bar', '1.0.0'); |
| 19 }); |
| 20 |
| 21 d.dir('flutter', [ |
| 22 d.dir('packages', [ |
| 23 d.dir('foo', [ |
| 24 d.libDir('foo', 'foo 0.0.1'), |
| 25 d.libPubspec('foo', '0.0.1', deps: {'bar': 'any'}) |
| 26 ]) |
| 27 ]) |
| 28 ]).create(); |
| 29 }); |
| 30 |
| 31 integration("gets an SDK dependency's dependencies", () { |
| 32 d.appDir({"foo": {"sdk": "flutter"}}).create(); |
| 33 pubCommand(command, |
| 34 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}); |
| 35 |
| 36 d.dir(appPath, [ |
| 37 d.packagesFile({ |
| 38 'myapp': '.', |
| 39 'foo': p.join(sandboxDir, 'flutter', 'packages', 'foo'), |
| 40 'bar': '1.0.0' |
| 41 }) |
| 42 ]).validate(); |
| 43 |
| 44 d.packagesDir({'foo': '0.0.1', 'bar': '1.0.0'}).validate(); |
| 45 }); |
| 46 |
| 47 group("fails if", () { |
| 48 integration("the version constraint doesn't match", () { |
| 49 d.appDir({"foo": {"sdk": "flutter", "version": "^1.0.0"}}).create(); |
| 50 pubCommand(command, |
| 51 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}, |
| 52 error: 'Package foo has no versions that match >=1.0.0 <2.0.0 ' |
| 53 'derived from:\n' |
| 54 '- myapp depends on version ^1.0.0'); |
| 55 }); |
| 56 |
| 57 integration("the SDK is unknown", () { |
| 58 d.appDir({"foo": {"sdk": "unknown"}}).create(); |
| 59 pubCommand(command, |
| 60 error: 'Unknown SDK "unknown".\n' |
| 61 'Depended on by:\n' |
| 62 '- myapp', |
| 63 exitCode: exit_codes.UNAVAILABLE); |
| 64 }); |
| 65 |
| 66 integration("the SDK is unavailable", () { |
| 67 d.appDir({"foo": {"sdk": "flutter"}}).create(); |
| 68 pubCommand(command, |
| 69 error: 'The Flutter SDK is not available.\n' |
| 70 'Depended on by:\n' |
| 71 '- myapp', |
| 72 exitCode: exit_codes.UNAVAILABLE); |
| 73 }); |
| 74 |
| 75 integration("the SDK doesn't contain the package", () { |
| 76 d.appDir({"bar": {"sdk": "flutter"}}).create(); |
| 77 pubCommand(command, |
| 78 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}, |
| 79 error: 'Could not find package bar in the Flutter SDK.\n' |
| 80 'Depended on by:\n' |
| 81 '- myapp', |
| 82 exitCode: exit_codes.UNAVAILABLE); |
| 83 }); |
| 84 |
| 85 integration("the Dart SDK doesn't contain the package", () { |
| 86 d.appDir({"bar": {"sdk": "dart"}}).create(); |
| 87 pubCommand(command, |
| 88 error: 'Could not find package bar in the Dart SDK.\n' |
| 89 'Depended on by:\n' |
| 90 '- myapp', |
| 91 exitCode: exit_codes.UNAVAILABLE); |
| 92 }); |
| 93 }); |
| 94 }); |
| 95 } |
OLD | NEW |