diff options
Diffstat (limited to 'tests/testsuite/cargo_add/overwrite_optional')
6 files changed, 46 insertions, 0 deletions
diff --git a/tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml new file mode 100644 index 0000000..c5e0178 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" + +[dependencies] +my-package1 = "99999.0.0" +my-package2 = "0.4.1" diff --git a/tests/testsuite/cargo_add/overwrite_optional/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_optional/in/src/lib.rs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_optional/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_optional/mod.rs b/tests/testsuite/cargo_add/overwrite_optional/mod.rs new file mode 100644 index 0000000..94d1cbf --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_optional/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[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("add") + .arg_line("my-package1 my-package2@0.4.1 --optional") + .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_add/overwrite_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml new file mode 100644 index 0000000..eda5445 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" + +[dependencies] +my-package1 = { version = "99999.0.0", optional = true } +my-package2 = { version = "0.4.1", optional = true } diff --git a/tests/testsuite/cargo_add/overwrite_optional/stderr.log b/tests/testsuite/cargo_add/overwrite_optional/stderr.log new file mode 100644 index 0000000..8cf4812 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_optional/stderr.log @@ -0,0 +1,3 @@ + Updating `dummy-registry` index + Adding my-package1 v99999.0.0 to optional dependencies. + Adding my-package2 v0.4.1 to optional dependencies. diff --git a/tests/testsuite/cargo_add/overwrite_optional/stdout.log b/tests/testsuite/cargo_add/overwrite_optional/stdout.log new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_optional/stdout.log |