Test partially successful uninstallation
authorFredrik Larsson <nossralf@gmail.com>
Sat, 28 Oct 2017 14:36:49 +0000 (16:36 +0200)
committerFredrik Larsson <nossralf@gmail.com>
Sat, 28 Oct 2017 14:36:49 +0000 (16:36 +0200)
tests/install.rs

index 2353f31a38ed925fbfd657392686bd63f01c13c8..0b43acc44b731af84b36c309b445d045276c0c6c 100644 (file)
@@ -970,3 +970,24 @@ fn uninstall_multiple_and_specifying_bin() {
 error: A binary can only be associated with a single installed package, specifying multiple specs with --bin is redundant.
 "));
 }
+
+#[test]
+fn uninstall_multiple_and_some_pkg_does_not_exist() {
+    pkg("foo", "0.0.1");
+
+    assert_that(cargo_process("install").arg("foo"),
+                execs().with_status(0));
+
+    assert_that(cargo_process("uninstall").args(&["foo", "bar"]),
+                execs().with_status(101).with_stderr(&format!("\
+[REMOVING] {home}[..]bin[..]foo[..]
+error: package id specification `bar` matched no packages
+   
+Summary: Successfully uninstalled foo! Failed to uninstall bar (see error(s) above).
+error: some packages failed to uninstall
+",
+        home = cargo_home().display())));
+
+    assert_that(cargo_home(), is_not(has_installed_exe("foo")));
+    assert_that(cargo_home(), is_not(has_installed_exe("bar")));
+}