test(remove): Show what happens with last dep in a table

This commit is contained in:
Ed Page 2024-11-25 10:14:00 -06:00
parent c4a9e45519
commit e0477a3869
6 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,13 @@
[package]
name = "cargo-remove-test-fixture"
version = "0.1.0"
edition = "2015"
[[bin]]
name = "main"
path = "src/main.rs"
[dependencies]
docopt = "0.6"
[features]

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,28 @@
use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::CargoCommandExt;
use cargo_test_support::Project;
#[cargo_test]
fn case() {
cargo_test_support::registry::init();
cargo_test_support::registry::Package::new("docopt", "0.6.2+my-package").publish();
let project = Project::from_template(current_dir!().join("in"));
let project_root = project.root();
let cwd = &project_root;
snapbox::cmd::Command::cargo_ui()
.arg("remove")
.args(["docopt"])
.current_dir(cwd)
.assert()
.success()
.stdout_eq(str![""])
.stderr_eq(file!["stderr.term.svg"]);
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
}

View File

@ -0,0 +1,10 @@
[package]
name = "cargo-remove-test-fixture"
version = "0.1.0"
edition = "2015"
[[bin]]
name = "main"
path = "src/main.rs"
[features]

View File

@ -0,0 +1,27 @@
<svg width="740px" height="56px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
.fg-green { fill: #00AA00 }
.container {
padding: 0 10px;
line-height: 18px;
}
.bold { font-weight: bold; }
tspan {
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
white-space: pre;
line-height: 18px;
}
</style>
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-green bold"> Removing</tspan><tspan> docopt from dependencies</tspan>
</tspan>
<tspan x="10px" y="46px">
</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 731 B

View File

@ -15,6 +15,7 @@ mod invalid_section;
mod invalid_section_dep;
mod invalid_target;
mod invalid_target_dep;
mod last_dep;
mod multiple_deps;
mod multiple_dev;
mod no_arg;