OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'package:pub/src/entrypoint.dart'; | 5 import 'package:pub/src/entrypoint.dart'; |
6 import 'package:pub/src/validator.dart'; | 6 import 'package:pub/src/validator.dart'; |
7 import 'package:pub/src/validator/dependency_override.dart'; | 7 import 'package:pub/src/validator/dependency_override.dart'; |
| 8 import 'package:scheduled_test/scheduled_test.dart'; |
8 | 9 |
9 import '../descriptor.dart' as d; | 10 import '../descriptor.dart' as d; |
10 import '../test_pub.dart'; | 11 import '../test_pub.dart'; |
11 import 'utils.dart'; | 12 import 'utils.dart'; |
12 | 13 |
13 Validator dependencyOverride(Entrypoint entrypoint) => | 14 Validator dependencyOverride(Entrypoint entrypoint) => |
14 new DependencyOverrideValidator(entrypoint); | 15 new DependencyOverrideValidator(entrypoint); |
15 | 16 |
16 main() { | 17 main() { |
17 integration('invalidates a package if it has dependency overrides', () { | 18 integration('should consider a package valid if it has dev dependency ' |
| 19 'overrides', () { |
18 d.dir(appPath, [ | 20 d.dir(appPath, [ |
19 d.pubspec({ | 21 d.pubspec({ |
20 "name": "myapp", | 22 "name": "myapp", |
| 23 "dev_dependencies": { |
| 24 "foo": "1.0.0" |
| 25 }, |
21 "dependency_overrides": { | 26 "dependency_overrides": { |
22 "foo": "<3.0.0" | 27 "foo": "<3.0.0" |
23 } | 28 } |
24 }) | 29 }) |
25 ]).create(); | 30 ]).create(); |
26 | 31 |
27 expectValidationError(dependencyOverride); | 32 expectNoValidationError(dependencyOverride); |
| 33 }); |
| 34 |
| 35 group('should consider a package invalid if', () { |
| 36 integration('it has only non-dev dependency overrides', () { |
| 37 d.dir(appPath, [ |
| 38 d.pubspec({ |
| 39 "name": "myapp", |
| 40 "dependency_overrides": { |
| 41 "foo": "<3.0.0" |
| 42 } |
| 43 }) |
| 44 ]).create(); |
| 45 |
| 46 expectValidationError(dependencyOverride); |
| 47 }); |
| 48 |
| 49 integration('it has any non-dev dependency overrides', () { |
| 50 d.dir(appPath, [ |
| 51 d.pubspec({ |
| 52 "name": "myapp", |
| 53 "dev_dependencies": { |
| 54 "foo": "1.0.0" |
| 55 }, |
| 56 "dependency_overrides": { |
| 57 "foo": "<3.0.0", |
| 58 "bar": ">3.0.0", |
| 59 } |
| 60 }) |
| 61 ]).create(); |
| 62 |
| 63 expectValidationError(dependencyOverride); |
| 64 }); |
28 }); | 65 }); |
29 } | 66 } |
OLD | NEW |