diff options
Diffstat (limited to 'src/tools/cargo/tests/testsuite/cargo_add/invalid_arg')
5 files changed, 40 insertions, 0 deletions
diff --git a/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/in b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/in new file mode 120000 index 000000000..6c6a27fcf --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/in @@ -0,0 +1 @@ +../add-basic.in
\ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/mod.rs b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/mod.rs new file mode 100644 index 000000000..265a571bc --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/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-package --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/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/out/Cargo.toml new file mode 100644 index 000000000..3ecdb6681 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/out/Cargo.toml @@ -0,0 +1,5 @@ +[workspace] + +[package] +name = "cargo-list-test-fixture" +version = "0.0.0" diff --git a/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/stderr.log b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/stderr.log new file mode 100644 index 000000000..96d067ed1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/stderr.log @@ -0,0 +1,9 @@ +error: unexpected argument '--flag' found + + tip: a similar argument exists: '--tag' + +Usage: cargo add [OPTIONS] <DEP>[@<VERSION>] ... + cargo add [OPTIONS] --path <PATH> ... + cargo add [OPTIONS] --git <URL> ... + +For more information, try '--help'. diff --git a/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/stdout.log b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/stdout.log new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/invalid_arg/stdout.log |