Skip to content

Commit

Permalink
chore: add passing test
Browse files Browse the repository at this point in the history
  • Loading branch information
alcolmenar committed Aug 8, 2023
1 parent a07a12a commit 199c82a
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/testsuite/cargo_remove/invalid_gc_patch/in/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cargo.toml

[workspace]
members = ["serde", "serde_derive"]

[patch.crates-io]
serde = { path = "serde" }

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# serde/Cargo.toml

[package]
name = "serde"
version = "1.0.0"

[dependencies]
serde_derive = { path = "../serde_derive" }

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# serde_derive/Cargo.toml

[package]
name = "serde_derive"
version = "1.0.0"

[dev-dependencies]
serde_json = "1.0.0"
Empty file.
27 changes: 27 additions & 0 deletions tests/testsuite/cargo_remove/invalid_gc_patch/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use cargo_test_support::compare::assert_ui;
use cargo_test_support::curr_dir;
use cargo_test_support::CargoCommand;
use cargo_test_support::Project;

#[cargo_test]
fn case() {
cargo_test_support::registry::init();
cargo_test_support::registry::Package::new("serde", "1.0.0").publish();
cargo_test_support::registry::Package::new("serde_json", "1.0.0")
.dep("serde", "1.0.0")
.publish();

let project = Project::from_template(curr_dir!().join("in"));
let project_root = project.root();

snapbox::cmd::Command::cargo_ui()
.current_dir(&project_root)
.arg("remove")
.args(["--package", "serde", "serde_derive"])
.assert()
.code(0)
.stdout_matches_path(curr_dir!().join("stdout.log"))
.stderr_matches_path(curr_dir!().join("stderr.log"));

assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
}
5 changes: 5 additions & 0 deletions tests/testsuite/cargo_remove/invalid_gc_patch/out/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Cargo.toml

[workspace]
members = ["serde", "serde_derive"]

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# serde/Cargo.toml

[package]
name = "serde"
version = "1.0.0"

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# serde_derive/Cargo.toml

[package]
name = "serde_derive"
version = "1.0.0"

[dev-dependencies]
serde_json = "1.0.0"
Empty file.
2 changes: 2 additions & 0 deletions tests/testsuite/cargo_remove/invalid_gc_patch/stderr.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removing serde_derive from dependencies
Updating `dummy-registry` index
Empty file.
1 change: 1 addition & 0 deletions tests/testsuite/cargo_remove/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod gc_replace;
mod help;
mod invalid_arg;
mod invalid_dep;
mod invalid_gc_patch;
mod invalid_package;
mod invalid_package_multiple;
mod invalid_section;
Expand Down

0 comments on commit 199c82a

Please sign in to comment.