OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS d.file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE d.file. |
4 | 4 |
5 import 'package:path/path.dart' as p; | 5 import 'package:path/path.dart' as p; |
6 | 6 |
7 import 'package:scheduled_test/scheduled_test.dart'; | 7 import 'package:scheduled_test/scheduled_test.dart'; |
8 | 8 |
9 import 'package:pub/src/exit_codes.dart' as exit_codes; | 9 import 'package:pub/src/exit_codes.dart' as exit_codes; |
10 | 10 |
(...skipping 22 matching lines...) Loading... |
33 pubCommand(command, | 33 pubCommand(command, |
34 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}); | 34 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}); |
35 | 35 |
36 d.dir(appPath, [ | 36 d.dir(appPath, [ |
37 d.packagesFile({ | 37 d.packagesFile({ |
38 'myapp': '.', | 38 'myapp': '.', |
39 'foo': p.join(sandboxDir, 'flutter', 'packages', 'foo'), | 39 'foo': p.join(sandboxDir, 'flutter', 'packages', 'foo'), |
40 'bar': '1.0.0' | 40 'bar': '1.0.0' |
41 }) | 41 }) |
42 ]).validate(); | 42 ]).validate(); |
43 | |
44 d.packagesDir({'foo': '0.0.1', 'bar': '1.0.0'}).validate(); | |
45 }); | 43 }); |
46 | 44 |
47 group("fails if", () { | 45 group("fails if", () { |
48 integration("the version constraint doesn't match", () { | 46 integration("the version constraint doesn't match", () { |
49 d.appDir({"foo": {"sdk": "flutter", "version": "^1.0.0"}}).create(); | 47 d.appDir({"foo": {"sdk": "flutter", "version": "^1.0.0"}}).create(); |
50 pubCommand(command, | 48 pubCommand(command, |
51 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}, | 49 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}, |
52 error: 'Package foo has no versions that match >=1.0.0 <2.0.0 ' | 50 error: 'Package foo has no versions that match >=1.0.0 <2.0.0 ' |
53 'derived from:\n' | 51 'derived from:\n' |
54 '- myapp depends on version ^1.0.0'); | 52 '- myapp depends on version ^1.0.0'); |
55 }); | 53 }); |
56 | 54 |
57 integration("the SDK is unknown", () { | 55 integration("the SDK is unknown", () { |
58 d.appDir({"foo": {"sdk": "unknown"}}).create(); | 56 d.appDir({"foo": {"sdk": "unknown"}}).create(); |
59 pubCommand(command, | 57 pubCommand(command, |
60 error: 'Unknown SDK "unknown".\n' | 58 error: 'Unknown SDK "unknown".\n' |
61 'Depended on by:\n' | 59 'Depended on by:\n' |
62 '- myapp', | 60 '- myapp', |
63 exitCode: exit_codes.UNAVAILABLE); | 61 exitCode: exit_codes.UNAVAILABLE); |
64 }); | 62 }); |
65 | 63 |
66 integration("the SDK is unavailable", () { | 64 integration("the SDK is unavailable", () { |
67 d.appDir({"foo": {"sdk": "flutter"}}).create(); | 65 d.appDir({"foo": {"sdk": "flutter"}}).create(); |
68 pubCommand(command, | 66 pubCommand(command, |
69 error: 'The Flutter SDK is not available.\n' | 67 error: 'The Flutter SDK is not available.\n' |
70 'Depended on by:\n' | 68 'Depended on by:\n' |
71 '- myapp', | 69 '- myapp', |
72 exitCode: exit_codes.UNAVAILABLE); | 70 exitCode: exit_codes.UNAVAILABLE); |
73 }); | 71 }); |
74 | 72 |
75 integration("the SDK doesn't contain the package", () { | 73 integration("the SDK doesn't contain the package", () { |
76 d.appDir({"bar": {"sdk": "flutter"}}).create(); | 74 d.appDir({"bar": {"sdk": "flutter"}}).create(); |
77 pubCommand(command, | 75 pubCommand(command, |
78 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}, | 76 environment: {'FLUTTER_ROOT': p.join(sandboxDir, 'flutter')}, |
79 error: 'Could not find package bar in the Flutter SDK.\n' | 77 error: 'Could not find package bar in the Flutter SDK.\n' |
80 'Depended on by:\n' | 78 'Depended on by:\n' |
81 '- myapp', | 79 '- myapp', |
82 exitCode: exit_codes.UNAVAILABLE); | 80 exitCode: exit_codes.UNAVAILABLE); |
83 }); | 81 }); |
84 | 82 |
85 integration("the Dart SDK doesn't contain the package", () { | 83 integration("the Dart SDK doesn't contain the package", () { |
86 d.appDir({"bar": {"sdk": "dart"}}).create(); | 84 d.appDir({"bar": {"sdk": "dart"}}).create(); |
87 pubCommand(command, | 85 pubCommand(command, |
88 error: 'Could not find package bar in the Dart SDK.\n' | 86 error: 'Could not find package bar in the Dart SDK.\n' |
89 'Depended on by:\n' | 87 'Depended on by:\n' |
90 '- myapp', | 88 '- myapp', |
91 exitCode: exit_codes.UNAVAILABLE); | 89 exitCode: exit_codes.UNAVAILABLE); |
92 }); | 90 }); |
93 }); | 91 }); |
94 }); | 92 }); |
95 } | 93 } |
OLD | NEW |