diff --git a/tests/testsuite/cargo_add/features_fuzzy/in/Cargo.toml b/tests/testsuite/cargo_add/features_fuzzy/in/Cargo.toml new file mode 100644 index 00000000000..2eb8521d642 --- /dev/null +++ b/tests/testsuite/cargo_add/features_fuzzy/in/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" +edition = "2015" + +[dependencies] +your-face = { version = "99999.0.0", features = ["nose"] } \ No newline at end of file diff --git a/tests/testsuite/cargo_add/features_fuzzy/in/src/lib.rs b/tests/testsuite/cargo_add/features_fuzzy/in/src/lib.rs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/testsuite/cargo_add/features_fuzzy/mod.rs b/tests/testsuite/cargo_add/features_fuzzy/mod.rs new file mode 100644 index 00000000000..8250de5f340 --- /dev/null +++ b/tests/testsuite/cargo_add/features_fuzzy/mod.rs @@ -0,0 +1,32 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::current_dir; +use cargo_test_support::file; +use cargo_test_support::prelude::*; +use cargo_test_support::str; +use cargo_test_support::Project; + +#[cargo_test] +fn case() { + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("your-face", "99999.0.0+my-package") + .feature("nose", &[]) + .feature("mouth", &[]) + .feature("eyes", &[]) + .feature("ears", &[]) + .publish(); + + let project = Project::from_template(current_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("add") + .arg_line("your_face -F eyes") + .current_dir(cwd) + .assert() + .success() + .stdout_matches(str![""]) + .stderr_matches(file!["stderr.term.svg"]); + + assert_ui().subset_matches(current_dir!().join("out"), &project_root); +} diff --git a/tests/testsuite/cargo_add/features_fuzzy/out/Cargo.toml b/tests/testsuite/cargo_add/features_fuzzy/out/Cargo.toml new file mode 100644 index 00000000000..299aa8a6486 --- /dev/null +++ b/tests/testsuite/cargo_add/features_fuzzy/out/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" +edition = "2015" + +[dependencies] +your-face = { version = "99999.0.0", features = ["eyes", "nose"] } diff --git a/tests/testsuite/cargo_add/features_fuzzy/stderr.term.svg b/tests/testsuite/cargo_add/features_fuzzy/stderr.term.svg new file mode 100644 index 00000000000..efcedff9829 --- /dev/null +++ b/tests/testsuite/cargo_add/features_fuzzy/stderr.term.svg @@ -0,0 +1,45 @@ + + + + + + + Updating `dummy-registry` index + + warning: translating `your_face` to `your-face` + + Adding your-face v99999.0.0 to dependencies + + Features: + + + eyes + + - ears + + - mouth + + - nose + + Locking 2 packages + + + + + + diff --git a/tests/testsuite/cargo_add/mod.rs b/tests/testsuite/cargo_add/mod.rs index 4cfd1e0b4af..efc4264ecdd 100644 --- a/tests/testsuite/cargo_add/mod.rs +++ b/tests/testsuite/cargo_add/mod.rs @@ -25,6 +25,7 @@ mod features; mod features_activated_over_limit; mod features_deactivated_over_limit; mod features_empty; +mod features_fuzzy; mod features_multiple_occurrences; mod features_preserve; mod features_spaced_values;