Index: sdk/lib/_internal/pub_generated/test/validator/dependency_test.dart |
diff --git a/sdk/lib/_internal/pub/test/validator/dependency_test.dart b/sdk/lib/_internal/pub_generated/test/validator/dependency_test.dart |
similarity index 59% |
copy from sdk/lib/_internal/pub/test/validator/dependency_test.dart |
copy to sdk/lib/_internal/pub_generated/test/validator/dependency_test.dart |
index dd301294c0dce744463a2fa28063ab0a6e51f4f3..689fc66130cc7950ca248448f7b75e9767ba7b7e 100644 |
--- a/sdk/lib/_internal/pub/test/validator/dependency_test.dart |
+++ b/sdk/lib/_internal/pub_generated/test/validator/dependency_test.dart |
@@ -18,15 +18,17 @@ import '../test_pub.dart'; |
import 'utils.dart'; |
Validator dependency(Entrypoint entrypoint) => |
- new DependencyValidator(entrypoint); |
+ new DependencyValidator(entrypoint); |
expectDependencyValidationError(String error) { |
- expect(schedulePackageValidation(dependency), |
+ expect( |
+ schedulePackageValidation(dependency), |
completion(pairOf(anyElement(contains(error)), isEmpty))); |
} |
expectDependencyValidationWarning(String warning) { |
- expect(schedulePackageValidation(dependency), |
+ expect( |
+ schedulePackageValidation(dependency), |
completion(pairOf(isEmpty, anyElement(contains(warning))))); |
} |
@@ -43,15 +45,15 @@ setUpDependency(Map dep, {List<String> hostedVersions}) { |
return new Future.value(new http.Response(JSON.encode({ |
"name": "foo", |
"uploaders": ["nweiz@google.com"], |
- "versions": hostedVersions.map((version) => |
- packageVersionApiMap(packageMap('foo', version))).toList() |
+ "versions": hostedVersions.map( |
+ (version) => packageVersionApiMap(packageMap('foo', version))).toList() |
}), 200)); |
} |
})); |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: {"foo": dep}) |
- ]).create(); |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
+ "foo": dep |
+ })]).create(); |
} |
main() { |
@@ -64,11 +66,9 @@ main() { |
}); |
integration('has a ^ constraint with an appropriate SDK constraint', () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "^1.2.3" |
- }, sdk: ">=1.8.0 <2.0.0") |
- ]).create(); |
+ }, sdk: ">=1.8.0 <2.0.0")]).create(); |
expectNoValidationError(dependency); |
}); |
}); |
@@ -79,22 +79,28 @@ main() { |
group('has a git dependency', () { |
group('where a hosted version exists', () { |
integration("and should suggest the hosted primary version", () { |
- setUpDependency({'git': 'git://github.com/dart-lang/foo'}, |
- hostedVersions: ["3.0.0-pre", "2.0.0", "1.0.0"]); |
+ setUpDependency({ |
+ 'git': 'git://github.com/dart-lang/foo' |
+ }, hostedVersions: ["3.0.0-pre", "2.0.0", "1.0.0"]); |
expectDependencyValidationWarning(' foo: ">=2.0.0 <3.0.0"'); |
}); |
- integration("and should suggest the hosted prerelease version if " |
- "it's the only version available", () { |
- setUpDependency({'git': 'git://github.com/dart-lang/foo'}, |
- hostedVersions: ["3.0.0-pre", "2.0.0-pre"]); |
+ integration( |
+ "and should suggest the hosted prerelease version if " |
+ "it's the only version available", |
+ () { |
+ setUpDependency({ |
+ 'git': 'git://github.com/dart-lang/foo' |
+ }, hostedVersions: ["3.0.0-pre", "2.0.0-pre"]); |
expectDependencyValidationWarning(' foo: ">=3.0.0-pre <4.0.0"'); |
}); |
- integration("and should suggest a tighter constraint if primary is " |
- "pre-1.0.0", () { |
- setUpDependency({'git': 'git://github.com/dart-lang/foo'}, |
- hostedVersions: ["0.0.1", "0.0.2"]); |
+ integration( |
+ "and should suggest a tighter constraint if primary is " "pre-1.0.0", |
+ () { |
+ setUpDependency({ |
+ 'git': 'git://github.com/dart-lang/foo' |
+ }, hostedVersions: ["0.0.1", "0.0.2"]); |
expectDependencyValidationWarning(' foo: ">=0.0.2 <0.1.0"'); |
}); |
}); |
@@ -108,8 +114,9 @@ main() { |
expectDependencyValidationWarning(' foo: ">=1.0.0 <2.0.0"'); |
}); |
- integration("and should use the other source's unquoted version if " |
- "concrete", () { |
+ integration( |
+ "and should use the other source's unquoted version if " "concrete", |
+ () { |
setUpDependency({ |
'git': 'git://github.com/dart-lang/foo', |
'version': '0.2.3' |
@@ -122,22 +129,28 @@ main() { |
group('has a path dependency', () { |
group('where a hosted version exists', () { |
integration("and should suggest the hosted primary version", () { |
- setUpDependency({'path': path.join(sandboxDir, 'foo')}, |
- hostedVersions: ["3.0.0-pre", "2.0.0", "1.0.0"]); |
+ setUpDependency({ |
+ 'path': path.join(sandboxDir, 'foo') |
+ }, hostedVersions: ["3.0.0-pre", "2.0.0", "1.0.0"]); |
expectDependencyValidationError(' foo: ">=2.0.0 <3.0.0"'); |
}); |
- integration("and should suggest the hosted prerelease version if " |
- "it's the only version available", () { |
- setUpDependency({'path': path.join(sandboxDir, 'foo')}, |
- hostedVersions: ["3.0.0-pre", "2.0.0-pre"]); |
+ integration( |
+ "and should suggest the hosted prerelease version if " |
+ "it's the only version available", |
+ () { |
+ setUpDependency({ |
+ 'path': path.join(sandboxDir, 'foo') |
+ }, hostedVersions: ["3.0.0-pre", "2.0.0-pre"]); |
expectDependencyValidationError(' foo: ">=3.0.0-pre <4.0.0"'); |
}); |
- integration("and should suggest a tighter constraint if primary is " |
- "pre-1.0.0", () { |
- setUpDependency({'path': path.join(sandboxDir, 'foo')}, |
- hostedVersions: ["0.0.1", "0.0.2"]); |
+ integration( |
+ "and should suggest a tighter constraint if primary is " "pre-1.0.0", |
+ () { |
+ setUpDependency({ |
+ 'path': path.join(sandboxDir, 'foo') |
+ }, hostedVersions: ["0.0.1", "0.0.2"]); |
expectDependencyValidationError(' foo: ">=0.0.2 <0.1.0"'); |
}); |
}); |
@@ -151,8 +164,9 @@ main() { |
expectDependencyValidationError(' foo: ">=1.0.0 <2.0.0"'); |
}); |
- integration("and should use the other source's unquoted version if " |
- "concrete", () { |
+ integration( |
+ "and should use the other source's unquoted version if " "concrete", |
+ () { |
setUpDependency({ |
'path': path.join(sandboxDir, 'foo'), |
'version': '0.2.3' |
@@ -165,23 +179,21 @@ main() { |
group('has an unconstrained dependency', () { |
group('and it should not suggest a version', () { |
integration("if there's no lockfile", () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "any" |
- }) |
- ]).create(); |
+ })]).create(); |
- expect(schedulePackageValidation(dependency), completion( |
- pairOf(isEmpty, everyElement(isNot(contains("\n foo:")))))); |
+ expect( |
+ schedulePackageValidation(dependency), |
+ completion(pairOf(isEmpty, everyElement(isNot(contains("\n foo:")))))); |
}); |
- integration("if the lockfile doesn't have an entry for the " |
- "dependency", () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ integration( |
+ "if the lockfile doesn't have an entry for the " "dependency", |
+ () { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "any" |
- }), |
- d.file("pubspec.lock", JSON.encode({ |
+ }), d.file("pubspec.lock", JSON.encode({ |
'packages': { |
'bar': { |
'version': '1.2.3', |
@@ -192,22 +204,21 @@ main() { |
} |
} |
} |
- })) |
- ]).create(); |
+ }))]).create(); |
- expect(schedulePackageValidation(dependency), completion( |
- pairOf(isEmpty, everyElement(isNot(contains("\n foo:")))))); |
+ expect( |
+ schedulePackageValidation(dependency), |
+ completion(pairOf(isEmpty, everyElement(isNot(contains("\n foo:")))))); |
}); |
}); |
group('with a lockfile', () { |
- integration('and it should suggest a constraint based on the locked ' |
- 'version', () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ integration( |
+ 'and it should suggest a constraint based on the locked ' 'version', |
+ () { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "any" |
- }), |
- d.file("pubspec.lock", JSON.encode({ |
+ }), d.file("pubspec.lock", JSON.encode({ |
'packages': { |
'foo': { |
'version': '1.2.3', |
@@ -218,19 +229,18 @@ main() { |
} |
} |
} |
- })) |
- ]).create(); |
+ }))]).create(); |
expectDependencyValidationWarning(' foo: ">=1.2.3 <2.0.0"'); |
}); |
- integration('and it should suggest a concrete constraint if the locked ' |
- 'version is pre-1.0.0', () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ integration( |
+ 'and it should suggest a concrete constraint if the locked ' |
+ 'version is pre-1.0.0', |
+ () { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "any" |
- }), |
- d.file("pubspec.lock", JSON.encode({ |
+ }), d.file("pubspec.lock", JSON.encode({ |
'packages': { |
'foo': { |
'version': '0.1.2', |
@@ -241,21 +251,20 @@ main() { |
} |
} |
} |
- })) |
- ]).create(); |
+ }))]).create(); |
expectDependencyValidationWarning(' foo: ">=0.1.2 <0.2.0"'); |
}); |
}); |
}); |
- integration('with a single-version dependency and it should suggest a ' |
- 'constraint based on the version', () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ integration( |
+ 'with a single-version dependency and it should suggest a ' |
+ 'constraint based on the version', |
+ () { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "1.2.3" |
- }) |
- ]).create(); |
+ })]).create(); |
expectDependencyValidationWarning(' foo: ">=1.2.3 <2.0.0"'); |
}); |
@@ -263,23 +272,21 @@ main() { |
group('has a dependency without a lower bound', () { |
group('and it should not suggest a version', () { |
integration("if there's no lockfile", () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "<3.0.0" |
- }) |
- ]).create(); |
+ })]).create(); |
- expect(schedulePackageValidation(dependency), completion( |
- pairOf(isEmpty, everyElement(isNot(contains("\n foo:")))))); |
+ expect( |
+ schedulePackageValidation(dependency), |
+ completion(pairOf(isEmpty, everyElement(isNot(contains("\n foo:")))))); |
}); |
- integration("if the lockfile doesn't have an entry for the " |
- "dependency", () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ integration( |
+ "if the lockfile doesn't have an entry for the " "dependency", |
+ () { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "<3.0.0" |
- }), |
- d.file("pubspec.lock", JSON.encode({ |
+ }), d.file("pubspec.lock", JSON.encode({ |
'packages': { |
'bar': { |
'version': '1.2.3', |
@@ -290,22 +297,21 @@ main() { |
} |
} |
} |
- })) |
- ]).create(); |
+ }))]).create(); |
- expect(schedulePackageValidation(dependency), completion( |
- pairOf(isEmpty, everyElement(isNot(contains("\n foo:")))))); |
+ expect( |
+ schedulePackageValidation(dependency), |
+ completion(pairOf(isEmpty, everyElement(isNot(contains("\n foo:")))))); |
}); |
}); |
group('with a lockfile', () { |
- integration('and it should suggest a constraint based on the locked ' |
- 'version', () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ integration( |
+ 'and it should suggest a constraint based on the locked ' 'version', |
+ () { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "<3.0.0" |
- }), |
- d.file("pubspec.lock", JSON.encode({ |
+ }), d.file("pubspec.lock", JSON.encode({ |
'packages': { |
'foo': { |
'version': '1.2.3', |
@@ -316,18 +322,15 @@ main() { |
} |
} |
} |
- })) |
- ]).create(); |
+ }))]).create(); |
expectDependencyValidationWarning(' foo: ">=1.2.3 <3.0.0"'); |
}); |
integration('and it should preserve the upper-bound operator', () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "<=3.0.0" |
- }), |
- d.file("pubspec.lock", JSON.encode({ |
+ }), d.file("pubspec.lock", JSON.encode({ |
'packages': { |
'foo': { |
'version': '1.2.3', |
@@ -338,19 +341,18 @@ main() { |
} |
} |
} |
- })) |
- ]).create(); |
+ }))]).create(); |
expectDependencyValidationWarning(' foo: ">=1.2.3 <=3.0.0"'); |
}); |
- integration('and it should expand the suggested constraint if the ' |
- 'locked version matches the upper bound', () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ integration( |
+ 'and it should expand the suggested constraint if the ' |
+ 'locked version matches the upper bound', |
+ () { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "<=1.2.3" |
- }), |
- d.file("pubspec.lock", JSON.encode({ |
+ }), d.file("pubspec.lock", JSON.encode({ |
'packages': { |
'foo': { |
'version': '1.2.3', |
@@ -361,8 +363,7 @@ main() { |
} |
} |
} |
- })) |
- ]).create(); |
+ }))]).create(); |
expectDependencyValidationWarning(' foo: ">=1.2.3 <2.0.0"'); |
}); |
@@ -370,23 +371,20 @@ main() { |
}); |
group('with a dependency without an upper bound', () { |
- integration('and it should suggest a constraint based on the lower bound', |
+ integration( |
+ 'and it should suggest a constraint based on the lower bound', |
() { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": ">=1.2.3" |
- }) |
- ]).create(); |
+ })]).create(); |
expectDependencyValidationWarning(' foo: ">=1.2.3 <2.0.0"'); |
}); |
integration('and it should preserve the lower-bound operator', () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": ">1.2.3" |
- }) |
- ]).create(); |
+ })]).create(); |
expectDependencyValidationWarning(' foo: ">1.2.3 <2.0.0"'); |
}); |
@@ -394,21 +392,17 @@ main() { |
group('has a ^ dependency', () { |
integration("without an SDK constraint", () { |
- d.dir(appPath, [ |
- d.libPubspec("integration_pkg", "1.0.0", deps: { |
+ d.dir(appPath, [d.libPubspec("integration_pkg", "1.0.0", deps: { |
"foo": "^1.2.3" |
- }) |
- ]).create(); |
+ })]).create(); |
expectDependencyValidationError(' foo: ">=1.2.3 <2.0.0"'); |
}); |
integration("with a too-broad SDK constraint", () { |
- d.dir(appPath, [ |
- d.libPubspec("test_pkg", "1.0.0", deps: { |
+ d.dir(appPath, [d.libPubspec("test_pkg", "1.0.0", deps: { |
"foo": "^1.2.3" |
- }, sdk: ">=1.5.0 <2.0.0") |
- ]).create(); |
+ }, sdk: ">=1.5.0 <2.0.0")]).create(); |
expectDependencyValidationError(' foo: ">=1.2.3 <2.0.0"'); |
}); |