| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 | 7 |
| 8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart'; | 9 import 'package:http/testing.dart'; |
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| 11 import 'package:pub/src/entrypoint.dart'; | 11 import 'package:pub/src/entrypoint.dart'; |
| 12 import 'package:pub/src/validator.dart'; | 12 import 'package:pub/src/validator.dart'; |
| 13 import 'package:pub/src/validator/sdk_constraint.dart'; | 13 import 'package:pub/src/validator/sdk_constraint.dart'; |
| 14 import 'package:scheduled_test/scheduled_test.dart'; | 14 import 'package:scheduled_test/scheduled_test.dart'; |
| 15 | 15 |
| 16 import '../descriptor.dart' as d; | 16 import '../descriptor.dart' as d; |
| 17 import '../test_pub.dart'; | 17 import '../test_pub.dart'; |
| 18 import 'utils.dart'; | 18 import 'utils.dart'; |
| 19 | 19 |
| 20 Validator sdkConstraint(Entrypoint entrypoint) => | 20 Validator sdkConstraint(Entrypoint entrypoint) => |
| 21 new SdkConstraintValidator(entrypoint); | 21 new SdkConstraintValidator(entrypoint); |
| 22 | 22 |
| 23 main() { | 23 main() { |
| 24 initConfig(); | |
| 25 | |
| 26 group('should consider a package valid if it', () { | 24 group('should consider a package valid if it', () { |
| 27 integration('has no SDK constraint', () { | 25 integration('has no SDK constraint', () { |
| 28 d.validPackage.create(); | 26 d.validPackage.create(); |
| 29 expectNoValidationError(sdkConstraint); | 27 expectNoValidationError(sdkConstraint); |
| 30 }); | 28 }); |
| 31 | 29 |
| 32 integration('has an SDK constraint without ^', () { | 30 integration('has an SDK constraint without ^', () { |
| 33 d.dir(appPath, [ | 31 d.dir(appPath, [ |
| 34 d.libPubspec("test_pkg", "1.0.0", sdk: ">=1.8.0 <2.0.0") | 32 d.libPubspec("test_pkg", "1.0.0", sdk: ">=1.8.0 <2.0.0") |
| 35 ]).create(); | 33 ]).create(); |
| 36 expectNoValidationError(sdkConstraint); | 34 expectNoValidationError(sdkConstraint); |
| 37 }); | 35 }); |
| 38 }); | 36 }); |
| 39 | 37 |
| 40 test("should consider a package invalid if it has an SDK constraint with " | 38 test("should consider a package invalid if it has an SDK constraint with " |
| 41 "^", () { | 39 "^", () { |
| 42 d.dir(appPath, [ | 40 d.dir(appPath, [ |
| 43 d.libPubspec("test_pkg", "1.0.0", sdk: "^1.8.0") | 41 d.libPubspec("test_pkg", "1.0.0", sdk: "^1.8.0") |
| 44 ]).create(); | 42 ]).create(); |
| 45 expect(schedulePackageValidation(sdkConstraint), | 43 expect(schedulePackageValidation(sdkConstraint), |
| 46 completion(pairOf(anyElement(contains('">=1.8.0 <2.0.0"')), isEmpty))); | 44 completion(pairOf(anyElement(contains('">=1.8.0 <2.0.0"')), isEmpty))); |
| 47 }); | 45 }); |
| 48 } | 46 } |
| OLD | NEW |