Index: utils/tests/pub/pub_install_repo_test.dart |
diff --git a/utils/tests/pub/pub_install_repo_test.dart b/utils/tests/pub/pub_install_repo_test.dart |
index fb03dfc9b2cd713333ae1e4ed023d41c653410ca..af7d08c13aea0086f6d8da0f02d0c052e781326a 100644 |
--- a/utils/tests/pub/pub_install_repo_test.dart |
+++ b/utils/tests/pub/pub_install_repo_test.dart |
@@ -229,4 +229,104 @@ main() { |
run(); |
}); |
+ |
+ test("removes a dependency that's been removed from the pubspec", () { |
+ servePackages([ |
+ package("foo", "1.0.0"), |
+ package("bar", "1.0.0") |
+ ]); |
+ |
+ appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); |
+ |
+ schedulePub(args: ['install'], |
+ output: const RegExp(@"Dependencies installed!$")); |
+ |
+ packagesDir({ |
+ "foo": "1.0.0", |
+ "bar": "1.0.0" |
+ }).scheduleValidate(); |
+ |
+ appDir([dependency("foo")]).scheduleCreate(); |
+ |
+ schedulePub(args: ['install'], |
+ output: const RegExp(@"Dependencies installed!$")); |
+ |
+ packagesDir({ |
+ "foo": "1.0.0", |
+ "bar": null |
+ }).scheduleValidate(); |
+ |
+ run(); |
+ }); |
+ |
+ test("removes a transitive dependency that's no longer depended on", () { |
+ servePackages([ |
+ package("foo", "1.0.0", [dependency("shared-dep")]), |
+ package("bar", "1.0.0", [ |
+ dependency("shared-dep"), |
+ dependency("bar-dep") |
+ ]), |
+ package("shared-dep", "1.0.0"), |
+ package("bar-dep", "1.0.0") |
+ ]); |
+ |
+ appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); |
+ |
+ schedulePub(args: ['install'], |
+ output: const RegExp(@"Dependencies installed!$")); |
+ |
+ packagesDir({ |
+ "foo": "1.0.0", |
+ "bar": "1.0.0", |
+ "shared-dep": "1.0.0", |
+ "bar-dep": "1.0.0", |
+ }).scheduleValidate(); |
+ |
+ appDir([dependency("foo")]).scheduleCreate(); |
+ |
+ schedulePub(args: ['install'], |
+ output: const RegExp(@"Dependencies installed!$")); |
+ |
+ packagesDir({ |
+ "foo": "1.0.0", |
+ "bar": null, |
+ "shared-dep": "1.0.0", |
+ "bar-dep": null, |
+ }).scheduleValidate(); |
+ |
+ run(); |
+ }); |
+ |
+ test("doesn't update dependencies whose constraints have been removed", () { |
+ servePackages([ |
+ package("foo", "1.0.0", [dependency("shared-dep")]), |
+ package("bar", "1.0.0", [dependency("shared-dep", "<2.0.0")]), |
+ package("shared-dep", "1.0.0"), |
+ package("shared-dep", "2.0.0") |
+ ]); |
+ |
+ appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); |
+ |
+ schedulePub(args: ['install'], |
+ output: const RegExp(@"Dependencies installed!$")); |
+ |
+ packagesDir({ |
+ "foo": "1.0.0", |
+ "bar": "1.0.0", |
+ "shared-dep": "1.0.0" |
+ }).scheduleValidate(); |
+ |
+ appDir([dependency("foo")]).scheduleCreate(); |
+ |
+ schedulePub(args: ['install'], |
+ output: const RegExp(@"Dependencies installed!$")); |
+ |
+ packagesDir({ |
+ "foo": "1.0.0", |
+ "bar": null, |
+ "shared-dep": "1.0.0" |
+ }).scheduleValidate(); |
+ |
+ run(); |
+ }); |
} |