From ed25d6b0c1a512e8690fd01466dd26b48d87a753 Mon Sep 17 00:00:00 2001 From: Cassaundra Smith Date: Thu, 15 Sep 2022 15:31:11 -0700 Subject: [PATCH] Add tests for `cargo remove` --- .../cargo_remove/avoid_empty_tables/in | 1 + .../cargo_remove/avoid_empty_tables/mod.rs | 25 ++++++ .../avoid_empty_tables/out/Cargo.toml | 23 ++++++ .../avoid_empty_tables/stderr.log | 2 + .../avoid_empty_tables/stdout.log | 0 tests/testsuite/cargo_remove/build/in | 1 + tests/testsuite/cargo_remove/build/mod.rs | 25 ++++++ .../cargo_remove/build/out/Cargo.toml | 21 +++++ tests/testsuite/cargo_remove/build/stderr.log | 2 + tests/testsuite/cargo_remove/build/stdout.log | 0 tests/testsuite/cargo_remove/dev/in | 1 + tests/testsuite/cargo_remove/dev/mod.rs | 25 ++++++ .../testsuite/cargo_remove/dev/out/Cargo.toml | 23 ++++++ tests/testsuite/cargo_remove/dev/stderr.log | 2 + tests/testsuite/cargo_remove/dev/stdout.log | 0 tests/testsuite/cargo_remove/dry_run/in | 1 + tests/testsuite/cargo_remove/dry_run/mod.rs | 25 ++++++ .../cargo_remove/dry_run/out/Cargo.toml | 24 ++++++ .../cargo_remove/dry_run/out/src/lib.rs | 1 + .../testsuite/cargo_remove/dry_run/stderr.log | 2 + .../testsuite/cargo_remove/dry_run/stdout.log | 0 tests/testsuite/cargo_remove/invalid_arg/in | 1 + .../testsuite/cargo_remove/invalid_arg/mod.rs | 25 ++++++ .../cargo_remove/invalid_arg/out/Cargo.toml | 24 ++++++ .../cargo_remove/invalid_arg/stderr.log | 8 ++ .../cargo_remove/invalid_arg/stdout.log | 0 tests/testsuite/cargo_remove/invalid_dep/in | 1 + .../testsuite/cargo_remove/invalid_dep/mod.rs | 25 ++++++ .../cargo_remove/invalid_dep/out/Cargo.toml | 24 ++++++ .../cargo_remove/invalid_dep/stderr.log | 2 + .../cargo_remove/invalid_dep/stdout.log | 0 .../testsuite/cargo_remove/invalid_package/in | 1 + .../cargo_remove/invalid_package/mod.rs | 25 ++++++ .../invalid_package/out/Cargo.toml | 5 ++ .../invalid_package/out/dep-a/Cargo.toml | 23 ++++++ .../invalid_package/out/dep-a/src/lib.rs | 1 + .../invalid_package/out/dep-b/Cargo.toml | 23 ++++++ .../invalid_package/out/dep-b/src/lib.rs | 1 + .../cargo_remove/invalid_package/stderr.log | 1 + .../cargo_remove/invalid_package/stdout.log | 0 .../cargo_remove/invalid_package_multiple/in | 1 + .../invalid_package_multiple/mod.rs | 25 ++++++ .../invalid_package_multiple/out/Cargo.toml | 5 ++ .../out/dep-a/Cargo.toml | 23 ++++++ .../out/dep-a/src/lib.rs | 1 + .../out/dep-b/Cargo.toml | 23 ++++++ .../out/dep-b/src/lib.rs | 1 + .../invalid_package_multiple/stderr.log | 1 + .../invalid_package_multiple/stdout.log | 0 .../testsuite/cargo_remove/invalid_section/in | 1 + .../cargo_remove/invalid_section/mod.rs | 25 ++++++ .../invalid_section/out/Cargo.toml | 24 ++++++ .../cargo_remove/invalid_section/stderr.log | 2 + .../cargo_remove/invalid_section/stdout.log | 0 .../cargo_remove/invalid_section_dep/in | 1 + .../cargo_remove/invalid_section_dep/mod.rs | 25 ++++++ .../invalid_section_dep/out/Cargo.toml | 24 ++++++ .../invalid_section_dep/stderr.log | 2 + .../invalid_section_dep/stdout.log | 0 .../testsuite/cargo_remove/invalid_target/in | 1 + .../cargo_remove/invalid_target/mod.rs | 25 ++++++ .../invalid_target/out/Cargo.toml | 33 ++++++++ .../cargo_remove/invalid_target/stderr.log | 2 + .../cargo_remove/invalid_target/stdout.log | 0 .../cargo_remove/invalid_target_dep/in | 1 + .../cargo_remove/invalid_target_dep/mod.rs | 25 ++++++ .../invalid_target_dep/out/Cargo.toml | 33 ++++++++ .../invalid_target_dep/stderr.log | 2 + .../invalid_target_dep/stdout.log | 0 tests/testsuite/cargo_remove/mod.rs | 82 +++++++++++++++++++ tests/testsuite/cargo_remove/multiple_deps/in | 1 + .../cargo_remove/multiple_deps/mod.rs | 25 ++++++ .../cargo_remove/multiple_deps/out/Cargo.toml | 22 +++++ .../cargo_remove/multiple_deps/stderr.log | 3 + .../cargo_remove/multiple_deps/stdout.log | 0 tests/testsuite/cargo_remove/multiple_dev/in | 1 + .../cargo_remove/multiple_dev/mod.rs | 25 ++++++ .../cargo_remove/multiple_dev/out/Cargo.toml | 20 +++++ .../cargo_remove/multiple_dev/stderr.log | 3 + .../cargo_remove/multiple_dev/stdout.log | 0 tests/testsuite/cargo_remove/no_arg/in | 1 + tests/testsuite/cargo_remove/no_arg/mod.rs | 24 ++++++ .../cargo_remove/no_arg/out/Cargo.toml | 24 ++++++ .../testsuite/cargo_remove/no_arg/stderr.log | 7 ++ .../testsuite/cargo_remove/no_arg/stdout.log | 0 tests/testsuite/cargo_remove/offline/in | 1 + tests/testsuite/cargo_remove/offline/mod.rs | 35 ++++++++ .../cargo_remove/offline/out/Cargo.toml | 23 ++++++ .../testsuite/cargo_remove/offline/stderr.log | 1 + .../testsuite/cargo_remove/offline/stdout.log | 0 .../cargo_remove/optional_dep_feature/in | 1 + .../cargo_remove/optional_dep_feature/mod.rs | 25 ++++++ .../optional_dep_feature/out/Cargo.toml | 23 ++++++ .../optional_dep_feature/stderr.log | 2 + .../optional_dep_feature/stdout.log | 0 .../cargo_remove/optional_feature/in | 1 + .../cargo_remove/optional_feature/mod.rs | 25 ++++++ .../optional_feature/out/Cargo.toml | 23 ++++++ .../cargo_remove/optional_feature/stderr.log | 2 + .../cargo_remove/optional_feature/stdout.log | 0 tests/testsuite/cargo_remove/package/in | 1 + tests/testsuite/cargo_remove/package/mod.rs | 25 ++++++ .../cargo_remove/package/out/Cargo.toml | 5 ++ .../cargo_remove/package/out/dep-a/Cargo.toml | 22 +++++ .../cargo_remove/package/out/dep-a/src/lib.rs | 1 + .../cargo_remove/package/out/dep-b/Cargo.toml | 23 ++++++ .../cargo_remove/package/out/dep-b/src/lib.rs | 1 + .../testsuite/cargo_remove/package/stderr.log | 2 + .../testsuite/cargo_remove/package/stdout.log | 0 .../cargo_remove/remove-basic.in/Cargo.toml | 24 ++++++ .../cargo_remove/remove-basic.in/src/lib.rs | 1 + .../cargo_remove/remove-package.in/Cargo.toml | 5 ++ .../remove-package.in/dep-a/Cargo.toml | 23 ++++++ .../remove-package.in/dep-a/src/lib.rs | 1 + .../remove-package.in/dep-b/Cargo.toml | 23 ++++++ .../remove-package.in/dep-b/src/lib.rs | 1 + .../cargo_remove/remove-target.in/Cargo.toml | 33 ++++++++ tests/testsuite/cargo_remove/remove_basic/in | 1 + .../cargo_remove/remove_basic/mod.rs | 25 ++++++ .../cargo_remove/remove_basic/out/Cargo.toml | 23 ++++++ .../cargo_remove/remove_basic/stderr.log | 2 + .../cargo_remove/remove_basic/stdout.log | 0 tests/testsuite/cargo_remove/target/in | 1 + tests/testsuite/cargo_remove/target/mod.rs | 25 ++++++ .../cargo_remove/target/out/Cargo.toml | 30 +++++++ .../testsuite/cargo_remove/target/stderr.log | 2 + .../testsuite/cargo_remove/target/stdout.log | 0 tests/testsuite/cargo_remove/target_build/in | 1 + .../cargo_remove/target_build/mod.rs | 25 ++++++ .../cargo_remove/target_build/out/Cargo.toml | 30 +++++++ .../cargo_remove/target_build/stderr.log | 2 + .../cargo_remove/target_build/stdout.log | 0 tests/testsuite/cargo_remove/target_dev/in | 1 + .../testsuite/cargo_remove/target_dev/mod.rs | 25 ++++++ .../cargo_remove/target_dev/out/Cargo.toml | 30 +++++++ .../cargo_remove/target_dev/stderr.log | 2 + .../cargo_remove/target_dev/stdout.log | 0 .../update_lock_file/in/Cargo.lock | 58 +++++++++++++ .../update_lock_file/in/Cargo.toml | 24 ++++++ .../update_lock_file/in/src/main.rs | 1 + .../cargo_remove/update_lock_file/mod.rs | 25 ++++++ .../update_lock_file/out/Cargo.lock | 51 ++++++++++++ .../update_lock_file/out/Cargo.toml | 23 ++++++ .../update_lock_file/out/src/main.rs | 1 + .../cargo_remove/update_lock_file/stderr.log | 2 + .../cargo_remove/update_lock_file/stdout.log | 0 146 files changed, 1701 insertions(+) create mode 120000 tests/testsuite/cargo_remove/avoid_empty_tables/in create mode 100644 tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs create mode 100644 tests/testsuite/cargo_remove/avoid_empty_tables/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log create mode 100644 tests/testsuite/cargo_remove/avoid_empty_tables/stdout.log create mode 120000 tests/testsuite/cargo_remove/build/in create mode 100644 tests/testsuite/cargo_remove/build/mod.rs create mode 100644 tests/testsuite/cargo_remove/build/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/build/stderr.log create mode 100644 tests/testsuite/cargo_remove/build/stdout.log create mode 120000 tests/testsuite/cargo_remove/dev/in create mode 100644 tests/testsuite/cargo_remove/dev/mod.rs create mode 100644 tests/testsuite/cargo_remove/dev/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/dev/stderr.log create mode 100644 tests/testsuite/cargo_remove/dev/stdout.log create mode 120000 tests/testsuite/cargo_remove/dry_run/in create mode 100644 tests/testsuite/cargo_remove/dry_run/mod.rs create mode 100644 tests/testsuite/cargo_remove/dry_run/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/dry_run/out/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/dry_run/stderr.log create mode 100644 tests/testsuite/cargo_remove/dry_run/stdout.log create mode 120000 tests/testsuite/cargo_remove/invalid_arg/in create mode 100644 tests/testsuite/cargo_remove/invalid_arg/mod.rs create mode 100644 tests/testsuite/cargo_remove/invalid_arg/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_arg/stderr.log create mode 100644 tests/testsuite/cargo_remove/invalid_arg/stdout.log create mode 120000 tests/testsuite/cargo_remove/invalid_dep/in create mode 100644 tests/testsuite/cargo_remove/invalid_dep/mod.rs create mode 100644 tests/testsuite/cargo_remove/invalid_dep/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_dep/stderr.log create mode 100644 tests/testsuite/cargo_remove/invalid_dep/stdout.log create mode 120000 tests/testsuite/cargo_remove/invalid_package/in create mode 100644 tests/testsuite/cargo_remove/invalid_package/mod.rs create mode 100644 tests/testsuite/cargo_remove/invalid_package/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_package/out/dep-a/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_package/out/dep-a/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/invalid_package/out/dep-b/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_package/out/dep-b/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/invalid_package/stderr.log create mode 100644 tests/testsuite/cargo_remove/invalid_package/stdout.log create mode 120000 tests/testsuite/cargo_remove/invalid_package_multiple/in create mode 100644 tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs create mode 100644 tests/testsuite/cargo_remove/invalid_package_multiple/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-a/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-a/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-b/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-b/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/invalid_package_multiple/stderr.log create mode 100644 tests/testsuite/cargo_remove/invalid_package_multiple/stdout.log create mode 120000 tests/testsuite/cargo_remove/invalid_section/in create mode 100644 tests/testsuite/cargo_remove/invalid_section/mod.rs create mode 100644 tests/testsuite/cargo_remove/invalid_section/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_section/stderr.log create mode 100644 tests/testsuite/cargo_remove/invalid_section/stdout.log create mode 120000 tests/testsuite/cargo_remove/invalid_section_dep/in create mode 100644 tests/testsuite/cargo_remove/invalid_section_dep/mod.rs create mode 100644 tests/testsuite/cargo_remove/invalid_section_dep/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_section_dep/stderr.log create mode 100644 tests/testsuite/cargo_remove/invalid_section_dep/stdout.log create mode 120000 tests/testsuite/cargo_remove/invalid_target/in create mode 100644 tests/testsuite/cargo_remove/invalid_target/mod.rs create mode 100644 tests/testsuite/cargo_remove/invalid_target/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_target/stderr.log create mode 100644 tests/testsuite/cargo_remove/invalid_target/stdout.log create mode 120000 tests/testsuite/cargo_remove/invalid_target_dep/in create mode 100644 tests/testsuite/cargo_remove/invalid_target_dep/mod.rs create mode 100644 tests/testsuite/cargo_remove/invalid_target_dep/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/invalid_target_dep/stderr.log create mode 100644 tests/testsuite/cargo_remove/invalid_target_dep/stdout.log create mode 100644 tests/testsuite/cargo_remove/mod.rs create mode 120000 tests/testsuite/cargo_remove/multiple_deps/in create mode 100644 tests/testsuite/cargo_remove/multiple_deps/mod.rs create mode 100644 tests/testsuite/cargo_remove/multiple_deps/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/multiple_deps/stderr.log create mode 100644 tests/testsuite/cargo_remove/multiple_deps/stdout.log create mode 120000 tests/testsuite/cargo_remove/multiple_dev/in create mode 100644 tests/testsuite/cargo_remove/multiple_dev/mod.rs create mode 100644 tests/testsuite/cargo_remove/multiple_dev/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/multiple_dev/stderr.log create mode 100644 tests/testsuite/cargo_remove/multiple_dev/stdout.log create mode 120000 tests/testsuite/cargo_remove/no_arg/in create mode 100644 tests/testsuite/cargo_remove/no_arg/mod.rs create mode 100644 tests/testsuite/cargo_remove/no_arg/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/no_arg/stderr.log create mode 100644 tests/testsuite/cargo_remove/no_arg/stdout.log create mode 120000 tests/testsuite/cargo_remove/offline/in create mode 100644 tests/testsuite/cargo_remove/offline/mod.rs create mode 100644 tests/testsuite/cargo_remove/offline/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/offline/stderr.log create mode 100644 tests/testsuite/cargo_remove/offline/stdout.log create mode 120000 tests/testsuite/cargo_remove/optional_dep_feature/in create mode 100644 tests/testsuite/cargo_remove/optional_dep_feature/mod.rs create mode 100644 tests/testsuite/cargo_remove/optional_dep_feature/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/optional_dep_feature/stderr.log create mode 100644 tests/testsuite/cargo_remove/optional_dep_feature/stdout.log create mode 120000 tests/testsuite/cargo_remove/optional_feature/in create mode 100644 tests/testsuite/cargo_remove/optional_feature/mod.rs create mode 100644 tests/testsuite/cargo_remove/optional_feature/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/optional_feature/stderr.log create mode 100644 tests/testsuite/cargo_remove/optional_feature/stdout.log create mode 120000 tests/testsuite/cargo_remove/package/in create mode 100644 tests/testsuite/cargo_remove/package/mod.rs create mode 100644 tests/testsuite/cargo_remove/package/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/package/out/dep-a/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/package/out/dep-a/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/package/out/dep-b/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/package/out/dep-b/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/package/stderr.log create mode 100644 tests/testsuite/cargo_remove/package/stdout.log create mode 100644 tests/testsuite/cargo_remove/remove-basic.in/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/remove-basic.in/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/remove-package.in/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/remove-package.in/dep-a/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/remove-package.in/dep-a/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/remove-package.in/dep-b/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/remove-package.in/dep-b/src/lib.rs create mode 100644 tests/testsuite/cargo_remove/remove-target.in/Cargo.toml create mode 120000 tests/testsuite/cargo_remove/remove_basic/in create mode 100644 tests/testsuite/cargo_remove/remove_basic/mod.rs create mode 100644 tests/testsuite/cargo_remove/remove_basic/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/remove_basic/stderr.log create mode 100644 tests/testsuite/cargo_remove/remove_basic/stdout.log create mode 120000 tests/testsuite/cargo_remove/target/in create mode 100644 tests/testsuite/cargo_remove/target/mod.rs create mode 100644 tests/testsuite/cargo_remove/target/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/target/stderr.log create mode 100644 tests/testsuite/cargo_remove/target/stdout.log create mode 120000 tests/testsuite/cargo_remove/target_build/in create mode 100644 tests/testsuite/cargo_remove/target_build/mod.rs create mode 100644 tests/testsuite/cargo_remove/target_build/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/target_build/stderr.log create mode 100644 tests/testsuite/cargo_remove/target_build/stdout.log create mode 120000 tests/testsuite/cargo_remove/target_dev/in create mode 100644 tests/testsuite/cargo_remove/target_dev/mod.rs create mode 100644 tests/testsuite/cargo_remove/target_dev/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/target_dev/stderr.log create mode 100644 tests/testsuite/cargo_remove/target_dev/stdout.log create mode 100644 tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock create mode 100644 tests/testsuite/cargo_remove/update_lock_file/in/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/update_lock_file/in/src/main.rs create mode 100644 tests/testsuite/cargo_remove/update_lock_file/mod.rs create mode 100644 tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock create mode 100644 tests/testsuite/cargo_remove/update_lock_file/out/Cargo.toml create mode 100644 tests/testsuite/cargo_remove/update_lock_file/out/src/main.rs create mode 100644 tests/testsuite/cargo_remove/update_lock_file/stderr.log create mode 100644 tests/testsuite/cargo_remove/update_lock_file/stdout.log diff --git a/tests/testsuite/cargo_remove/avoid_empty_tables/in b/tests/testsuite/cargo_remove/avoid_empty_tables/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/avoid_empty_tables/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs b/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs new file mode 100644 index 000000000000..59a2333d6f7a --- /dev/null +++ b/tests/testsuite/cargo_remove/avoid_empty_tables/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["clippy"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/avoid_empty_tables/out/Cargo.toml b/tests/testsuite/cargo_remove/avoid_empty_tables/out/Cargo.toml new file mode 100644 index 000000000000..09a9ee86e81f --- /dev/null +++ b/tests/testsuite/cargo_remove/avoid_empty_tables/out/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log b/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log new file mode 100644 index 000000000000..dd71023a864c --- /dev/null +++ b/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log @@ -0,0 +1,2 @@ + Removing clippy from dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/avoid_empty_tables/stdout.log b/tests/testsuite/cargo_remove/avoid_empty_tables/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/build/in b/tests/testsuite/cargo_remove/build/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/build/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/build/mod.rs b/tests/testsuite/cargo_remove/build/mod.rs new file mode 100644 index 000000000000..f4c9dcb94dee --- /dev/null +++ b/tests/testsuite/cargo_remove/build/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--build", "semver"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/build/out/Cargo.toml b/tests/testsuite/cargo_remove/build/out/Cargo.toml new file mode 100644 index 000000000000..babdc0a99901 --- /dev/null +++ b/tests/testsuite/cargo_remove/build/out/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/build/stderr.log b/tests/testsuite/cargo_remove/build/stderr.log new file mode 100644 index 000000000000..f037ebe28cec --- /dev/null +++ b/tests/testsuite/cargo_remove/build/stderr.log @@ -0,0 +1,2 @@ + Removing semver from build-dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/build/stdout.log b/tests/testsuite/cargo_remove/build/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/dev/in b/tests/testsuite/cargo_remove/dev/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/dev/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/dev/mod.rs b/tests/testsuite/cargo_remove/dev/mod.rs new file mode 100644 index 000000000000..7d61fa954055 --- /dev/null +++ b/tests/testsuite/cargo_remove/dev/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--dev", "regex"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/dev/out/Cargo.toml b/tests/testsuite/cargo_remove/dev/out/Cargo.toml new file mode 100644 index 000000000000..40744a56671d --- /dev/null +++ b/tests/testsuite/cargo_remove/dev/out/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/dev/stderr.log b/tests/testsuite/cargo_remove/dev/stderr.log new file mode 100644 index 000000000000..c629b26b19db --- /dev/null +++ b/tests/testsuite/cargo_remove/dev/stderr.log @@ -0,0 +1,2 @@ + Removing regex from dev-dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/dev/stdout.log b/tests/testsuite/cargo_remove/dev/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/dry_run/in b/tests/testsuite/cargo_remove/dry_run/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/dry_run/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/dry_run/mod.rs b/tests/testsuite/cargo_remove/dry_run/mod.rs new file mode 100644 index 000000000000..dca189315502 --- /dev/null +++ b/tests/testsuite/cargo_remove/dry_run/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["semver", "--dry-run"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/dry_run/out/Cargo.toml b/tests/testsuite/cargo_remove/dry_run/out/Cargo.toml new file mode 100644 index 000000000000..340f06cda792 --- /dev/null +++ b/tests/testsuite/cargo_remove/dry_run/out/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/dry_run/out/src/lib.rs b/tests/testsuite/cargo_remove/dry_run/out/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/dry_run/out/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/dry_run/stderr.log b/tests/testsuite/cargo_remove/dry_run/stderr.log new file mode 100644 index 000000000000..8b118911c61c --- /dev/null +++ b/tests/testsuite/cargo_remove/dry_run/stderr.log @@ -0,0 +1,2 @@ + Removing semver from dependencies +warning: aborting remove due to dry run diff --git a/tests/testsuite/cargo_remove/dry_run/stdout.log b/tests/testsuite/cargo_remove/dry_run/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/invalid_arg/in b/tests/testsuite/cargo_remove/invalid_arg/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_arg/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/invalid_arg/mod.rs b/tests/testsuite/cargo_remove/invalid_arg/mod.rs new file mode 100644 index 000000000000..eac3c8b46437 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_arg/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["foo", "--flag"]) + .current_dir(cwd) + .assert() + .code(1) + .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); +} diff --git a/tests/testsuite/cargo_remove/invalid_arg/out/Cargo.toml b/tests/testsuite/cargo_remove/invalid_arg/out/Cargo.toml new file mode 100644 index 000000000000..340f06cda792 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_arg/out/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_arg/stderr.log b/tests/testsuite/cargo_remove/invalid_arg/stderr.log new file mode 100644 index 000000000000..3f5303307d8e --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_arg/stderr.log @@ -0,0 +1,8 @@ +error: Found argument '--flag' which wasn't expected, or isn't valid in this context + + If you tried to supply `--flag` as a value rather than a flag, use `-- --flag` + +USAGE: + cargo[EXE] remove ... + +For more information try --help diff --git a/tests/testsuite/cargo_remove/invalid_arg/stdout.log b/tests/testsuite/cargo_remove/invalid_arg/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/invalid_dep/in b/tests/testsuite/cargo_remove/invalid_dep/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_dep/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/invalid_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_dep/mod.rs new file mode 100644 index 000000000000..c4dbeae910a9 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_dep/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["invalid_dependency_name"]) + .current_dir(cwd) + .assert() + .code(101) + .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); +} diff --git a/tests/testsuite/cargo_remove/invalid_dep/out/Cargo.toml b/tests/testsuite/cargo_remove/invalid_dep/out/Cargo.toml new file mode 100644 index 000000000000..340f06cda792 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_dep/out/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_dep/stderr.log b/tests/testsuite/cargo_remove/invalid_dep/stderr.log new file mode 100644 index 000000000000..eea124d65801 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_dep/stderr.log @@ -0,0 +1,2 @@ + Removing invalid_dependency_name from dependencies +error: the dependency `invalid_dependency_name` could not be found in `dependencies`. diff --git a/tests/testsuite/cargo_remove/invalid_dep/stdout.log b/tests/testsuite/cargo_remove/invalid_dep/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/invalid_package/in b/tests/testsuite/cargo_remove/invalid_package/in new file mode 120000 index 000000000000..e2165e8cb726 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package/in @@ -0,0 +1 @@ +../remove-package.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/invalid_package/mod.rs b/tests/testsuite/cargo_remove/invalid_package/mod.rs new file mode 100644 index 000000000000..bff09882ed96 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["docopt", "--package", "dep-c"]) + .current_dir(cwd) + .assert() + .code(101) + .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); +} diff --git a/tests/testsuite/cargo_remove/invalid_package/out/Cargo.toml b/tests/testsuite/cargo_remove/invalid_package/out/Cargo.toml new file mode 100644 index 000000000000..733857113321 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package/out/Cargo.toml @@ -0,0 +1,5 @@ +[workspace] +members = [ + "dep-a", + "dep-b" +] diff --git a/tests/testsuite/cargo_remove/invalid_package/out/dep-a/Cargo.toml b/tests/testsuite/cargo_remove/invalid_package/out/dep-a/Cargo.toml new file mode 100644 index 000000000000..7e87ce314da1 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package/out/dep-a/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "dep-a" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_package/out/dep-a/src/lib.rs b/tests/testsuite/cargo_remove/invalid_package/out/dep-a/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package/out/dep-a/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/invalid_package/out/dep-b/Cargo.toml b/tests/testsuite/cargo_remove/invalid_package/out/dep-b/Cargo.toml new file mode 100644 index 000000000000..37d2d3ddf0ba --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package/out/dep-b/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "dep-b" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_package/out/dep-b/src/lib.rs b/tests/testsuite/cargo_remove/invalid_package/out/dep-b/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package/out/dep-b/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/invalid_package/stderr.log b/tests/testsuite/cargo_remove/invalid_package/stderr.log new file mode 100644 index 000000000000..683512ca007f --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package/stderr.log @@ -0,0 +1 @@ +error: package(s) `dep-c` not found in workspace `[ROOT]/case` diff --git a/tests/testsuite/cargo_remove/invalid_package/stdout.log b/tests/testsuite/cargo_remove/invalid_package/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/in b/tests/testsuite/cargo_remove/invalid_package_multiple/in new file mode 120000 index 000000000000..e2165e8cb726 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/in @@ -0,0 +1 @@ +../remove-package.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs b/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs new file mode 100644 index 000000000000..5093d5d2dc71 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_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() + .code(101) + .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); +} diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/out/Cargo.toml b/tests/testsuite/cargo_remove/invalid_package_multiple/out/Cargo.toml new file mode 100644 index 000000000000..733857113321 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/out/Cargo.toml @@ -0,0 +1,5 @@ +[workspace] +members = [ + "dep-a", + "dep-b" +] diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-a/Cargo.toml b/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-a/Cargo.toml new file mode 100644 index 000000000000..7e87ce314da1 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-a/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "dep-a" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-a/src/lib.rs b/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-a/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-a/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-b/Cargo.toml b/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-b/Cargo.toml new file mode 100644 index 000000000000..37d2d3ddf0ba --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-b/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "dep-b" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-b/src/lib.rs b/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-b/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/out/dep-b/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/stderr.log b/tests/testsuite/cargo_remove/invalid_package_multiple/stderr.log new file mode 100644 index 000000000000..b18ca3b8b0eb --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_package_multiple/stderr.log @@ -0,0 +1 @@ +error: 2 packages selected. Please specify one with `-p ` diff --git a/tests/testsuite/cargo_remove/invalid_package_multiple/stdout.log b/tests/testsuite/cargo_remove/invalid_package_multiple/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/invalid_section/in b/tests/testsuite/cargo_remove/invalid_section/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_section/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/invalid_section/mod.rs b/tests/testsuite/cargo_remove/invalid_section/mod.rs new file mode 100644 index 000000000000..80d42be1d6a1 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_section/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--build", "docopt"]) + .current_dir(cwd) + .assert() + .code(101) + .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); +} diff --git a/tests/testsuite/cargo_remove/invalid_section/out/Cargo.toml b/tests/testsuite/cargo_remove/invalid_section/out/Cargo.toml new file mode 100644 index 000000000000..340f06cda792 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_section/out/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_section/stderr.log b/tests/testsuite/cargo_remove/invalid_section/stderr.log new file mode 100644 index 000000000000..fff5ff00ae72 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_section/stderr.log @@ -0,0 +1,2 @@ + Removing docopt from build-dependencies +error: the dependency `docopt` could not be found in `build-dependencies`. diff --git a/tests/testsuite/cargo_remove/invalid_section/stdout.log b/tests/testsuite/cargo_remove/invalid_section/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/invalid_section_dep/in b/tests/testsuite/cargo_remove/invalid_section_dep/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_section_dep/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs new file mode 100644 index 000000000000..7be8fd6284a4 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_section_dep/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--dev", "semver", "regex"]) + .current_dir(cwd) + .assert() + .code(101) + .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); +} diff --git a/tests/testsuite/cargo_remove/invalid_section_dep/out/Cargo.toml b/tests/testsuite/cargo_remove/invalid_section_dep/out/Cargo.toml new file mode 100644 index 000000000000..340f06cda792 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_section_dep/out/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_section_dep/stderr.log b/tests/testsuite/cargo_remove/invalid_section_dep/stderr.log new file mode 100644 index 000000000000..1926f9577e4a --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_section_dep/stderr.log @@ -0,0 +1,2 @@ + Removing semver from dev-dependencies +error: the dependency `semver` could not be found in `dev-dependencies`. diff --git a/tests/testsuite/cargo_remove/invalid_section_dep/stdout.log b/tests/testsuite/cargo_remove/invalid_section_dep/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/invalid_target/in b/tests/testsuite/cargo_remove/invalid_target/in new file mode 120000 index 000000000000..d5742d038875 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_target/in @@ -0,0 +1 @@ +../remove-target.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/invalid_target/mod.rs b/tests/testsuite/cargo_remove/invalid_target/mod.rs new file mode 100644 index 000000000000..34deb6cb848f --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_target/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--target", "powerpc-unknown-linux-gnu", "dbus"]) + .current_dir(cwd) + .assert() + .code(101) + .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); +} diff --git a/tests/testsuite/cargo_remove/invalid_target/out/Cargo.toml b/tests/testsuite/cargo_remove/invalid_target/out/Cargo.toml new file mode 100644 index 000000000000..14747c70b507 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_target/out/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "cargo-remove-target-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[target.x86_64-unknown-freebsd.build-dependencies] +semver = "0.1.0" + +[target.x86_64-unknown-linux-gnu.build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[target.x86_64-unknown-linux-gnu.dependencies] +dbus = "0.6.2" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[target.x86_64-unknown-linux-gnu.dev-dependencies] +ncurses = "20.0" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_target/stderr.log b/tests/testsuite/cargo_remove/invalid_target/stderr.log new file mode 100644 index 000000000000..5075b80b70cc --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_target/stderr.log @@ -0,0 +1,2 @@ + Removing dbus from dependencies for target `powerpc-unknown-linux-gnu` +error: the dependency `dbus` could not be found in `target.powerpc-unknown-linux-gnu.dependencies`. diff --git a/tests/testsuite/cargo_remove/invalid_target/stdout.log b/tests/testsuite/cargo_remove/invalid_target/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/invalid_target_dep/in b/tests/testsuite/cargo_remove/invalid_target_dep/in new file mode 120000 index 000000000000..d5742d038875 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_target_dep/in @@ -0,0 +1 @@ +../remove-target.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs b/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs new file mode 100644 index 000000000000..e04418fa859d --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_target_dep/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--target", "x86_64-unknown-linux-gnu", "toml"]) + .current_dir(cwd) + .assert() + .code(101) + .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); +} diff --git a/tests/testsuite/cargo_remove/invalid_target_dep/out/Cargo.toml b/tests/testsuite/cargo_remove/invalid_target_dep/out/Cargo.toml new file mode 100644 index 000000000000..14747c70b507 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_target_dep/out/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "cargo-remove-target-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[target.x86_64-unknown-freebsd.build-dependencies] +semver = "0.1.0" + +[target.x86_64-unknown-linux-gnu.build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[target.x86_64-unknown-linux-gnu.dependencies] +dbus = "0.6.2" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[target.x86_64-unknown-linux-gnu.dev-dependencies] +ncurses = "20.0" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/invalid_target_dep/stderr.log b/tests/testsuite/cargo_remove/invalid_target_dep/stderr.log new file mode 100644 index 000000000000..54bfe085f154 --- /dev/null +++ b/tests/testsuite/cargo_remove/invalid_target_dep/stderr.log @@ -0,0 +1,2 @@ + Removing toml from dependencies for target `x86_64-unknown-linux-gnu` +error: the dependency `toml` could not be found in `target.x86_64-unknown-linux-gnu.dependencies`. diff --git a/tests/testsuite/cargo_remove/invalid_target_dep/stdout.log b/tests/testsuite/cargo_remove/invalid_target_dep/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/mod.rs b/tests/testsuite/cargo_remove/mod.rs new file mode 100644 index 000000000000..75178531ee33 --- /dev/null +++ b/tests/testsuite/cargo_remove/mod.rs @@ -0,0 +1,82 @@ +mod avoid_empty_tables; +mod build; +mod dev; +mod dry_run; +mod invalid_arg; +mod invalid_dep; +mod invalid_package; +mod invalid_package_multiple; +mod invalid_section; +mod invalid_section_dep; +mod invalid_target; +mod invalid_target_dep; +mod multiple_deps; +mod multiple_dev; +mod no_arg; +mod offline; +mod optional_dep_feature; +mod optional_feature; +mod package; +mod remove_basic; +mod target; +mod target_build; +mod target_dev; +mod update_lock_file; + +fn init_registry() { + cargo_test_support::registry::init(); + add_registry_packages(false); +} + +fn add_registry_packages(alt: bool) { + for name in [ + "clippy", + "dbus", + "docopt", + "ncurses", + "pad", + "regex", + "rustc-serialize", + "toml", + ] { + cargo_test_support::registry::Package::new(name, "0.1.1+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "0.2.0+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "0.2.3+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "0.4.1+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "0.6.2+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "0.9.9+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "1.0.90+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "20.0.0+my-package") + .alternative(alt) + .publish(); + } + + for name in ["semver", "serde"] { + cargo_test_support::registry::Package::new(name, "0.1.1") + .alternative(alt) + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new(name, "0.9.0") + .alternative(alt) + .feature("std", &[]) + .publish(); + cargo_test_support::registry::Package::new(name, "1.0.90") + .alternative(alt) + .feature("std", &[]) + .publish(); + } +} diff --git a/tests/testsuite/cargo_remove/multiple_deps/in b/tests/testsuite/cargo_remove/multiple_deps/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/multiple_deps/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/multiple_deps/mod.rs b/tests/testsuite/cargo_remove/multiple_deps/mod.rs new file mode 100644 index 000000000000..35922b73894f --- /dev/null +++ b/tests/testsuite/cargo_remove/multiple_deps/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["docopt", "semver"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/multiple_deps/out/Cargo.toml b/tests/testsuite/cargo_remove/multiple_deps/out/Cargo.toml new file mode 100644 index 000000000000..53cde0829363 --- /dev/null +++ b/tests/testsuite/cargo_remove/multiple_deps/out/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +rustc-serialize = "0.4" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/multiple_deps/stderr.log b/tests/testsuite/cargo_remove/multiple_deps/stderr.log new file mode 100644 index 000000000000..1eb59aca1b70 --- /dev/null +++ b/tests/testsuite/cargo_remove/multiple_deps/stderr.log @@ -0,0 +1,3 @@ + Removing docopt from dependencies + Removing semver from dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/multiple_deps/stdout.log b/tests/testsuite/cargo_remove/multiple_deps/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/multiple_dev/in b/tests/testsuite/cargo_remove/multiple_dev/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/multiple_dev/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/multiple_dev/mod.rs b/tests/testsuite/cargo_remove/multiple_dev/mod.rs new file mode 100644 index 000000000000..5eac7e2f8f5c --- /dev/null +++ b/tests/testsuite/cargo_remove/multiple_dev/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--dev", "regex", "serde"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/multiple_dev/out/Cargo.toml b/tests/testsuite/cargo_remove/multiple_dev/out/Cargo.toml new file mode 100644 index 000000000000..b435e33ebf2b --- /dev/null +++ b/tests/testsuite/cargo_remove/multiple_dev/out/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[features] +std = [ "semver/std"] diff --git a/tests/testsuite/cargo_remove/multiple_dev/stderr.log b/tests/testsuite/cargo_remove/multiple_dev/stderr.log new file mode 100644 index 000000000000..a3042dcc3cd4 --- /dev/null +++ b/tests/testsuite/cargo_remove/multiple_dev/stderr.log @@ -0,0 +1,3 @@ + Removing regex from dev-dependencies + Removing serde from dev-dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/multiple_dev/stdout.log b/tests/testsuite/cargo_remove/multiple_dev/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/no_arg/in b/tests/testsuite/cargo_remove/no_arg/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/no_arg/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/no_arg/mod.rs b/tests/testsuite/cargo_remove/no_arg/mod.rs new file mode 100644 index 000000000000..d0c66f9b05a5 --- /dev/null +++ b/tests/testsuite/cargo_remove/no_arg/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .current_dir(cwd) + .assert() + .code(1) + .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); +} diff --git a/tests/testsuite/cargo_remove/no_arg/out/Cargo.toml b/tests/testsuite/cargo_remove/no_arg/out/Cargo.toml new file mode 100644 index 000000000000..340f06cda792 --- /dev/null +++ b/tests/testsuite/cargo_remove/no_arg/out/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/no_arg/stderr.log b/tests/testsuite/cargo_remove/no_arg/stderr.log new file mode 100644 index 000000000000..71dccf0758d1 --- /dev/null +++ b/tests/testsuite/cargo_remove/no_arg/stderr.log @@ -0,0 +1,7 @@ +error: The following required arguments were not provided: + ... + +USAGE: + cargo[EXE] remove [OPTIONS] ... + +For more information try --help diff --git a/tests/testsuite/cargo_remove/no_arg/stdout.log b/tests/testsuite/cargo_remove/no_arg/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/offline/in b/tests/testsuite/cargo_remove/offline/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/offline/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/offline/mod.rs b/tests/testsuite/cargo_remove/offline/mod.rs new file mode 100644 index 000000000000..ab86ed555458 --- /dev/null +++ b/tests/testsuite/cargo_remove/offline/mod.rs @@ -0,0 +1,35 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; +use cargo_test_support::TestEnv; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + // run the metadata command to populate the cache + let cargo = std::env::var_os("CARGO").unwrap(); + snapbox::cmd::Command::new(cargo) + .test_env() + .arg("metadata") + .current_dir(cwd) + .assert() + .success(); + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["docopt", "--offline"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/offline/out/Cargo.toml b/tests/testsuite/cargo_remove/offline/out/Cargo.toml new file mode 100644 index 000000000000..b8628eed1c23 --- /dev/null +++ b/tests/testsuite/cargo_remove/offline/out/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/offline/stderr.log b/tests/testsuite/cargo_remove/offline/stderr.log new file mode 100644 index 000000000000..7083976b17de --- /dev/null +++ b/tests/testsuite/cargo_remove/offline/stderr.log @@ -0,0 +1 @@ + Removing docopt from dependencies diff --git a/tests/testsuite/cargo_remove/offline/stdout.log b/tests/testsuite/cargo_remove/offline/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/optional_dep_feature/in b/tests/testsuite/cargo_remove/optional_dep_feature/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/optional_dep_feature/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs b/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs new file mode 100644 index 000000000000..cae736b347da --- /dev/null +++ b/tests/testsuite/cargo_remove/optional_dep_feature/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--dev", "serde"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/optional_dep_feature/out/Cargo.toml b/tests/testsuite/cargo_remove/optional_dep_feature/out/Cargo.toml new file mode 100644 index 000000000000..f9613bd30925 --- /dev/null +++ b/tests/testsuite/cargo_remove/optional_dep_feature/out/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" + +[features] +std = [ "semver/std"] diff --git a/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log b/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log new file mode 100644 index 000000000000..72c9f92172d7 --- /dev/null +++ b/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log @@ -0,0 +1,2 @@ + Removing serde from dev-dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/optional_dep_feature/stdout.log b/tests/testsuite/cargo_remove/optional_dep_feature/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/optional_feature/in b/tests/testsuite/cargo_remove/optional_feature/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/optional_feature/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/optional_feature/mod.rs b/tests/testsuite/cargo_remove/optional_feature/mod.rs new file mode 100644 index 000000000000..af54226bba59 --- /dev/null +++ b/tests/testsuite/cargo_remove/optional_feature/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["semver"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/optional_feature/out/Cargo.toml b/tests/testsuite/cargo_remove/optional_feature/out/Cargo.toml new file mode 100644 index 000000000000..9ac0b1b32522 --- /dev/null +++ b/tests/testsuite/cargo_remove/optional_feature/out/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/optional_feature/stderr.log b/tests/testsuite/cargo_remove/optional_feature/stderr.log new file mode 100644 index 000000000000..2dc546fa718b --- /dev/null +++ b/tests/testsuite/cargo_remove/optional_feature/stderr.log @@ -0,0 +1,2 @@ + Removing semver from dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/optional_feature/stdout.log b/tests/testsuite/cargo_remove/optional_feature/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/package/in b/tests/testsuite/cargo_remove/package/in new file mode 120000 index 000000000000..e2165e8cb726 --- /dev/null +++ b/tests/testsuite/cargo_remove/package/in @@ -0,0 +1 @@ +../remove-package.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/package/mod.rs b/tests/testsuite/cargo_remove/package/mod.rs new file mode 100644 index 000000000000..2714f3197258 --- /dev/null +++ b/tests/testsuite/cargo_remove/package/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["docopt", "--package", "dep-a"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/package/out/Cargo.toml b/tests/testsuite/cargo_remove/package/out/Cargo.toml new file mode 100644 index 000000000000..733857113321 --- /dev/null +++ b/tests/testsuite/cargo_remove/package/out/Cargo.toml @@ -0,0 +1,5 @@ +[workspace] +members = [ + "dep-a", + "dep-b" +] diff --git a/tests/testsuite/cargo_remove/package/out/dep-a/Cargo.toml b/tests/testsuite/cargo_remove/package/out/dep-a/Cargo.toml new file mode 100644 index 000000000000..5f2bfe6fb1a8 --- /dev/null +++ b/tests/testsuite/cargo_remove/package/out/dep-a/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "dep-a" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/package/out/dep-a/src/lib.rs b/tests/testsuite/cargo_remove/package/out/dep-a/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/package/out/dep-a/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/package/out/dep-b/Cargo.toml b/tests/testsuite/cargo_remove/package/out/dep-b/Cargo.toml new file mode 100644 index 000000000000..37d2d3ddf0ba --- /dev/null +++ b/tests/testsuite/cargo_remove/package/out/dep-b/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "dep-b" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/package/out/dep-b/src/lib.rs b/tests/testsuite/cargo_remove/package/out/dep-b/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/package/out/dep-b/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/package/stderr.log b/tests/testsuite/cargo_remove/package/stderr.log new file mode 100644 index 000000000000..231026f2bf6e --- /dev/null +++ b/tests/testsuite/cargo_remove/package/stderr.log @@ -0,0 +1,2 @@ + Removing docopt from dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/package/stdout.log b/tests/testsuite/cargo_remove/package/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/remove-basic.in/Cargo.toml b/tests/testsuite/cargo_remove/remove-basic.in/Cargo.toml new file mode 100644 index 000000000000..340f06cda792 --- /dev/null +++ b/tests/testsuite/cargo_remove/remove-basic.in/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/remove-basic.in/src/lib.rs b/tests/testsuite/cargo_remove/remove-basic.in/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/remove-basic.in/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/remove-package.in/Cargo.toml b/tests/testsuite/cargo_remove/remove-package.in/Cargo.toml new file mode 100644 index 000000000000..733857113321 --- /dev/null +++ b/tests/testsuite/cargo_remove/remove-package.in/Cargo.toml @@ -0,0 +1,5 @@ +[workspace] +members = [ + "dep-a", + "dep-b" +] diff --git a/tests/testsuite/cargo_remove/remove-package.in/dep-a/Cargo.toml b/tests/testsuite/cargo_remove/remove-package.in/dep-a/Cargo.toml new file mode 100644 index 000000000000..7e87ce314da1 --- /dev/null +++ b/tests/testsuite/cargo_remove/remove-package.in/dep-a/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "dep-a" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/remove-package.in/dep-a/src/lib.rs b/tests/testsuite/cargo_remove/remove-package.in/dep-a/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/remove-package.in/dep-a/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/remove-package.in/dep-b/Cargo.toml b/tests/testsuite/cargo_remove/remove-package.in/dep-b/Cargo.toml new file mode 100644 index 000000000000..37d2d3ddf0ba --- /dev/null +++ b/tests/testsuite/cargo_remove/remove-package.in/dep-b/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "dep-b" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/remove-package.in/dep-b/src/lib.rs b/tests/testsuite/cargo_remove/remove-package.in/dep-b/src/lib.rs new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/tests/testsuite/cargo_remove/remove-package.in/dep-b/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/testsuite/cargo_remove/remove-target.in/Cargo.toml b/tests/testsuite/cargo_remove/remove-target.in/Cargo.toml new file mode 100644 index 000000000000..14747c70b507 --- /dev/null +++ b/tests/testsuite/cargo_remove/remove-target.in/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "cargo-remove-target-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[target.x86_64-unknown-freebsd.build-dependencies] +semver = "0.1.0" + +[target.x86_64-unknown-linux-gnu.build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[target.x86_64-unknown-linux-gnu.dependencies] +dbus = "0.6.2" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[target.x86_64-unknown-linux-gnu.dev-dependencies] +ncurses = "20.0" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/remove_basic/in b/tests/testsuite/cargo_remove/remove_basic/in new file mode 120000 index 000000000000..7fd0ba5ebcce --- /dev/null +++ b/tests/testsuite/cargo_remove/remove_basic/in @@ -0,0 +1 @@ +../remove-basic.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/remove_basic/mod.rs b/tests/testsuite/cargo_remove/remove_basic/mod.rs new file mode 100644 index 000000000000..53381e6bc990 --- /dev/null +++ b/tests/testsuite/cargo_remove/remove_basic/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_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_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); +} diff --git a/tests/testsuite/cargo_remove/remove_basic/out/Cargo.toml b/tests/testsuite/cargo_remove/remove_basic/out/Cargo.toml new file mode 100644 index 000000000000..b8628eed1c23 --- /dev/null +++ b/tests/testsuite/cargo_remove/remove_basic/out/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/remove_basic/stderr.log b/tests/testsuite/cargo_remove/remove_basic/stderr.log new file mode 100644 index 000000000000..231026f2bf6e --- /dev/null +++ b/tests/testsuite/cargo_remove/remove_basic/stderr.log @@ -0,0 +1,2 @@ + Removing docopt from dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/remove_basic/stdout.log b/tests/testsuite/cargo_remove/remove_basic/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/target/in b/tests/testsuite/cargo_remove/target/in new file mode 120000 index 000000000000..d5742d038875 --- /dev/null +++ b/tests/testsuite/cargo_remove/target/in @@ -0,0 +1 @@ +../remove-target.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/target/mod.rs b/tests/testsuite/cargo_remove/target/mod.rs new file mode 100644 index 000000000000..1447c753d3ce --- /dev/null +++ b/tests/testsuite/cargo_remove/target/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--target", "x86_64-unknown-linux-gnu", "dbus"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/target/out/Cargo.toml b/tests/testsuite/cargo_remove/target/out/Cargo.toml new file mode 100644 index 000000000000..e29fbbd0030c --- /dev/null +++ b/tests/testsuite/cargo_remove/target/out/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "cargo-remove-target-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[target.x86_64-unknown-freebsd.build-dependencies] +semver = "0.1.0" + +[target.x86_64-unknown-linux-gnu.build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[target.x86_64-unknown-linux-gnu.dev-dependencies] +ncurses = "20.0" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/target/stderr.log b/tests/testsuite/cargo_remove/target/stderr.log new file mode 100644 index 000000000000..810abd994d93 --- /dev/null +++ b/tests/testsuite/cargo_remove/target/stderr.log @@ -0,0 +1,2 @@ + Removing dbus from dependencies for target `x86_64-unknown-linux-gnu` + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/target/stdout.log b/tests/testsuite/cargo_remove/target/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/target_build/in b/tests/testsuite/cargo_remove/target_build/in new file mode 120000 index 000000000000..d5742d038875 --- /dev/null +++ b/tests/testsuite/cargo_remove/target_build/in @@ -0,0 +1 @@ +../remove-target.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/target_build/mod.rs b/tests/testsuite/cargo_remove/target_build/mod.rs new file mode 100644 index 000000000000..11afbbf8f8d0 --- /dev/null +++ b/tests/testsuite/cargo_remove/target_build/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--build", "--target", "x86_64-unknown-linux-gnu", "semver"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/target_build/out/Cargo.toml b/tests/testsuite/cargo_remove/target_build/out/Cargo.toml new file mode 100644 index 000000000000..7353c7a897b1 --- /dev/null +++ b/tests/testsuite/cargo_remove/target_build/out/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "cargo-remove-target-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[target.x86_64-unknown-freebsd.build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[target.x86_64-unknown-linux-gnu.dependencies] +dbus = "0.6.2" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[target.x86_64-unknown-linux-gnu.dev-dependencies] +ncurses = "20.0" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/target_build/stderr.log b/tests/testsuite/cargo_remove/target_build/stderr.log new file mode 100644 index 000000000000..b06f8f319c58 --- /dev/null +++ b/tests/testsuite/cargo_remove/target_build/stderr.log @@ -0,0 +1,2 @@ + Removing semver from build-dependencies for target `x86_64-unknown-linux-gnu` + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/target_build/stdout.log b/tests/testsuite/cargo_remove/target_build/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/target_dev/in b/tests/testsuite/cargo_remove/target_dev/in new file mode 120000 index 000000000000..d5742d038875 --- /dev/null +++ b/tests/testsuite/cargo_remove/target_dev/in @@ -0,0 +1 @@ +../remove-target.in/ \ No newline at end of file diff --git a/tests/testsuite/cargo_remove/target_dev/mod.rs b/tests/testsuite/cargo_remove/target_dev/mod.rs new file mode 100644 index 000000000000..d303c2b857fc --- /dev/null +++ b/tests/testsuite/cargo_remove/target_dev/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["--dev", "--target", "x86_64-unknown-linux-gnu", "ncurses"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/target_dev/out/Cargo.toml b/tests/testsuite/cargo_remove/target_dev/out/Cargo.toml new file mode 100644 index 000000000000..a477b3d55cdb --- /dev/null +++ b/tests/testsuite/cargo_remove/target_dev/out/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "cargo-remove-target-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[target.x86_64-unknown-freebsd.build-dependencies] +semver = "0.1.0" + +[target.x86_64-unknown-linux-gnu.build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[target.x86_64-unknown-linux-gnu.dependencies] +dbus = "0.6.2" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/target_dev/stderr.log b/tests/testsuite/cargo_remove/target_dev/stderr.log new file mode 100644 index 000000000000..68553a3bdce1 --- /dev/null +++ b/tests/testsuite/cargo_remove/target_dev/stderr.log @@ -0,0 +1,2 @@ + Removing ncurses from dev-dependencies for target `x86_64-unknown-linux-gnu` + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/target_dev/stdout.log b/tests/testsuite/cargo_remove/target_dev/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock b/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock new file mode 100644 index 000000000000..06c2052d5265 --- /dev/null +++ b/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock @@ -0,0 +1,58 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cargo-remove-test-fixture" +version = "0.1.0" +dependencies = [ + "clippy", + "docopt", + "regex", + "rustc-serialize", + "semver", + "serde", + "toml", +] + +[[package]] +name = "clippy" +version = "0.4.1+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ced0eda54e9ddc6063f0e1d0164493cd16c84c6b6a0329a536967c44e205f7" + +[[package]] +name = "docopt" +version = "0.6.2+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b600540c4fafb27bf6e6961f0f1e6f547c9d6126ce581ab3a92f878c8e2c9a2c" + +[[package]] +name = "regex" +version = "0.1.1+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84949cb53285a6c481d0133065a7b669871acfd9e20f273f4ce1283c309775d5" + +[[package]] +name = "rustc-serialize" +version = "0.4.1+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31162e7d23a085553c42dee375787b451a481275473f7779c4a63bcc267a24fd" + +[[package]] +name = "semver" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3031434e07edc922bf1b8262f075fac1522694f17b1ee7ad314c4cabd5d2723f" + +[[package]] +name = "serde" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75d9264696ebbf5315a6b068e9910c4df9274365afac2d88abf66525df660218" + +[[package]] +name = "toml" +version = "0.1.1+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0f6c7804525ce0a968ef270e55a516cf4bdcf1fea0b09d130e0aa34a66745b3" diff --git a/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.toml b/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.toml new file mode 100644 index 000000000000..340f06cda792 --- /dev/null +++ b/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +rustc-serialize = "0.4" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/update_lock_file/in/src/main.rs b/tests/testsuite/cargo_remove/update_lock_file/in/src/main.rs new file mode 100644 index 000000000000..f328e4d9d04c --- /dev/null +++ b/tests/testsuite/cargo_remove/update_lock_file/in/src/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/testsuite/cargo_remove/update_lock_file/mod.rs b/tests/testsuite/cargo_remove/update_lock_file/mod.rs new file mode 100644 index 000000000000..be5bc87f5812 --- /dev/null +++ b/tests/testsuite/cargo_remove/update_lock_file/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +use crate::cargo_remove::init_registry; + +#[cargo_test] +fn case() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .args(["rustc-serialize"]) + .current_dir(cwd) + .assert() + .success() + .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); +} diff --git a/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock b/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock new file mode 100644 index 000000000000..bd8c90f46876 --- /dev/null +++ b/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock @@ -0,0 +1,51 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cargo-remove-test-fixture" +version = "0.1.0" +dependencies = [ + "clippy", + "docopt", + "regex", + "semver", + "serde", + "toml", +] + +[[package]] +name = "clippy" +version = "0.4.1+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ced0eda54e9ddc6063f0e1d0164493cd16c84c6b6a0329a536967c44e205f7" + +[[package]] +name = "docopt" +version = "0.6.2+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b600540c4fafb27bf6e6961f0f1e6f547c9d6126ce581ab3a92f878c8e2c9a2c" + +[[package]] +name = "regex" +version = "0.1.1+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84949cb53285a6c481d0133065a7b669871acfd9e20f273f4ce1283c309775d5" + +[[package]] +name = "semver" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3031434e07edc922bf1b8262f075fac1522694f17b1ee7ad314c4cabd5d2723f" + +[[package]] +name = "serde" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75d9264696ebbf5315a6b068e9910c4df9274365afac2d88abf66525df660218" + +[[package]] +name = "toml" +version = "0.1.1+my-package" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0f6c7804525ce0a968ef270e55a516cf4bdcf1fea0b09d130e0aa34a66745b3" diff --git a/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.toml b/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.toml new file mode 100644 index 000000000000..5e7d7f0a06eb --- /dev/null +++ b/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "cargo-remove-test-fixture" +version = "0.1.0" + +[[bin]] +name = "main" +path = "src/main.rs" + +[build-dependencies] +semver = "0.1.0" + +[dependencies] +docopt = "0.6" +semver = "0.1" +toml = "0.1" +clippy = "0.4" + +[dev-dependencies] +regex = "0.1.1" +serde = "1.0.90" + +[features] +std = ["serde/std", "semver/std"] diff --git a/tests/testsuite/cargo_remove/update_lock_file/out/src/main.rs b/tests/testsuite/cargo_remove/update_lock_file/out/src/main.rs new file mode 100644 index 000000000000..f328e4d9d04c --- /dev/null +++ b/tests/testsuite/cargo_remove/update_lock_file/out/src/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/testsuite/cargo_remove/update_lock_file/stderr.log b/tests/testsuite/cargo_remove/update_lock_file/stderr.log new file mode 100644 index 000000000000..164f8f4b979e --- /dev/null +++ b/tests/testsuite/cargo_remove/update_lock_file/stderr.log @@ -0,0 +1,2 @@ + Removing rustc-serialize from dependencies + Updating `dummy-registry` index diff --git a/tests/testsuite/cargo_remove/update_lock_file/stdout.log b/tests/testsuite/cargo_remove/update_lock_file/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1