From d1b2d29528b7794b41e66fc2136e395a02f8529b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:59:35 +0200 Subject: Merging upstream version 1.73.0+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/cargo/tests/testsuite/alt_registry.rs | 41 ++ src/tools/cargo/tests/testsuite/bench.rs | 61 +- src/tools/cargo/tests/testsuite/build_script.rs | 29 + .../cargo/tests/testsuite/build_script_env.rs | 10 +- src/tools/cargo/tests/testsuite/cargo/help/mod.rs | 12 + .../cargo/tests/testsuite/cargo/help/stderr.log | 0 .../cargo/tests/testsuite/cargo/help/stdout.log | 39 ++ src/tools/cargo/tests/testsuite/cargo/mod.rs | 1 + .../cargo/tests/testsuite/cargo_add/help/mod.rs | 13 + .../tests/testsuite/cargo_add/help/stderr.log | 0 .../tests/testsuite/cargo_add/help/stdout.log | 124 ++++ src/tools/cargo/tests/testsuite/cargo_add/mod.rs | 1 + .../cargo/tests/testsuite/cargo_bench/help/mod.rs | 13 + .../tests/testsuite/cargo_bench/help/stderr.log | 0 .../tests/testsuite/cargo_bench/help/stdout.log | 59 ++ src/tools/cargo/tests/testsuite/cargo_bench/mod.rs | 1 + .../cargo/tests/testsuite/cargo_build/help/mod.rs | 13 + .../tests/testsuite/cargo_build/help/stderr.log | 0 .../tests/testsuite/cargo_build/help/stdout.log | 58 ++ src/tools/cargo/tests/testsuite/cargo_build/mod.rs | 1 + .../cargo/tests/testsuite/cargo_check/help/mod.rs | 13 + .../tests/testsuite/cargo_check/help/stderr.log | 0 .../tests/testsuite/cargo_check/help/stdout.log | 56 ++ src/tools/cargo/tests/testsuite/cargo_check/mod.rs | 1 + .../cargo/tests/testsuite/cargo_clean/help/mod.rs | 13 + .../tests/testsuite/cargo_clean/help/stderr.log | 0 .../tests/testsuite/cargo_clean/help/stdout.log | 29 + src/tools/cargo/tests/testsuite/cargo_clean/mod.rs | 1 + src/tools/cargo/tests/testsuite/cargo_config.rs | 520 ----------------- .../cargo/tests/testsuite/cargo_config/help/mod.rs | 13 + .../tests/testsuite/cargo_config/help/stderr.log | 0 .../tests/testsuite/cargo_config/help/stdout.log | 18 + .../cargo/tests/testsuite/cargo_config/mod.rs | 522 +++++++++++++++++ .../cargo/tests/testsuite/cargo_doc/help/mod.rs | 13 + .../tests/testsuite/cargo_doc/help/stderr.log | 0 .../tests/testsuite/cargo_doc/help/stdout.log | 53 ++ src/tools/cargo/tests/testsuite/cargo_doc/mod.rs | 1 + .../cargo/tests/testsuite/cargo_fetch/help/mod.rs | 13 + .../tests/testsuite/cargo_fetch/help/stderr.log | 0 .../tests/testsuite/cargo_fetch/help/stdout.log | 22 + src/tools/cargo/tests/testsuite/cargo_fetch/mod.rs | 1 + .../cargo/tests/testsuite/cargo_fix/help/mod.rs | 13 + .../tests/testsuite/cargo_fix/help/stderr.log | 0 .../tests/testsuite/cargo_fix/help/stdout.log | 60 ++ src/tools/cargo/tests/testsuite/cargo_fix/mod.rs | 1 + .../testsuite/cargo_generate_lockfile/help/mod.rs | 13 + .../cargo_generate_lockfile/help/stderr.log | 0 .../cargo_generate_lockfile/help/stdout.log | 19 + .../tests/testsuite/cargo_generate_lockfile/mod.rs | 1 + .../tests/testsuite/cargo_git_checkout/help/mod.rs | 13 + .../testsuite/cargo_git_checkout/help/stderr.log | 0 .../testsuite/cargo_git_checkout/help/stdout.log | 1 + .../tests/testsuite/cargo_git_checkout/mod.rs | 1 + .../cargo/tests/testsuite/cargo_help/help/mod.rs | 13 + .../tests/testsuite/cargo_help/help/stderr.log | 0 .../tests/testsuite/cargo_help/help/stdout.log | 18 + src/tools/cargo/tests/testsuite/cargo_help/mod.rs | 1 + .../cargo/tests/testsuite/cargo_init/auto_git/in | 1 + .../tests/testsuite/cargo_init/auto_git/mod.rs | 22 + .../testsuite/cargo_init/auto_git/out/Cargo.toml | 8 + .../testsuite/cargo_init/auto_git/out/src/lib.rs | 14 + .../tests/testsuite/cargo_init/auto_git/stderr.log | 1 + .../tests/testsuite/cargo_init/auto_git/stdout.log | 0 .../bin_already_exists_explicit/in/src/main.rs | 4 + .../cargo_init/bin_already_exists_explicit/mod.rs | 21 + .../bin_already_exists_explicit/out/Cargo.toml | 8 + .../bin_already_exists_explicit/out/src/main.rs | 4 + .../bin_already_exists_explicit/stderr.log | 1 + .../bin_already_exists_explicit/stdout.log | 0 .../bin_already_exists_explicit_nosrc/in/main.rs | 4 + .../bin_already_exists_explicit_nosrc/mod.rs | 22 + .../out/Cargo.toml | 12 + .../bin_already_exists_explicit_nosrc/out/main.rs | 4 + .../bin_already_exists_explicit_nosrc/stderr.log | 1 + .../bin_already_exists_explicit_nosrc/stdout.log | 0 .../bin_already_exists_implicit/in/src/main.rs | 4 + .../cargo_init/bin_already_exists_implicit/mod.rs | 21 + .../bin_already_exists_implicit/out/Cargo.toml | 8 + .../bin_already_exists_implicit/out/src/main.rs | 4 + .../bin_already_exists_implicit/stderr.log | 1 + .../bin_already_exists_implicit/stdout.log | 0 .../in/case.rs | 4 + .../bin_already_exists_implicit_namenosrc/mod.rs | 22 + .../out/Cargo.toml | 12 + .../out/case.rs | 4 + .../stderr.log | 1 + .../stdout.log | 0 .../in/src/case.rs | 4 + .../bin_already_exists_implicit_namesrc/mod.rs | 22 + .../out/Cargo.toml | 12 + .../out/src/case.rs | 4 + .../bin_already_exists_implicit_namesrc/stderr.log | 1 + .../bin_already_exists_implicit_namesrc/stdout.log | 0 .../bin_already_exists_implicit_nosrc/in/main.rs | 4 + .../bin_already_exists_implicit_nosrc/mod.rs | 22 + .../out/Cargo.toml | 12 + .../bin_already_exists_implicit_nosrc/out/main.rs | 4 + .../bin_already_exists_implicit_nosrc/stderr.log | 1 + .../bin_already_exists_implicit_nosrc/stdout.log | 0 .../testsuite/cargo_init/both_lib_and_bin/mod.rs | 19 + .../cargo_init/both_lib_and_bin/stderr.log | 1 + .../cargo_init/both_lib_and_bin/stdout.log | 0 .../in/case.rs | 1 + .../in/lib.rs | 1 + .../mod.rs | 18 + .../stderr.log | 1 + .../stdout.log | 0 .../confused_by_multiple_lib_files/in/lib.rs | 1 + .../confused_by_multiple_lib_files/in/src/lib.rs | 1 + .../confused_by_multiple_lib_files/mod.rs | 22 + .../confused_by_multiple_lib_files/out/lib.rs | 1 + .../confused_by_multiple_lib_files/out/src/lib.rs | 1 + .../confused_by_multiple_lib_files/stderr.log | 1 + .../confused_by_multiple_lib_files/stdout.log | 0 .../in/case.rs | 1 + .../in/lib.rs | 1 + .../creates_binary_when_both_binlib_present/mod.rs | 21 + .../out/Cargo.toml | 16 + .../out/case.rs | 1 + .../out/lib.rs | 1 + .../stderr.log | 1 + .../stdout.log | 0 .../in/case.rs | 1 + .../mod.rs | 21 + .../out/Cargo.toml | 12 + .../out/case.rs | 1 + .../stderr.log | 2 + .../stdout.log | 0 .../in/case.rs | 1 + .../mod.rs | 21 + .../out/Cargo.toml | 12 + .../out/case.rs | 1 + .../stderr.log | 2 + .../stdout.log | 0 .../tests/testsuite/cargo_init/empty_dir/.keep | 0 .../tests/testsuite/cargo_init/empty_dir/mod.rs | 7 + .../testsuite/cargo_init/explicit_bin_with_git/in | 1 + .../cargo_init/explicit_bin_with_git/mod.rs | 21 + .../explicit_bin_with_git/out/Cargo.toml | 8 + .../explicit_bin_with_git/out/src/main.rs | 3 + .../cargo_init/explicit_bin_with_git/stderr.log | 1 + .../cargo_init/explicit_bin_with_git/stdout.log | 0 .../cargo_init/formats_source/in/rustfmt.toml | 1 + .../testsuite/cargo_init/formats_source/mod.rs | 29 + .../cargo_init/formats_source/out/Cargo.toml | 8 + .../cargo_init/formats_source/out/rustfmt.toml | 1 + .../cargo_init/formats_source/out/src/lib.rs | 14 + .../testsuite/cargo_init/formats_source/stderr.log | 1 + .../testsuite/cargo_init/formats_source/stdout.log | 0 .../cargo_init/fossil_autodetect/in/.fossil/.keep | 0 .../testsuite/cargo_init/fossil_autodetect/mod.rs | 22 + .../out/.fossil-settings/clean-glob | 2 + .../out/.fossil-settings/ignore-glob | 2 + .../cargo_init/fossil_autodetect/out/Cargo.toml | 8 + .../cargo_init/fossil_autodetect/out/src/lib.rs | 14 + .../cargo_init/fossil_autodetect/stderr.log | 1 + .../cargo_init/fossil_autodetect/stdout.log | 0 .../testsuite/cargo_init/git_autodetect/mod.rs | 24 + .../cargo_init/git_autodetect/out/Cargo.toml | 8 + .../cargo_init/git_autodetect/out/src/lib.rs | 14 + .../testsuite/cargo_init/git_autodetect/stderr.log | 1 + .../testsuite/cargo_init/git_autodetect/stdout.log | 0 .../mod.rs | 22 + .../out/Cargo.toml | 8 + .../out/src/lib.rs | 14 + .../stderr.log | 1 + .../stdout.log | 0 .../cargo/tests/testsuite/cargo_init/help/mod.rs | 13 + .../tests/testsuite/cargo_init/help/stderr.log | 0 .../tests/testsuite/cargo_init/help/stdout.log | 31 + .../in/rustfmt.toml | 1 + .../ignores_failure_to_format_source/mod.rs | 22 + .../out/Cargo.toml | 8 + .../out/rustfmt.toml | 1 + .../out/src/lib.rs | 14 + .../ignores_failure_to_format_source/stderr.log | 1 + .../ignores_failure_to_format_source/stdout.log | 0 .../cargo_init/inferred_bin_with_git/in/main.rs | 1 + .../cargo_init/inferred_bin_with_git/mod.rs | 21 + .../inferred_bin_with_git/out/Cargo.toml | 12 + .../cargo_init/inferred_bin_with_git/out/main.rs | 1 + .../cargo_init/inferred_bin_with_git/stderr.log | 1 + .../cargo_init/inferred_bin_with_git/stdout.log | 0 .../cargo_init/inferred_lib_with_git/in/lib.rs | 1 + .../cargo_init/inferred_lib_with_git/mod.rs | 21 + .../inferred_lib_with_git/out/Cargo.toml | 12 + .../cargo_init/inferred_lib_with_git/out/lib.rs | 1 + .../cargo_init/inferred_lib_with_git/stderr.log | 1 + .../cargo_init/inferred_lib_with_git/stdout.log | 0 .../inherit_workspace_package_table/in/Cargo.toml | 21 + .../inherit_workspace_package_table/in/README.md | 0 .../in/crates/foo/src/main.rs | 3 + .../inherit_workspace_package_table/in/src/lib.rs | 14 + .../inherit_workspace_package_table/mod.rs | 22 + .../inherit_workspace_package_table/out/Cargo.toml | 21 + .../out/crates/foo/Cargo.toml | 21 + .../out/crates/foo/src/main.rs | 3 + .../inherit_workspace_package_table/out/src/lib.rs | 14 + .../inherit_workspace_package_table/stderr.log | 1 + .../inherit_workspace_package_table/stdout.log | 0 .../testsuite/cargo_init/invalid_dir_name/mod.rs | 21 + .../cargo_init/invalid_dir_name/stderr.log | 8 + .../cargo_init/invalid_dir_name/stdout.log | 0 .../cargo_init/lib_already_exists_nosrc/in/lib.rs | 0 .../cargo_init/lib_already_exists_nosrc/mod.rs | 22 + .../lib_already_exists_nosrc/out/Cargo.toml | 12 + .../cargo_init/lib_already_exists_nosrc/out/lib.rs | 0 .../cargo_init/lib_already_exists_nosrc/stderr.log | 1 + .../cargo_init/lib_already_exists_nosrc/stdout.log | 0 .../lib_already_exists_src/in/src/lib.rs | 1 + .../cargo_init/lib_already_exists_src/mod.rs | 22 + .../lib_already_exists_src/out/Cargo.toml | 8 + .../lib_already_exists_src/out/src/lib.rs | 1 + .../cargo_init/lib_already_exists_src/stderr.log | 1 + .../cargo_init/lib_already_exists_src/stdout.log | 0 .../cargo_init/mercurial_autodetect/mod.rs | 22 + .../cargo_init/mercurial_autodetect/out/Cargo.toml | 8 + .../cargo_init/mercurial_autodetect/out/src/lib.rs | 14 + .../cargo_init/mercurial_autodetect/stderr.log | 1 + .../cargo_init/mercurial_autodetect/stdout.log | 0 src/tools/cargo/tests/testsuite/cargo_init/mod.rs | 44 ++ .../multibin_project_name_clash/in/case.rs | 1 + .../multibin_project_name_clash/in/main.rs | 1 + .../cargo_init/multibin_project_name_clash/mod.rs | 22 + .../multibin_project_name_clash/out/case.rs | 1 + .../multibin_project_name_clash/out/main.rs | 1 + .../multibin_project_name_clash/stderr.log | 4 + .../multibin_project_name_clash/stdout.log | 0 .../tests/testsuite/cargo_init/no_filename/mod.rs | 16 + .../testsuite/cargo_init/no_filename/stderr.log | 1 + .../testsuite/cargo_init/no_filename/stdout.log | 0 .../cargo_init/path_contains_separator/in/.keep | 0 .../cargo_init/path_contains_separator/mod.rs | 26 + .../path_contains_separator/out/Cargo.toml | 8 + .../path_contains_separator/out/src/main.rs | 3 + .../cargo_init/path_contains_separator/stderr.log | 3 + .../cargo_init/path_contains_separator/stdout.log | 0 .../cargo_init/pijul_autodetect/in/.pijul/.keep | 0 .../testsuite/cargo_init/pijul_autodetect/mod.rs | 22 + .../cargo_init/pijul_autodetect/out/.ignore | 2 + .../cargo_init/pijul_autodetect/out/Cargo.toml | 8 + .../cargo_init/pijul_autodetect/out/src/lib.rs | 14 + .../cargo_init/pijul_autodetect/stderr.log | 1 + .../cargo_init/pijul_autodetect/stdout.log | 0 .../testsuite/cargo_init/reserved_name/mod.rs | 21 + .../testsuite/cargo_init/reserved_name/stderr.log | 8 + .../testsuite/cargo_init/reserved_name/stdout.log | 0 .../cargo/tests/testsuite/cargo_init/simple_bin/in | 1 + .../tests/testsuite/cargo_init/simple_bin/mod.rs | 29 + .../testsuite/cargo_init/simple_bin/out/Cargo.toml | 8 + .../cargo_init/simple_bin/out/src/main.rs | 3 + .../testsuite/cargo_init/simple_bin/stderr.log | 1 + .../testsuite/cargo_init/simple_bin/stdout.log | 0 .../cargo/tests/testsuite/cargo_init/simple_git/in | 1 + .../tests/testsuite/cargo_init/simple_git/mod.rs | 22 + .../testsuite/cargo_init/simple_git/out/Cargo.toml | 8 + .../testsuite/cargo_init/simple_git/out/src/lib.rs | 14 + .../testsuite/cargo_init/simple_git/stderr.log | 1 + .../testsuite/cargo_init/simple_git/stdout.log | 0 .../cargo_init/simple_git_ignore_exists/mod.rs | 28 + .../simple_git_ignore_exists/out/Cargo.toml | 8 + .../simple_git_ignore_exists/out/src/lib.rs | 14 + .../cargo_init/simple_git_ignore_exists/stderr.log | 1 + .../cargo_init/simple_git_ignore_exists/stdout.log | 0 .../cargo/tests/testsuite/cargo_init/simple_hg/in | 1 + .../tests/testsuite/cargo_init/simple_hg/mod.rs | 22 + .../testsuite/cargo_init/simple_hg/out/Cargo.toml | 8 + .../testsuite/cargo_init/simple_hg/out/src/lib.rs | 14 + .../testsuite/cargo_init/simple_hg/stderr.log | 1 + .../testsuite/cargo_init/simple_hg/stdout.log | 0 .../cargo_init/simple_hg_ignore_exists/mod.rs | 22 + .../simple_hg_ignore_exists/out/Cargo.toml | 8 + .../simple_hg_ignore_exists/out/src/lib.rs | 14 + .../cargo_init/simple_hg_ignore_exists/stderr.log | 1 + .../cargo_init/simple_hg_ignore_exists/stdout.log | 0 .../cargo/tests/testsuite/cargo_init/simple_lib/in | 1 + .../tests/testsuite/cargo_init/simple_lib/mod.rs | 29 + .../testsuite/cargo_init/simple_lib/out/Cargo.toml | 8 + .../testsuite/cargo_init/simple_lib/out/src/lib.rs | 14 + .../testsuite/cargo_init/simple_lib/stderr.log | 1 + .../testsuite/cargo_init/simple_lib/stdout.log | 0 .../testsuite/cargo_init/unknown_flags/mod.rs | 15 + .../testsuite/cargo_init/unknown_flags/stderr.log | 7 + .../testsuite/cargo_init/unknown_flags/stdout.log | 0 .../cargo_init/with_argument/in/foo/.keep | 0 .../testsuite/cargo_init/with_argument/mod.rs | 21 + .../cargo_init/with_argument/out/foo/Cargo.toml | 8 + .../cargo_init/with_argument/out/foo/src/main.rs | 3 + .../testsuite/cargo_init/with_argument/stderr.log | 1 + .../testsuite/cargo_init/with_argument/stdout.log | 0 .../tests/testsuite/cargo_install/help/mod.rs | 13 + .../tests/testsuite/cargo_install/help/stderr.log | 0 .../tests/testsuite/cargo_install/help/stdout.log | 56 ++ .../cargo/tests/testsuite/cargo_install/mod.rs | 1 + .../testsuite/cargo_locate_project/help/mod.rs | 13 + .../testsuite/cargo_locate_project/help/stderr.log | 0 .../testsuite/cargo_locate_project/help/stdout.log | 22 + .../tests/testsuite/cargo_locate_project/mod.rs | 1 + .../cargo/tests/testsuite/cargo_login/help/mod.rs | 13 + .../tests/testsuite/cargo_login/help/stderr.log | 0 .../tests/testsuite/cargo_login/help/stdout.log | 23 + src/tools/cargo/tests/testsuite/cargo_login/mod.rs | 1 + .../cargo/tests/testsuite/cargo_logout/help/mod.rs | 13 + .../tests/testsuite/cargo_logout/help/stderr.log | 0 .../tests/testsuite/cargo_logout/help/stdout.log | 19 + .../cargo/tests/testsuite/cargo_logout/mod.rs | 1 + .../tests/testsuite/cargo_metadata/help/mod.rs | 13 + .../tests/testsuite/cargo_metadata/help/stderr.log | 0 .../tests/testsuite/cargo_metadata/help/stdout.log | 30 + .../cargo/tests/testsuite/cargo_metadata/mod.rs | 1 + .../cargo/tests/testsuite/cargo_new/help/mod.rs | 13 + .../tests/testsuite/cargo_new/help/stderr.log | 0 .../tests/testsuite/cargo_new/help/stdout.log | 31 + src/tools/cargo/tests/testsuite/cargo_new/mod.rs | 1 + .../cargo/tests/testsuite/cargo_owner/help/mod.rs | 13 + .../tests/testsuite/cargo_owner/help/stderr.log | 0 .../tests/testsuite/cargo_owner/help/stdout.log | 27 + src/tools/cargo/tests/testsuite/cargo_owner/mod.rs | 1 + .../tests/testsuite/cargo_package/help/mod.rs | 13 + .../tests/testsuite/cargo_package/help/stderr.log | 0 .../tests/testsuite/cargo_package/help/stdout.log | 39 ++ .../cargo/tests/testsuite/cargo_package/mod.rs | 1 + .../cargo/tests/testsuite/cargo_pkgid/help/mod.rs | 13 + .../tests/testsuite/cargo_pkgid/help/stderr.log | 0 .../tests/testsuite/cargo_pkgid/help/stdout.log | 25 + src/tools/cargo/tests/testsuite/cargo_pkgid/mod.rs | 1 + .../tests/testsuite/cargo_publish/help/mod.rs | 13 + .../tests/testsuite/cargo_publish/help/stderr.log | 0 .../tests/testsuite/cargo_publish/help/stdout.log | 39 ++ .../cargo/tests/testsuite/cargo_publish/mod.rs | 1 + .../testsuite/cargo_read_manifest/help/mod.rs | 13 + .../testsuite/cargo_read_manifest/help/stderr.log | 0 .../testsuite/cargo_read_manifest/help/stdout.log | 19 + .../tests/testsuite/cargo_read_manifest/mod.rs | 1 + .../cargo_remove/avoid_empty_tables/stderr.log | 1 - .../tests/testsuite/cargo_remove/build/stderr.log | 1 - .../tests/testsuite/cargo_remove/dev/stderr.log | 1 - .../cargo_remove/gc_keep_used_patch/in/Cargo.toml | 8 + .../gc_keep_used_patch/in/serde/Cargo.toml | 9 + .../gc_keep_used_patch/in/serde/src/lib.rs | 0 .../gc_keep_used_patch/in/serde_derive/Cargo.toml | 8 + .../gc_keep_used_patch/in/serde_derive/src/lib.rs | 0 .../cargo_remove/gc_keep_used_patch/mod.rs | 27 + .../cargo_remove/gc_keep_used_patch/out/Cargo.toml | 8 + .../gc_keep_used_patch/out/serde/Cargo.toml | 6 + .../gc_keep_used_patch/out/serde/src/lib.rs | 0 .../gc_keep_used_patch/out/serde_derive/Cargo.toml | 8 + .../gc_keep_used_patch/out/serde_derive/src/lib.rs | 0 .../cargo_remove/gc_keep_used_patch/stderr.log | 1 + .../cargo_remove/gc_keep_used_patch/stdout.log | 0 .../tests/testsuite/cargo_remove/gc_patch/mod.rs | 9 +- .../testsuite/cargo_remove/gc_patch/out/Cargo.lock | 19 + .../testsuite/cargo_remove/gc_patch/stderr.log | 2 - .../testsuite/cargo_remove/gc_profile/stderr.log | 1 - .../testsuite/cargo_remove/gc_replace/stderr.log | 1 - .../cargo/tests/testsuite/cargo_remove/help/mod.rs | 13 + .../tests/testsuite/cargo_remove/help/stderr.log | 0 .../tests/testsuite/cargo_remove/help/stdout.log | 29 + .../cargo/tests/testsuite/cargo_remove/mod.rs | 2 + .../cargo_remove/multiple_deps/stderr.log | 1 - .../testsuite/cargo_remove/multiple_dev/stderr.log | 1 - .../cargo_remove/optional_dep_feature/stderr.log | 1 - .../cargo_remove/optional_feature/stderr.log | 1 - .../testsuite/cargo_remove/package/stderr.log | 1 - .../testsuite/cargo_remove/remove_basic/stderr.log | 1 - .../tests/testsuite/cargo_remove/target/stderr.log | 1 - .../testsuite/cargo_remove/target_build/stderr.log | 1 - .../testsuite/cargo_remove/target_dev/stderr.log | 1 - .../cargo_remove/update_lock_file/stderr.log | 1 - .../testsuite/cargo_remove/workspace/stderr.log | 1 - .../cargo_remove/workspace_non_virtual/stderr.log | 1 - .../cargo_remove/workspace_preserved/stderr.log | 1 - .../cargo/tests/testsuite/cargo_report/help/mod.rs | 13 + .../tests/testsuite/cargo_report/help/stderr.log | 0 .../tests/testsuite/cargo_report/help/stdout.log | 20 + .../cargo/tests/testsuite/cargo_report/mod.rs | 1 + .../cargo/tests/testsuite/cargo_run/help/mod.rs | 13 + .../tests/testsuite/cargo_run/help/stderr.log | 0 .../tests/testsuite/cargo_run/help/stdout.log | 47 ++ src/tools/cargo/tests/testsuite/cargo_run/mod.rs | 1 + .../cargo/tests/testsuite/cargo_rustc/help/mod.rs | 13 + .../tests/testsuite/cargo_rustc/help/stderr.log | 0 .../tests/testsuite/cargo_rustc/help/stdout.log | 58 ++ src/tools/cargo/tests/testsuite/cargo_rustc/mod.rs | 1 + .../tests/testsuite/cargo_rustdoc/help/mod.rs | 13 + .../tests/testsuite/cargo_rustdoc/help/stderr.log | 0 .../tests/testsuite/cargo_rustdoc/help/stdout.log | 56 ++ .../cargo/tests/testsuite/cargo_rustdoc/mod.rs | 1 + .../cargo/tests/testsuite/cargo_search/help/mod.rs | 13 + .../tests/testsuite/cargo_search/help/stderr.log | 0 .../tests/testsuite/cargo_search/help/stdout.log | 24 + .../cargo/tests/testsuite/cargo_search/mod.rs | 1 + .../cargo/tests/testsuite/cargo_test/help/mod.rs | 13 + .../tests/testsuite/cargo_test/help/stderr.log | 0 .../tests/testsuite/cargo_test/help/stdout.log | 63 ++ src/tools/cargo/tests/testsuite/cargo_test/mod.rs | 1 + .../cargo/tests/testsuite/cargo_tree/help/mod.rs | 13 + .../tests/testsuite/cargo_tree/help/stderr.log | 0 .../tests/testsuite/cargo_tree/help/stdout.log | 45 ++ src/tools/cargo/tests/testsuite/cargo_tree/mod.rs | 1 + .../tests/testsuite/cargo_uninstall/help/mod.rs | 13 + .../testsuite/cargo_uninstall/help/stderr.log | 0 .../testsuite/cargo_uninstall/help/stdout.log | 28 + .../cargo/tests/testsuite/cargo_uninstall/mod.rs | 1 + .../cargo/tests/testsuite/cargo_update/help/mod.rs | 13 + .../tests/testsuite/cargo_update/help/stderr.log | 0 .../tests/testsuite/cargo_update/help/stdout.log | 26 + .../cargo/tests/testsuite/cargo_update/mod.rs | 1 + .../cargo/tests/testsuite/cargo_vendor/help/mod.rs | 13 + .../tests/testsuite/cargo_vendor/help/stderr.log | 0 .../tests/testsuite/cargo_vendor/help/stdout.log | 27 + .../cargo/tests/testsuite/cargo_vendor/mod.rs | 1 + .../testsuite/cargo_verify_project/help/mod.rs | 13 + .../testsuite/cargo_verify_project/help/stderr.log | 0 .../testsuite/cargo_verify_project/help/stdout.log | 19 + .../tests/testsuite/cargo_verify_project/mod.rs | 1 + .../tests/testsuite/cargo_version/help/mod.rs | 13 + .../tests/testsuite/cargo_version/help/stderr.log | 0 .../tests/testsuite/cargo_version/help/stdout.log | 18 + .../cargo/tests/testsuite/cargo_version/mod.rs | 1 + .../cargo/tests/testsuite/cargo_yank/help/mod.rs | 13 + .../tests/testsuite/cargo_yank/help/stderr.log | 0 .../tests/testsuite/cargo_yank/help/stdout.log | 26 + src/tools/cargo/tests/testsuite/cargo_yank/mod.rs | 1 + .../cargo/tests/testsuite/credential_process.rs | 640 +++++++++++++-------- src/tools/cargo/tests/testsuite/freshness.rs | 62 +- src/tools/cargo/tests/testsuite/init/auto_git/in | 1 - .../cargo/tests/testsuite/init/auto_git/mod.rs | 22 - .../tests/testsuite/init/auto_git/out/Cargo.toml | 8 - .../tests/testsuite/init/auto_git/out/src/lib.rs | 14 - .../cargo/tests/testsuite/init/auto_git/stderr.log | 1 - .../cargo/tests/testsuite/init/auto_git/stdout.log | 0 .../bin_already_exists_explicit/in/src/main.rs | 4 - .../init/bin_already_exists_explicit/mod.rs | 21 - .../bin_already_exists_explicit/out/Cargo.toml | 8 - .../bin_already_exists_explicit/out/src/main.rs | 4 - .../init/bin_already_exists_explicit/stderr.log | 1 - .../init/bin_already_exists_explicit/stdout.log | 0 .../bin_already_exists_explicit_nosrc/in/main.rs | 4 - .../init/bin_already_exists_explicit_nosrc/mod.rs | 22 - .../out/Cargo.toml | 12 - .../bin_already_exists_explicit_nosrc/out/main.rs | 4 - .../bin_already_exists_explicit_nosrc/stderr.log | 1 - .../bin_already_exists_explicit_nosrc/stdout.log | 0 .../bin_already_exists_implicit/in/src/main.rs | 4 - .../init/bin_already_exists_implicit/mod.rs | 21 - .../bin_already_exists_implicit/out/Cargo.toml | 8 - .../bin_already_exists_implicit/out/src/main.rs | 4 - .../init/bin_already_exists_implicit/stderr.log | 1 - .../init/bin_already_exists_implicit/stdout.log | 0 .../in/case.rs | 4 - .../bin_already_exists_implicit_namenosrc/mod.rs | 22 - .../out/Cargo.toml | 12 - .../out/case.rs | 4 - .../stderr.log | 1 - .../stdout.log | 0 .../in/src/case.rs | 4 - .../bin_already_exists_implicit_namesrc/mod.rs | 22 - .../out/Cargo.toml | 12 - .../out/src/case.rs | 4 - .../bin_already_exists_implicit_namesrc/stderr.log | 1 - .../bin_already_exists_implicit_namesrc/stdout.log | 0 .../bin_already_exists_implicit_nosrc/in/main.rs | 4 - .../init/bin_already_exists_implicit_nosrc/mod.rs | 22 - .../out/Cargo.toml | 12 - .../bin_already_exists_implicit_nosrc/out/main.rs | 4 - .../bin_already_exists_implicit_nosrc/stderr.log | 1 - .../bin_already_exists_implicit_nosrc/stdout.log | 0 .../tests/testsuite/init/both_lib_and_bin/mod.rs | 19 - .../testsuite/init/both_lib_and_bin/stderr.log | 1 - .../testsuite/init/both_lib_and_bin/stdout.log | 0 .../in/case.rs | 1 - .../in/lib.rs | 1 - .../mod.rs | 18 - .../stderr.log | 1 - .../stdout.log | 0 .../init/confused_by_multiple_lib_files/in/lib.rs | 1 - .../confused_by_multiple_lib_files/in/src/lib.rs | 1 - .../init/confused_by_multiple_lib_files/mod.rs | 22 - .../init/confused_by_multiple_lib_files/out/lib.rs | 1 - .../confused_by_multiple_lib_files/out/src/lib.rs | 1 - .../init/confused_by_multiple_lib_files/stderr.log | 1 - .../init/confused_by_multiple_lib_files/stdout.log | 0 .../in/case.rs | 1 - .../in/lib.rs | 1 - .../creates_binary_when_both_binlib_present/mod.rs | 21 - .../out/Cargo.toml | 16 - .../out/case.rs | 1 - .../out/lib.rs | 1 - .../stderr.log | 1 - .../stdout.log | 0 .../in/case.rs | 1 - .../mod.rs | 21 - .../out/Cargo.toml | 12 - .../out/case.rs | 1 - .../stderr.log | 2 - .../stdout.log | 0 .../in/case.rs | 1 - .../mod.rs | 21 - .../out/Cargo.toml | 12 - .../out/case.rs | 1 - .../stderr.log | 2 - .../stdout.log | 0 .../cargo/tests/testsuite/init/empty_dir/.keep | 0 .../cargo/tests/testsuite/init/empty_dir/mod.rs | 7 - .../tests/testsuite/init/explicit_bin_with_git/in | 1 - .../testsuite/init/explicit_bin_with_git/mod.rs | 21 - .../init/explicit_bin_with_git/out/Cargo.toml | 8 - .../init/explicit_bin_with_git/out/src/main.rs | 3 - .../init/explicit_bin_with_git/stderr.log | 1 - .../init/explicit_bin_with_git/stdout.log | 0 .../testsuite/init/formats_source/in/rustfmt.toml | 1 - .../tests/testsuite/init/formats_source/mod.rs | 29 - .../testsuite/init/formats_source/out/Cargo.toml | 8 - .../testsuite/init/formats_source/out/rustfmt.toml | 1 - .../testsuite/init/formats_source/out/src/lib.rs | 14 - .../tests/testsuite/init/formats_source/stderr.log | 1 - .../tests/testsuite/init/formats_source/stdout.log | 0 .../init/fossil_autodetect/in/.fossil/.keep | 0 .../tests/testsuite/init/fossil_autodetect/mod.rs | 22 - .../out/.fossil-settings/clean-glob | 2 - .../out/.fossil-settings/ignore-glob | 2 - .../init/fossil_autodetect/out/Cargo.toml | 8 - .../init/fossil_autodetect/out/src/lib.rs | 14 - .../testsuite/init/fossil_autodetect/stderr.log | 1 - .../testsuite/init/fossil_autodetect/stdout.log | 0 .../tests/testsuite/init/git_autodetect/mod.rs | 24 - .../testsuite/init/git_autodetect/out/Cargo.toml | 8 - .../testsuite/init/git_autodetect/out/src/lib.rs | 14 - .../tests/testsuite/init/git_autodetect/stderr.log | 1 - .../tests/testsuite/init/git_autodetect/stdout.log | 0 .../mod.rs | 22 - .../out/Cargo.toml | 8 - .../out/src/lib.rs | 14 - .../stderr.log | 1 - .../stdout.log | 0 .../in/rustfmt.toml | 1 - .../init/ignores_failure_to_format_source/mod.rs | 22 - .../out/Cargo.toml | 8 - .../out/rustfmt.toml | 1 - .../out/src/lib.rs | 14 - .../ignores_failure_to_format_source/stderr.log | 1 - .../ignores_failure_to_format_source/stdout.log | 0 .../init/inferred_bin_with_git/in/main.rs | 1 - .../testsuite/init/inferred_bin_with_git/mod.rs | 21 - .../init/inferred_bin_with_git/out/Cargo.toml | 12 - .../init/inferred_bin_with_git/out/main.rs | 1 - .../init/inferred_bin_with_git/stderr.log | 1 - .../init/inferred_bin_with_git/stdout.log | 0 .../testsuite/init/inferred_lib_with_git/in/lib.rs | 1 - .../testsuite/init/inferred_lib_with_git/mod.rs | 21 - .../init/inferred_lib_with_git/out/Cargo.toml | 12 - .../init/inferred_lib_with_git/out/lib.rs | 1 - .../init/inferred_lib_with_git/stderr.log | 1 - .../init/inferred_lib_with_git/stdout.log | 0 .../inherit_workspace_package_table/in/Cargo.toml | 21 - .../inherit_workspace_package_table/in/README.md | 0 .../in/crates/foo/src/main.rs | 3 - .../inherit_workspace_package_table/in/src/lib.rs | 14 - .../init/inherit_workspace_package_table/mod.rs | 22 - .../inherit_workspace_package_table/out/Cargo.toml | 21 - .../out/crates/foo/Cargo.toml | 21 - .../out/crates/foo/src/main.rs | 3 - .../inherit_workspace_package_table/out/src/lib.rs | 14 - .../inherit_workspace_package_table/stderr.log | 1 - .../inherit_workspace_package_table/stdout.log | 0 .../tests/testsuite/init/invalid_dir_name/mod.rs | 21 - .../testsuite/init/invalid_dir_name/stderr.log | 8 - .../testsuite/init/invalid_dir_name/stdout.log | 0 .../init/lib_already_exists_nosrc/in/lib.rs | 0 .../testsuite/init/lib_already_exists_nosrc/mod.rs | 22 - .../init/lib_already_exists_nosrc/out/Cargo.toml | 12 - .../init/lib_already_exists_nosrc/out/lib.rs | 0 .../init/lib_already_exists_nosrc/stderr.log | 1 - .../init/lib_already_exists_nosrc/stdout.log | 0 .../init/lib_already_exists_src/in/src/lib.rs | 1 - .../testsuite/init/lib_already_exists_src/mod.rs | 22 - .../init/lib_already_exists_src/out/Cargo.toml | 8 - .../init/lib_already_exists_src/out/src/lib.rs | 1 - .../init/lib_already_exists_src/stderr.log | 1 - .../init/lib_already_exists_src/stdout.log | 0 .../testsuite/init/mercurial_autodetect/mod.rs | 22 - .../init/mercurial_autodetect/out/Cargo.toml | 8 - .../init/mercurial_autodetect/out/src/lib.rs | 14 - .../testsuite/init/mercurial_autodetect/stderr.log | 1 - .../testsuite/init/mercurial_autodetect/stdout.log | 0 src/tools/cargo/tests/testsuite/init/mod.rs | 43 -- .../init/multibin_project_name_clash/in/case.rs | 1 - .../init/multibin_project_name_clash/in/main.rs | 1 - .../init/multibin_project_name_clash/mod.rs | 22 - .../init/multibin_project_name_clash/out/case.rs | 1 - .../init/multibin_project_name_clash/out/main.rs | 1 - .../init/multibin_project_name_clash/stderr.log | 4 - .../init/multibin_project_name_clash/stdout.log | 0 .../cargo/tests/testsuite/init/no_filename/mod.rs | 16 - .../tests/testsuite/init/no_filename/stderr.log | 1 - .../tests/testsuite/init/no_filename/stdout.log | 0 .../init/path_contains_separator/in/.keep | 0 .../testsuite/init/path_contains_separator/mod.rs | 26 - .../init/path_contains_separator/out/Cargo.toml | 8 - .../init/path_contains_separator/out/src/main.rs | 3 - .../init/path_contains_separator/stderr.log | 3 - .../init/path_contains_separator/stdout.log | 0 .../init/pijul_autodetect/in/.pijul/.keep | 0 .../tests/testsuite/init/pijul_autodetect/mod.rs | 22 - .../testsuite/init/pijul_autodetect/out/.ignore | 2 - .../testsuite/init/pijul_autodetect/out/Cargo.toml | 8 - .../testsuite/init/pijul_autodetect/out/src/lib.rs | 14 - .../testsuite/init/pijul_autodetect/stderr.log | 1 - .../testsuite/init/pijul_autodetect/stdout.log | 0 .../tests/testsuite/init/reserved_name/mod.rs | 21 - .../tests/testsuite/init/reserved_name/stderr.log | 8 - .../tests/testsuite/init/reserved_name/stdout.log | 0 src/tools/cargo/tests/testsuite/init/simple_bin/in | 1 - .../cargo/tests/testsuite/init/simple_bin/mod.rs | 29 - .../tests/testsuite/init/simple_bin/out/Cargo.toml | 8 - .../testsuite/init/simple_bin/out/src/main.rs | 3 - .../tests/testsuite/init/simple_bin/stderr.log | 1 - .../tests/testsuite/init/simple_bin/stdout.log | 0 src/tools/cargo/tests/testsuite/init/simple_git/in | 1 - .../cargo/tests/testsuite/init/simple_git/mod.rs | 22 - .../tests/testsuite/init/simple_git/out/Cargo.toml | 8 - .../tests/testsuite/init/simple_git/out/src/lib.rs | 14 - .../tests/testsuite/init/simple_git/stderr.log | 1 - .../tests/testsuite/init/simple_git/stdout.log | 0 .../testsuite/init/simple_git_ignore_exists/mod.rs | 28 - .../init/simple_git_ignore_exists/out/Cargo.toml | 8 - .../init/simple_git_ignore_exists/out/src/lib.rs | 14 - .../init/simple_git_ignore_exists/stderr.log | 1 - .../init/simple_git_ignore_exists/stdout.log | 0 src/tools/cargo/tests/testsuite/init/simple_hg/in | 1 - .../cargo/tests/testsuite/init/simple_hg/mod.rs | 22 - .../tests/testsuite/init/simple_hg/out/Cargo.toml | 8 - .../tests/testsuite/init/simple_hg/out/src/lib.rs | 14 - .../tests/testsuite/init/simple_hg/stderr.log | 1 - .../tests/testsuite/init/simple_hg/stdout.log | 0 .../testsuite/init/simple_hg_ignore_exists/mod.rs | 22 - .../init/simple_hg_ignore_exists/out/Cargo.toml | 8 - .../init/simple_hg_ignore_exists/out/src/lib.rs | 14 - .../init/simple_hg_ignore_exists/stderr.log | 1 - .../init/simple_hg_ignore_exists/stdout.log | 0 src/tools/cargo/tests/testsuite/init/simple_lib/in | 1 - .../cargo/tests/testsuite/init/simple_lib/mod.rs | 29 - .../tests/testsuite/init/simple_lib/out/Cargo.toml | 8 - .../tests/testsuite/init/simple_lib/out/src/lib.rs | 14 - .../tests/testsuite/init/simple_lib/stderr.log | 1 - .../tests/testsuite/init/simple_lib/stdout.log | 0 .../tests/testsuite/init/unknown_flags/mod.rs | 15 - .../tests/testsuite/init/unknown_flags/stderr.log | 7 - .../tests/testsuite/init/unknown_flags/stdout.log | 0 .../testsuite/init/with_argument/in/foo/.keep | 0 .../tests/testsuite/init/with_argument/mod.rs | 21 - .../init/with_argument/out/foo/Cargo.toml | 8 - .../init/with_argument/out/foo/src/main.rs | 3 - .../tests/testsuite/init/with_argument/stderr.log | 1 - .../tests/testsuite/init/with_argument/stdout.log | 0 src/tools/cargo/tests/testsuite/lints.rs | 55 ++ src/tools/cargo/tests/testsuite/lockfile_compat.rs | 195 +++++++ src/tools/cargo/tests/testsuite/login.rs | 188 +++--- src/tools/cargo/tests/testsuite/main.rs | 36 +- src/tools/cargo/tests/testsuite/owner.rs | 8 +- src/tools/cargo/tests/testsuite/package.rs | 112 ++++ src/tools/cargo/tests/testsuite/profile_targets.rs | 8 +- src/tools/cargo/tests/testsuite/publish.rs | 10 +- src/tools/cargo/tests/testsuite/registry.rs | 35 ++ src/tools/cargo/tests/testsuite/registry_auth.rs | 96 +--- src/tools/cargo/tests/testsuite/run.rs | 22 +- src/tools/cargo/tests/testsuite/script.rs | 158 ++++- src/tools/cargo/tests/testsuite/test.rs | 71 ++- src/tools/cargo/tests/testsuite/update.rs | 40 ++ src/tools/cargo/tests/testsuite/yank.rs | 8 +- 671 files changed, 5579 insertions(+), 2697 deletions(-) create mode 100644 src/tools/cargo/tests/testsuite/cargo/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_bench/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_bench/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_bench/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_bench/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_build/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_build/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_build/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_build/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_check/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_check/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_check/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_check/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_clean/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_clean/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_clean/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_clean/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/cargo_config.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_config/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_config/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_config/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_config/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_doc/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_doc/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_doc/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_doc/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_fetch/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_fetch/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_fetch/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_fetch/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_fix/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_fix/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_fix/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_fix/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_generate_lockfile/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_git_checkout/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_git_checkout/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_git_checkout/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_git_checkout/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_help/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_help/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_help/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_help/mod.rs create mode 120000 src/tools/cargo/tests/testsuite/cargo_init/auto_git/in create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/auto_git/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/auto_git/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/auto_git/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/auto_git/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/auto_git/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/in/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/out/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/in/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/out/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/in/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/out/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/in/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/out/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/in/src/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/out/src/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/in/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/out/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/in/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/in/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/in/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/in/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/out/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/in/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/in/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/in/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/out/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/in/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/out/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/empty_dir/.keep create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/empty_dir/mod.rs create mode 120000 src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/in create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/out/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/formats_source/in/rustfmt.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/formats_source/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/rustfmt.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/formats_source/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/formats_source/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/in/.fossil/.keep create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/.fossil-settings/clean-glob create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/.fossil-settings/ignore-glob create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/in/rustfmt.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/rustfmt.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/in/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/out/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/in/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/out/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/README.md create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/crates/foo/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/crates/foo/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/crates/foo/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/in/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/out/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/in/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/in/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/in/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/out/case.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/out/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/no_filename/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/no_filename/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/no_filename/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/in/.keep create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/out/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/in/.pijul/.keep create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/.ignore create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/reserved_name/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/reserved_name/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/reserved_name/stdout.log create mode 120000 src/tools/cargo/tests/testsuite/cargo_init/simple_bin/in create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_bin/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_bin/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_bin/out/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_bin/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_bin/stdout.log create mode 120000 src/tools/cargo/tests/testsuite/cargo_init/simple_git/in create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/stdout.log create mode 120000 src/tools/cargo/tests/testsuite/cargo_init/simple_hg/in create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/stdout.log create mode 120000 src/tools/cargo/tests/testsuite/cargo_init/simple_lib/in create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_lib/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_lib/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_lib/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_lib/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/simple_lib/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/with_argument/in/foo/.keep create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/with_argument/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/with_argument/out/foo/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/with_argument/out/foo/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/with_argument/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_init/with_argument/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_install/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_install/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_install/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_install/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_locate_project/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_locate_project/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_locate_project/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_locate_project/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_login/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_login/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_login/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_login/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_logout/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_logout/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_logout/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_logout/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_metadata/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_metadata/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_metadata/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_metadata/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_owner/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_owner/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_owner/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_owner/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_package/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_package/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_package/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_package/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_pkgid/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_pkgid/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_pkgid/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_pkgid/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_publish/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_publish/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_publish/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_publish/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_read_manifest/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_read_manifest/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_read_manifest/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_read_manifest/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde_derive/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde_derive/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde_derive/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde_derive/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/out/Cargo.lock create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_remove/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_report/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_report/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_report/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_report/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_run/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_run/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_run/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_run/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_rustc/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_rustc/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_rustc/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_rustc/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_rustdoc/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_rustdoc/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_rustdoc/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_rustdoc/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_search/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_search/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_search/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_search/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_test/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_test/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_test/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_test/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_tree/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_tree/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_tree/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_tree/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_uninstall/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_uninstall/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_uninstall/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_uninstall/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_update/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_update/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_update/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_update/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_vendor/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_vendor/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_vendor/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_vendor/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_verify_project/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_verify_project/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_verify_project/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_verify_project/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_version/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_version/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_version/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_version/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_yank/help/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_yank/help/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_yank/help/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_yank/mod.rs delete mode 120000 src/tools/cargo/tests/testsuite/init/auto_git/in delete mode 100644 src/tools/cargo/tests/testsuite/init/auto_git/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/auto_git/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/auto_git/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/auto_git/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/auto_git/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/in/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/out/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/in/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/in/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/out/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/in/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/in/src/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/src/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/in/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/both_lib_and_bin/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/both_lib_and_bin/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/both_lib_and_bin/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/in/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/in/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/out/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/in/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/in/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/in/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/empty_dir/.keep delete mode 100644 src/tools/cargo/tests/testsuite/init/empty_dir/mod.rs delete mode 120000 src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/in delete mode 100644 src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/out/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/formats_source/in/rustfmt.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/formats_source/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/formats_source/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/formats_source/out/rustfmt.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/formats_source/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/formats_source/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/formats_source/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/fossil_autodetect/in/.fossil/.keep delete mode 100644 src/tools/cargo/tests/testsuite/init/fossil_autodetect/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/clean-glob delete mode 100644 src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/ignore-glob delete mode 100644 src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/fossil_autodetect/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/fossil_autodetect/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/git_autodetect/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/git_autodetect/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/git_autodetect/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/git_autodetect/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/git_autodetect/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/in/rustfmt.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/rustfmt.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/in/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/out/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/in/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/out/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/README.md delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/crates/foo/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/invalid_dir_name/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/invalid_dir_name/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/invalid_dir_name/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/in/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/out/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_src/in/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_src/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_src/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_src/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_src/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/lib_already_exists_src/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/mercurial_autodetect/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/mercurial_autodetect/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/mercurial_autodetect/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/mercurial_autodetect/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/mercurial_autodetect/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/in/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/in/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/out/case.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/out/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/no_filename/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/no_filename/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/no_filename/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/path_contains_separator/in/.keep delete mode 100644 src/tools/cargo/tests/testsuite/init/path_contains_separator/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/path_contains_separator/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/path_contains_separator/out/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/path_contains_separator/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/path_contains_separator/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/pijul_autodetect/in/.pijul/.keep delete mode 100644 src/tools/cargo/tests/testsuite/init/pijul_autodetect/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/.ignore delete mode 100644 src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/pijul_autodetect/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/pijul_autodetect/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/reserved_name/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/reserved_name/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/reserved_name/stdout.log delete mode 120000 src/tools/cargo/tests/testsuite/init/simple_bin/in delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_bin/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_bin/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_bin/out/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_bin/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_bin/stdout.log delete mode 120000 src/tools/cargo/tests/testsuite/init/simple_git/in delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/stdout.log delete mode 120000 src/tools/cargo/tests/testsuite/init/simple_hg/in delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/stdout.log delete mode 120000 src/tools/cargo/tests/testsuite/init/simple_lib/in delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_lib/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_lib/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_lib/out/src/lib.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_lib/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/simple_lib/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/unknown_flags/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/unknown_flags/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/unknown_flags/stdout.log delete mode 100644 src/tools/cargo/tests/testsuite/init/with_argument/in/foo/.keep delete mode 100644 src/tools/cargo/tests/testsuite/init/with_argument/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/with_argument/out/foo/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/init/with_argument/out/foo/src/main.rs delete mode 100644 src/tools/cargo/tests/testsuite/init/with_argument/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/init/with_argument/stdout.log (limited to 'src/tools/cargo/tests') diff --git a/src/tools/cargo/tests/testsuite/alt_registry.rs b/src/tools/cargo/tests/testsuite/alt_registry.rs index ac60ca92f..91157cd53 100644 --- a/src/tools/cargo/tests/testsuite/alt_registry.rs +++ b/src/tools/cargo/tests/testsuite/alt_registry.rs @@ -1506,3 +1506,44 @@ fn publish_with_transitive_dep() { .build(); p2.cargo("publish").run(); } + +#[cargo_test] +fn warn_for_unused_fields() { + let _ = RegistryBuilder::new() + .no_configure_token() + .alternative() + .build(); + let p = project() + .file("src/lib.rs", "") + .file( + ".cargo/config.toml", + "[registry] + unexpected-field = 'foo' + [registries.alternative] + unexpected-field = 'foo' + ", + ) + .build(); + + p.cargo("publish --registry alternative") + .with_status(101) + .with_stderr( + "\ +[UPDATING] `alternative` index +[WARNING] unused config key `registries.alternative.unexpected-field` in `[..]config.toml` +[ERROR] no token found for `alternative`, please run `cargo login --registry alternative` +or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN", + ) + .run(); + + p.cargo("publish --registry crates-io") + .with_status(101) + .with_stderr( + "\ +[UPDATING] crates.io index +[WARNING] unused config key `registry.unexpected-field` in `[..]config.toml` +[ERROR] no token found, please run `cargo login` +or use environment variable CARGO_REGISTRY_TOKEN", + ) + .run(); +} diff --git a/src/tools/cargo/tests/testsuite/bench.rs b/src/tools/cargo/tests/testsuite/bench.rs index 581acbe15..d773308c6 100644 --- a/src/tools/cargo/tests/testsuite/bench.rs +++ b/src/tools/cargo/tests/testsuite/bench.rs @@ -314,9 +314,9 @@ fn cargo_bench_failing_test() { [RUNNING] [..] (target/release/deps/foo-[..][EXE])", ) .with_stdout_contains("[..]thread '[..]' panicked at[..]") - .with_stdout_contains("[..]assertion failed[..]") - .with_stdout_contains("[..]left: `\"hello\"`[..]") - .with_stdout_contains("[..]right: `\"nope\"`[..]") + .with_stdout_contains("[..]assertion [..]failed[..]") + .with_stdout_contains("[..]left: [..]\"hello\"[..]") + .with_stdout_contains("[..]right: [..]\"nope\"[..]") .with_stdout_contains("[..]src/main.rs:15[..]") .with_status(101) .run(); @@ -1670,3 +1670,58 @@ fn json_artifact_includes_executable_for_benchmark() { ) .run(); } + +#[cargo_test] +fn cargo_bench_no_keep_going() { + let p = project() + .file("Cargo.toml", &basic_bin_manifest("foo")) + .file("src/main.rs", "") + .build(); + + p.cargo("bench --keep-going") + .with_stderr( + "\ +error: unexpected argument `--keep-going` found + + tip: to run as many benchmarks as possible without failing fast, use `--no-fail-fast`", + ) + .with_status(101) + .run(); +} + +#[cargo_test(nightly, reason = "bench")] +fn cargo_bench_print_env_verbose() { + let p = project() + .file("Cargo.toml", &basic_manifest("foo", "0.0.1")) + .file( + "src/main.rs", + r#" + #![feature(test)] + #[cfg(test)] + extern crate test; + + fn hello() -> &'static str { + "hello" + } + + pub fn main() { + println!("{}", hello()) + } + + #[bench] + fn bench_hello(_b: &mut test::Bencher) { + assert_eq!(hello(), "hello") + } + "#, + ) + .build(); + p.cargo("bench -vv") + .with_stderr( + "\ +[COMPILING] foo v0.0.1 ([CWD]) +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] rustc[..]` +[FINISHED] bench [optimized] target(s) in [..] +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] [CWD]/target/release/deps/foo-[..][EXE] --bench`", + ) + .run(); +} diff --git a/src/tools/cargo/tests/testsuite/build_script.rs b/src/tools/cargo/tests/testsuite/build_script.rs index 4840356c6..400d10547 100644 --- a/src/tools/cargo/tests/testsuite/build_script.rs +++ b/src/tools/cargo/tests/testsuite/build_script.rs @@ -5140,6 +5140,35 @@ for more information about build script outputs. .run(); } +#[cargo_test] +fn wrong_syntax_with_two_colons() { + let p = project() + .file("src/lib.rs", "") + .file( + "build.rs", + r#" + fn main() { + println!("cargo::foo=bar"); + } + "#, + ) + .build(); + + p.cargo("build") + .with_status(101) + .with_stderr( + "\ +[COMPILING] foo [..] +error: unsupported output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::foo=bar` +Found a `cargo::key=value` build directive which is reserved for future use. +Either change the directive to `cargo:key=value` syntax (note the single `:`) or upgrade your version of Rust. +See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \ +for more information about build script outputs. +", + ) + .run(); +} + #[cargo_test] fn custom_build_closes_stdin() { // Ensure stdin is closed to prevent deadlock. diff --git a/src/tools/cargo/tests/testsuite/build_script_env.rs b/src/tools/cargo/tests/testsuite/build_script_env.rs index bc87b7120..df574600c 100644 --- a/src/tools/cargo/tests/testsuite/build_script_env.rs +++ b/src/tools/cargo/tests/testsuite/build_script_env.rs @@ -117,7 +117,10 @@ fn rustc_bootstrap() { "#; let p = project() .file("Cargo.toml", &basic_manifest("has-dashes", "0.0.1")) - .file("src/lib.rs", "#![feature(rustc_attrs)]") + .file( + "src/lib.rs", + "#![allow(internal_features)] #![feature(rustc_attrs)]", + ) .file("build.rs", build_rs) .build(); // RUSTC_BOOTSTRAP unset on stable should error @@ -154,7 +157,10 @@ fn rustc_bootstrap() { // Tests for binaries instead of libraries let p = project() .file("Cargo.toml", &basic_manifest("foo", "0.0.1")) - .file("src/main.rs", "#![feature(rustc_attrs)] fn main() {}") + .file( + "src/main.rs", + "#![allow(internal_features)] #![feature(rustc_attrs)] fn main() {}", + ) .file("build.rs", build_rs) .build(); // nightly should warn when there's no library whether or not RUSTC_BOOTSTRAP is set diff --git a/src/tools/cargo/tests/testsuite/cargo/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo/help/mod.rs new file mode 100644 index 000000000..559377b27 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo/help/mod.rs @@ -0,0 +1,12 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo/help/stdout.log new file mode 100644 index 000000000..26bcd745b --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo/help/stdout.log @@ -0,0 +1,39 @@ +Rust's package manager + +Usage: cargo [..][OPTIONS] [COMMAND] + cargo [..][OPTIONS] -Zscript [ARGS]... + +Options: + -V, --version Print version info and exit + --list List installed commands + --explain Run `rustc --explain CODE` + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + -q, --quiet Do not print cargo log messages + --color Coloring: auto, always, never + -C Change to DIRECTORY before doing anything (nightly-only) + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Some common cargo commands are (see all commands with --list): + build, b Compile the current package + check, c Analyze the current package and report errors, but don't build object files + clean Remove the target directory + doc, d Build this package's and its dependencies' documentation + new Create a new cargo package + init Create a new cargo package in an existing directory + add Add dependencies to a manifest file + remove Remove dependencies from a manifest file + run, r Run a binary or example of the local package + test, t Run the tests + bench Run the benchmarks + update Update dependencies listed in Cargo.lock + search Search registry for crates + publish Package and upload this package to the registry + install Install a Rust binary. Default location is $HOME/.cargo/bin + uninstall Uninstall a Rust binary + +See 'cargo help ' for more information on a specific command. diff --git a/src/tools/cargo/tests/testsuite/cargo/mod.rs b/src/tools/cargo/tests/testsuite/cargo/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_add/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_add/help/mod.rs new file mode 100644 index 000000000..0962047f8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("add") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_add/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_add/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_add/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_add/help/stdout.log new file mode 100644 index 000000000..0daba1a94 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_add/help/stdout.log @@ -0,0 +1,124 @@ +Add dependencies to a Cargo.toml manifest file + +Usage: cargo add [OPTIONS] [@] ... + cargo add [OPTIONS] --path ... + cargo add [OPTIONS] --git ... + +Arguments: + [DEP_ID]... + Reference to a package to add as a dependency + + You can reference a package by: + - ``, like `cargo add serde` (latest version will be used) + - `@`, like `cargo add serde@1` or `cargo add serde@=1.0.38` + +Options: + --no-default-features + Disable the default features + + --default-features + Re-enable the default features + + -F, --features + Space or comma separated list of features to activate + + --optional + Mark the dependency as optional + + The package name will be exposed as feature of your crate. + + --no-optional + Mark the dependency as required + + The package will be removed from your features. + + --rename + Rename the dependency + + Example uses: + - Depending on multiple versions of a crate + - Depend on crates with the same name from different registries + + --ignore-rust-version + Ignore `rust-version` specification in packages (unstable) + + --dry-run + Don't actually write the manifest + + -q, --quiet + Do not print cargo log messages + + -v, --verbose... + Use verbose output (-vv very verbose/build.rs output) + + --color + Coloring: auto, always, never + + --config + Override a configuration value + + -Z + Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + + -h, --help + Print help (see a summary with '-h') + +Manifest Options: + --manifest-path + Path to Cargo.toml + + --frozen + Require Cargo.lock and cache are up to date + + --locked + Require Cargo.lock is up to date + + --offline + Run without accessing the network + +Package Selection: + -p, --package [] + Package to modify + +Source: + --path + Filesystem path to local crate to add + + --git + Git repository location + + Without any other information, cargo will use latest commit on the main branch. + + --branch + Git branch to download the crate from + + --tag + Git tag to download the crate from + + --rev + Git reference to download the crate from + + This is the catch all, handling hashes to named references in remote repositories. + + --registry + Package registry for this dependency + +Section: + --dev + Add as development dependency + + Dev-dependencies are not used when compiling a package for building, but are used for + compiling tests, examples, and benchmarks. + + These dependencies are not propagated to other packages which depend on this package. + + --build + Add as build dependency + + Build-dependencies are the only dependencies available for use by build scripts + (`build.rs` files). + + --target + Add as dependency to the given target platform + +Run `cargo help add` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_add/mod.rs b/src/tools/cargo/tests/testsuite/cargo_add/mod.rs index be7a1546b..de93afbc1 100644 --- a/src/tools/cargo/tests/testsuite/cargo_add/mod.rs +++ b/src/tools/cargo/tests/testsuite/cargo_add/mod.rs @@ -35,6 +35,7 @@ mod git_normalized_name; mod git_registry; mod git_rev; mod git_tag; +mod help; mod infer_prerelease; mod invalid_arg; mod invalid_git_name; diff --git a/src/tools/cargo/tests/testsuite/cargo_bench/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_bench/help/mod.rs new file mode 100644 index 000000000..9338664e5 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_bench/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("bench") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_bench/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_bench/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_bench/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_bench/help/stdout.log new file mode 100644 index 000000000..5d9484df9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_bench/help/stdout.log @@ -0,0 +1,59 @@ +Execute all benchmarks of a local package + +Usage: cargo[EXE] bench [OPTIONS] [BENCHNAME] [-- [args]...] + +Arguments: + [BENCHNAME] If specified, only run benches containing this string in their names + [args]... Arguments for the bench binary + +Options: + --no-run Compile, but don't run benchmarks + --no-fail-fast Run all benchmarks regardless of failure + --ignore-rust-version Ignore `rust-version` specification in packages + --message-format Error format + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package to run benchmarks for + --workspace Benchmark all packages in the workspace + --exclude Exclude packages from the benchmark + --all Alias for --workspace (deprecated) + +Target Selection: + --lib Benchmark only this package's library + --bins Benchmark all binaries + --bin [] Benchmark only the specified binary + --examples Benchmark all examples + --example [] Benchmark only the specified example + --tests Benchmark all tests + --test [] Benchmark only the specified test target + --benches Benchmark all benches + --bench [] Benchmark only the specified bench target + --all-targets Benchmark all targets + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --profile Build artifacts with the specified profile + --target Build for the target triple + --target-dir Directory for all generated artifacts + --unit-graph Output build graph in JSON (unstable) + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help bench` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_bench/mod.rs b/src/tools/cargo/tests/testsuite/cargo_bench/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_bench/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_build/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_build/help/mod.rs new file mode 100644 index 000000000..9ca23b478 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_build/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("build") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_build/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_build/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_build/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_build/help/stdout.log new file mode 100644 index 000000000..af906c24f --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_build/help/stdout.log @@ -0,0 +1,58 @@ +Compile a local package and all of its dependencies + +Usage: cargo[EXE] build [OPTIONS] + +Options: + --ignore-rust-version Ignore `rust-version` specification in packages + --future-incompat-report Outputs a future incompatibility report at the end of the build + --message-format Error format + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package to build (see `cargo help pkgid`) + --workspace Build all packages in the workspace + --exclude Exclude packages from the build + --all Alias for --workspace (deprecated) + +Target Selection: + --lib Build only this package's library + --bins Build all binaries + --bin [] Build only the specified binary + --examples Build all examples + --example [] Build only the specified example + --tests Build all tests + --test [] Build only the specified test target + --benches Build all benches + --bench [] Build only the specified bench target + --all-targets Build all targets + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -r, --release Build artifacts in release mode, with optimizations + --profile Build artifacts with the specified profile + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + --target Build for the target triple + --target-dir Directory for all generated artifacts + --out-dir Copy final artifacts to this directory (unstable) + --build-plan Output the build plan in JSON (unstable) + --unit-graph Output build graph in JSON (unstable) + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help build` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_build/mod.rs b/src/tools/cargo/tests/testsuite/cargo_build/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_build/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_check/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_check/help/mod.rs new file mode 100644 index 000000000..71571bc95 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_check/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("check") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_check/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_check/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_check/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_check/help/stdout.log new file mode 100644 index 000000000..7c87615cd --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_check/help/stdout.log @@ -0,0 +1,56 @@ +Check a local package and all of its dependencies for errors + +Usage: cargo[EXE] check [OPTIONS] + +Options: + --ignore-rust-version Ignore `rust-version` specification in packages + --future-incompat-report Outputs a future incompatibility report at the end of the build + --message-format Error format + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package(s) to check + --workspace Check all packages in the workspace + --exclude Exclude packages from the check + --all Alias for --workspace (deprecated) + +Target Selection: + --lib Check only this package's library + --bins Check all binaries + --bin [] Check only the specified binary + --examples Check all examples + --example [] Check only the specified example + --tests Check all tests + --test [] Check only the specified test target + --benches Check all benches + --bench [] Check only the specified bench target + --all-targets Check all targets + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + -r, --release Check artifacts in release mode, with optimizations + --profile Check artifacts with the specified profile + --target Check for the target triple + --target-dir Directory for all generated artifacts + --unit-graph Output build graph in JSON (unstable) + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help check` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_check/mod.rs b/src/tools/cargo/tests/testsuite/cargo_check/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_check/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_clean/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_clean/help/mod.rs new file mode 100644 index 000000000..7225292b8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_clean/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("clean") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_clean/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_clean/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_clean/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_clean/help/stdout.log new file mode 100644 index 000000000..fd3c8855c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_clean/help/stdout.log @@ -0,0 +1,29 @@ +Remove artifacts that cargo has generated in the past + +Usage: cargo[EXE] clean [OPTIONS] + +Options: + --doc Whether or not to clean just the documentation directory + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Package Selection: + -p, --package [] Package to clean artifacts for + +Compilation Options: + -r, --release Whether or not to clean release artifacts + --profile Clean artifacts of the specified profile + --target Target triple to clean output for + --target-dir Directory for all generated artifacts + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help clean` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_clean/mod.rs b/src/tools/cargo/tests/testsuite/cargo_clean/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_clean/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_config.rs b/src/tools/cargo/tests/testsuite/cargo_config.rs deleted file mode 100644 index e367f8e06..000000000 --- a/src/tools/cargo/tests/testsuite/cargo_config.rs +++ /dev/null @@ -1,520 +0,0 @@ -//! Tests for the `cargo config` command. - -use super::config::write_config_at; -use cargo_test_support::paths; -use std::fs; -use std::path::PathBuf; - -fn cargo_process(s: &str) -> cargo_test_support::Execs { - let mut p = cargo_test_support::cargo_process(s); - // Clear out some of the environment added by the default cargo_process so - // the tests don't need to deal with it. - p.env_remove("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO") - .env_remove("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO") - .env_remove("CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO") - .env_remove("CARGO_PROFILE_BENCH_SPLIT_DEBUGINFO") - .env_remove("CARGO_INCREMENTAL"); - p -} - -#[cargo_test] -fn gated() { - cargo_process("config get") - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_status(101) - .with_stderr("\ -error: the `cargo config` command is unstable, pass `-Z unstable-options` to enable it -See https://github.com/rust-lang/cargo/issues/9301 for more information about the `cargo config` command. -") - .run(); -} - -fn common_setup() -> PathBuf { - write_config_at( - paths::home().join(".cargo/config.toml"), - " - [alias] - foo = \"abc --xyz\" - [build] - jobs = 99 - rustflags = [\"--flag-global\"] - [profile.dev] - opt-level = 3 - [profile.dev.package.foo] - opt-level = 1 - [target.'cfg(target_os = \"linux\")'] - runner = \"runme\" - - # How unknown keys are handled. - [extra-table] - somekey = \"somevalue\" - ", - ); - let sub_folder = paths::root().join("foo/.cargo"); - write_config_at( - sub_folder.join("config.toml"), - " - [alias] - sub-example = [\"sub\", \"example\"] - [build] - rustflags = [\"--flag-directory\"] - ", - ); - sub_folder -} - -#[cargo_test] -fn get_toml() { - // Notes: - // - The "extra-table" is shown without a warning. I'm not sure how that - // should be handled, since displaying warnings could cause problems - // with ingesting the output. - // - Environment variables aren't loaded. :( - let sub_folder = common_setup(); - cargo_process("config get -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_ALIAS_BAR", "cat dog") - .env("CARGO_BUILD_JOBS", "100") - // The weird forward slash in the linux line is due to testsuite normalization. - .with_stdout( - "\ -alias.foo = \"abc --xyz\" -alias.sub-example = [\"sub\", \"example\"] -build.jobs = 99 -build.rustflags = [\"--flag-directory\", \"--flag-global\"] -extra-table.somekey = \"somevalue\" -profile.dev.opt-level = 3 -profile.dev.package.foo.opt-level = 1 -target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" -# The following environment variables may affect the loaded values. -# CARGO_ALIAS_BAR=[..]cat dog[..] -# CARGO_BUILD_JOBS=100 -# CARGO_HOME=[ROOT]/home/.cargo -", - ) - .with_stderr("") - .run(); - - // Env keys work if they are specific. - cargo_process("config get build.jobs -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_BUILD_JOBS", "100") - .with_stdout("build.jobs = 100") - .with_stderr("") - .run(); - - // Array value. - cargo_process("config get build.rustflags -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_stdout("build.rustflags = [\"--flag-directory\", \"--flag-global\"]") - .with_stderr("") - .run(); - - // Sub-table - cargo_process("config get profile -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_stdout( - "\ -profile.dev.opt-level = 3 -profile.dev.package.foo.opt-level = 1 -", - ) - .with_stderr("") - .run(); - - // Specific profile entry. - cargo_process("config get profile.dev.opt-level -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_stdout("profile.dev.opt-level = 3") - .with_stderr("") - .run(); - - // A key that isn't set. - cargo_process("config get build.rustc -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_status(101) - .with_stdout("") - .with_stderr("error: config value `build.rustc` is not set") - .run(); - - // A key that is not part of Cargo's config schema. - cargo_process("config get not.set -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_status(101) - .with_stdout("") - .with_stderr("error: config value `not.set` is not set") - .run(); -} - -#[cargo_test] -fn get_json() { - // Notes: - // - This does not show env vars at all. :( - let all_json = r#" - { - "alias": { - "foo": "abc --xyz", - "sub-example": [ - "sub", - "example" - ] - }, - "build": { - "jobs": 99, - "rustflags": [ - "--flag-directory", - "--flag-global" - ] - }, - "extra-table": { - "somekey": "somevalue" - }, - "profile": { - "dev": { - "opt-level": 3, - "package": { - "foo": { - "opt-level": 1 - } - } - } - }, - "target": { - "cfg(target_os = \"linux\")": { - "runner": "runme" - } - } - } - "#; - let sub_folder = common_setup(); - cargo_process("config get --format=json -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_ALIAS_BAR", "cat dog") - .env("CARGO_BUILD_JOBS", "100") - .with_json(all_json) - .with_stderr( - "\ -note: The following environment variables may affect the loaded values. -CARGO_ALIAS_BAR=[..]cat dog[..] -CARGO_BUILD_JOBS=100 -CARGO_HOME=[ROOT]/home/.cargo -", - ) - .run(); - - // json-value is the same for the entire root table - cargo_process("config get --format=json-value -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_json(all_json) - .with_stderr( - "\ -note: The following environment variables may affect the loaded values. -CARGO_HOME=[ROOT]/home/.cargo -", - ) - .run(); - - cargo_process("config get --format=json build.jobs -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_json( - r#" - {"build": {"jobs": 99}} - "#, - ) - .with_stderr("") - .run(); - - cargo_process("config get --format=json-value build.jobs -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_stdout("99") - .with_stderr("") - .run(); -} - -#[cargo_test] -fn show_origin_toml() { - let sub_folder = common_setup(); - cargo_process("config get --show-origin -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_stdout( - "\ -alias.foo = \"abc --xyz\" # [ROOT]/home/.cargo/config.toml -alias.sub-example = [ - \"sub\", # [ROOT]/foo/.cargo/config.toml - \"example\", # [ROOT]/foo/.cargo/config.toml -] -build.jobs = 99 # [ROOT]/home/.cargo/config.toml -build.rustflags = [ - \"--flag-directory\", # [ROOT]/foo/.cargo/config.toml - \"--flag-global\", # [ROOT]/home/.cargo/config.toml -] -extra-table.somekey = \"somevalue\" # [ROOT]/home/.cargo/config.toml -profile.dev.opt-level = 3 # [ROOT]/home/.cargo/config.toml -profile.dev.package.foo.opt-level = 1 # [ROOT]/home/.cargo/config.toml -target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" # [ROOT]/home/.cargo/config.toml -# The following environment variables may affect the loaded values. -# CARGO_HOME=[ROOT]/home/.cargo -", - ) - .with_stderr("") - .run(); - - cargo_process("config get --show-origin build.rustflags -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_BUILD_RUSTFLAGS", "env1 env2") - .with_stdout( - "\ -build.rustflags = [ - \"--flag-directory\", # [ROOT]/foo/.cargo/config.toml - \"--flag-global\", # [ROOT]/home/.cargo/config.toml - \"env1\", # environment variable `CARGO_BUILD_RUSTFLAGS` - \"env2\", # environment variable `CARGO_BUILD_RUSTFLAGS` -] -", - ) - .with_stderr("") - .run(); -} - -#[cargo_test] -fn show_origin_toml_cli() { - let sub_folder = common_setup(); - cargo_process("config get --show-origin build.jobs -Zunstable-options --config build.jobs=123") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_BUILD_JOBS", "1") - .with_stdout("build.jobs = 123 # --config cli option") - .with_stderr("") - .run(); - - cargo_process("config get --show-origin build.rustflags -Zunstable-options --config") - .arg("build.rustflags=[\"cli1\",\"cli2\"]") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_BUILD_RUSTFLAGS", "env1 env2") - .with_stdout( - "\ -build.rustflags = [ - \"--flag-directory\", # [ROOT]/foo/.cargo/config.toml - \"--flag-global\", # [ROOT]/home/.cargo/config.toml - \"cli1\", # --config cli option - \"cli2\", # --config cli option - \"env1\", # environment variable `CARGO_BUILD_RUSTFLAGS` - \"env2\", # environment variable `CARGO_BUILD_RUSTFLAGS` -] -", - ) - .with_stderr("") - .run(); -} - -#[cargo_test] -fn show_origin_json() { - let sub_folder = common_setup(); - cargo_process("config get --show-origin --format=json -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_status(101) - .with_stderr("error: the `json` format does not support --show-origin, try the `toml` format instead") - .run(); -} - -#[cargo_test] -fn unmerged_toml() { - let sub_folder = common_setup(); - cargo_process("config get --merged=no -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_ALIAS_BAR", "cat dog") - .env("CARGO_BUILD_JOBS", "100") - .with_stdout( - "\ -# Environment variables -# CARGO=[..] -# CARGO_ALIAS_BAR=[..]cat dog[..] -# CARGO_BUILD_JOBS=100 -# CARGO_HOME=[ROOT]/home/.cargo - -# [ROOT]/foo/.cargo/config.toml -alias.sub-example = [\"sub\", \"example\"] -build.rustflags = [\"--flag-directory\"] - -# [ROOT]/home/.cargo/config.toml -alias.foo = \"abc --xyz\" -build.jobs = 99 -build.rustflags = [\"--flag-global\"] -extra-table.somekey = \"somevalue\" -profile.dev.opt-level = 3 -profile.dev.package.foo.opt-level = 1 -target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" - -", - ) - .with_stderr("") - .run(); - - cargo_process("config get --merged=no build.rustflags -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_BUILD_RUSTFLAGS", "env1 env2") - .with_stdout( - "\ -# Environment variables -# CARGO_BUILD_RUSTFLAGS=[..]env1 env2[..] - -# [ROOT]/foo/.cargo/config.toml -build.rustflags = [\"--flag-directory\"] - -# [ROOT]/home/.cargo/config.toml -build.rustflags = [\"--flag-global\"] - -", - ) - .with_stderr("") - .run(); - - cargo_process("config get --merged=no does.not.exist -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_stderr("") - .with_stderr("") - .run(); - - cargo_process("config get --merged=no build.rustflags.extra -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_status(101) - .with_stderr( - "error: expected table for configuration key `build.rustflags`, \ - but found array in [ROOT]/foo/.cargo/config.toml", - ) - .run(); -} - -#[cargo_test] -fn unmerged_toml_cli() { - let sub_folder = common_setup(); - cargo_process("config get --merged=no build.rustflags -Zunstable-options --config") - .arg("build.rustflags=[\"cli1\",\"cli2\"]") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .env("CARGO_BUILD_RUSTFLAGS", "env1 env2") - .with_stdout( - "\ -# --config cli option -build.rustflags = [\"cli1\", \"cli2\"] - -# Environment variables -# CARGO_BUILD_RUSTFLAGS=[..]env1 env2[..] - -# [ROOT]/foo/.cargo/config.toml -build.rustflags = [\"--flag-directory\"] - -# [ROOT]/home/.cargo/config.toml -build.rustflags = [\"--flag-global\"] - -", - ) - .with_stderr("") - .run(); -} - -#[cargo_test] -fn unmerged_json() { - let sub_folder = common_setup(); - cargo_process("config get --merged=no --format=json -Zunstable-options") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config"]) - .with_status(101) - .with_stderr( - "error: the `json` format does not support --merged=no, try the `toml` format instead", - ) - .run(); -} - -#[cargo_test] -fn includes() { - let sub_folder = common_setup(); - fs::write( - sub_folder.join("config.toml"), - " - include = 'other.toml' - [build] - rustflags = [\"--flag-directory\"] - ", - ) - .unwrap(); - fs::write( - sub_folder.join("other.toml"), - " - [build] - rustflags = [\"--flag-other\"] - ", - ) - .unwrap(); - - cargo_process("config get build.rustflags -Zunstable-options -Zconfig-include") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config", "config-include"]) - .with_stdout(r#"build.rustflags = ["--flag-other", "--flag-directory", "--flag-global"]"#) - .with_stderr("") - .run(); - - cargo_process("config get build.rustflags --show-origin -Zunstable-options -Zconfig-include") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config", "config-include"]) - .with_stdout( - "\ -build.rustflags = [ - \"--flag-other\", # [ROOT]/foo/.cargo/other.toml - \"--flag-directory\", # [ROOT]/foo/.cargo/config.toml - \"--flag-global\", # [ROOT]/home/.cargo/config.toml -] -", - ) - .with_stderr("") - .run(); - - cargo_process("config get --merged=no -Zunstable-options -Zconfig-include") - .cwd(&sub_folder.parent().unwrap()) - .masquerade_as_nightly_cargo(&["cargo-config", "config-include"]) - .with_stdout( - "\ -# Environment variables -# CARGO=[..] -# CARGO_HOME=[ROOT]/home/.cargo - -# [ROOT]/foo/.cargo/other.toml -build.rustflags = [\"--flag-other\"] - -# [ROOT]/foo/.cargo/config.toml -build.rustflags = [\"--flag-directory\"] -include = \"other.toml\" - -# [ROOT]/home/.cargo/config.toml -alias.foo = \"abc --xyz\" -build.jobs = 99 -build.rustflags = [\"--flag-global\"] -extra-table.somekey = \"somevalue\" -profile.dev.opt-level = 3 -profile.dev.package.foo.opt-level = 1 -target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" - -", - ) - .with_stderr("") - .run(); -} diff --git a/src/tools/cargo/tests/testsuite/cargo_config/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_config/help/mod.rs new file mode 100644 index 000000000..070238ef0 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_config/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("config") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_config/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_config/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_config/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_config/help/stdout.log new file mode 100644 index 000000000..50caca72a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_config/help/stdout.log @@ -0,0 +1,18 @@ +Inspect configuration values + +Usage: cargo[EXE] config [OPTIONS] + +Commands: + get + +Options: + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network diff --git a/src/tools/cargo/tests/testsuite/cargo_config/mod.rs b/src/tools/cargo/tests/testsuite/cargo_config/mod.rs new file mode 100644 index 000000000..dc0a40ed8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_config/mod.rs @@ -0,0 +1,522 @@ +//! Tests for the `cargo config` command. + +use super::config::write_config_at; +use cargo_test_support::paths; +use std::fs; +use std::path::PathBuf; + +mod help; + +fn cargo_process(s: &str) -> cargo_test_support::Execs { + let mut p = cargo_test_support::cargo_process(s); + // Clear out some of the environment added by the default cargo_process so + // the tests don't need to deal with it. + p.env_remove("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO") + .env_remove("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO") + .env_remove("CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO") + .env_remove("CARGO_PROFILE_BENCH_SPLIT_DEBUGINFO") + .env_remove("CARGO_INCREMENTAL"); + p +} + +#[cargo_test] +fn gated() { + cargo_process("config get") + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_status(101) + .with_stderr("\ +error: the `cargo config` command is unstable, pass `-Z unstable-options` to enable it +See https://github.com/rust-lang/cargo/issues/9301 for more information about the `cargo config` command. +") + .run(); +} + +fn common_setup() -> PathBuf { + write_config_at( + paths::home().join(".cargo/config.toml"), + " + [alias] + foo = \"abc --xyz\" + [build] + jobs = 99 + rustflags = [\"--flag-global\"] + [profile.dev] + opt-level = 3 + [profile.dev.package.foo] + opt-level = 1 + [target.'cfg(target_os = \"linux\")'] + runner = \"runme\" + + # How unknown keys are handled. + [extra-table] + somekey = \"somevalue\" + ", + ); + let sub_folder = paths::root().join("foo/.cargo"); + write_config_at( + sub_folder.join("config.toml"), + " + [alias] + sub-example = [\"sub\", \"example\"] + [build] + rustflags = [\"--flag-directory\"] + ", + ); + sub_folder +} + +#[cargo_test] +fn get_toml() { + // Notes: + // - The "extra-table" is shown without a warning. I'm not sure how that + // should be handled, since displaying warnings could cause problems + // with ingesting the output. + // - Environment variables aren't loaded. :( + let sub_folder = common_setup(); + cargo_process("config get -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_ALIAS_BAR", "cat dog") + .env("CARGO_BUILD_JOBS", "100") + // The weird forward slash in the linux line is due to testsuite normalization. + .with_stdout( + "\ +alias.foo = \"abc --xyz\" +alias.sub-example = [\"sub\", \"example\"] +build.jobs = 99 +build.rustflags = [\"--flag-directory\", \"--flag-global\"] +extra-table.somekey = \"somevalue\" +profile.dev.opt-level = 3 +profile.dev.package.foo.opt-level = 1 +target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" +# The following environment variables may affect the loaded values. +# CARGO_ALIAS_BAR=[..]cat dog[..] +# CARGO_BUILD_JOBS=100 +# CARGO_HOME=[ROOT]/home/.cargo +", + ) + .with_stderr("") + .run(); + + // Env keys work if they are specific. + cargo_process("config get build.jobs -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_BUILD_JOBS", "100") + .with_stdout("build.jobs = 100") + .with_stderr("") + .run(); + + // Array value. + cargo_process("config get build.rustflags -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_stdout("build.rustflags = [\"--flag-directory\", \"--flag-global\"]") + .with_stderr("") + .run(); + + // Sub-table + cargo_process("config get profile -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_stdout( + "\ +profile.dev.opt-level = 3 +profile.dev.package.foo.opt-level = 1 +", + ) + .with_stderr("") + .run(); + + // Specific profile entry. + cargo_process("config get profile.dev.opt-level -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_stdout("profile.dev.opt-level = 3") + .with_stderr("") + .run(); + + // A key that isn't set. + cargo_process("config get build.rustc -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_status(101) + .with_stdout("") + .with_stderr("error: config value `build.rustc` is not set") + .run(); + + // A key that is not part of Cargo's config schema. + cargo_process("config get not.set -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_status(101) + .with_stdout("") + .with_stderr("error: config value `not.set` is not set") + .run(); +} + +#[cargo_test] +fn get_json() { + // Notes: + // - This does not show env vars at all. :( + let all_json = r#" + { + "alias": { + "foo": "abc --xyz", + "sub-example": [ + "sub", + "example" + ] + }, + "build": { + "jobs": 99, + "rustflags": [ + "--flag-directory", + "--flag-global" + ] + }, + "extra-table": { + "somekey": "somevalue" + }, + "profile": { + "dev": { + "opt-level": 3, + "package": { + "foo": { + "opt-level": 1 + } + } + } + }, + "target": { + "cfg(target_os = \"linux\")": { + "runner": "runme" + } + } + } + "#; + let sub_folder = common_setup(); + cargo_process("config get --format=json -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_ALIAS_BAR", "cat dog") + .env("CARGO_BUILD_JOBS", "100") + .with_json(all_json) + .with_stderr( + "\ +note: The following environment variables may affect the loaded values. +CARGO_ALIAS_BAR=[..]cat dog[..] +CARGO_BUILD_JOBS=100 +CARGO_HOME=[ROOT]/home/.cargo +", + ) + .run(); + + // json-value is the same for the entire root table + cargo_process("config get --format=json-value -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_json(all_json) + .with_stderr( + "\ +note: The following environment variables may affect the loaded values. +CARGO_HOME=[ROOT]/home/.cargo +", + ) + .run(); + + cargo_process("config get --format=json build.jobs -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_json( + r#" + {"build": {"jobs": 99}} + "#, + ) + .with_stderr("") + .run(); + + cargo_process("config get --format=json-value build.jobs -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_stdout("99") + .with_stderr("") + .run(); +} + +#[cargo_test] +fn show_origin_toml() { + let sub_folder = common_setup(); + cargo_process("config get --show-origin -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_stdout( + "\ +alias.foo = \"abc --xyz\" # [ROOT]/home/.cargo/config.toml +alias.sub-example = [ + \"sub\", # [ROOT]/foo/.cargo/config.toml + \"example\", # [ROOT]/foo/.cargo/config.toml +] +build.jobs = 99 # [ROOT]/home/.cargo/config.toml +build.rustflags = [ + \"--flag-directory\", # [ROOT]/foo/.cargo/config.toml + \"--flag-global\", # [ROOT]/home/.cargo/config.toml +] +extra-table.somekey = \"somevalue\" # [ROOT]/home/.cargo/config.toml +profile.dev.opt-level = 3 # [ROOT]/home/.cargo/config.toml +profile.dev.package.foo.opt-level = 1 # [ROOT]/home/.cargo/config.toml +target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" # [ROOT]/home/.cargo/config.toml +# The following environment variables may affect the loaded values. +# CARGO_HOME=[ROOT]/home/.cargo +", + ) + .with_stderr("") + .run(); + + cargo_process("config get --show-origin build.rustflags -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_BUILD_RUSTFLAGS", "env1 env2") + .with_stdout( + "\ +build.rustflags = [ + \"--flag-directory\", # [ROOT]/foo/.cargo/config.toml + \"--flag-global\", # [ROOT]/home/.cargo/config.toml + \"env1\", # environment variable `CARGO_BUILD_RUSTFLAGS` + \"env2\", # environment variable `CARGO_BUILD_RUSTFLAGS` +] +", + ) + .with_stderr("") + .run(); +} + +#[cargo_test] +fn show_origin_toml_cli() { + let sub_folder = common_setup(); + cargo_process("config get --show-origin build.jobs -Zunstable-options --config build.jobs=123") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_BUILD_JOBS", "1") + .with_stdout("build.jobs = 123 # --config cli option") + .with_stderr("") + .run(); + + cargo_process("config get --show-origin build.rustflags -Zunstable-options --config") + .arg("build.rustflags=[\"cli1\",\"cli2\"]") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_BUILD_RUSTFLAGS", "env1 env2") + .with_stdout( + "\ +build.rustflags = [ + \"--flag-directory\", # [ROOT]/foo/.cargo/config.toml + \"--flag-global\", # [ROOT]/home/.cargo/config.toml + \"cli1\", # --config cli option + \"cli2\", # --config cli option + \"env1\", # environment variable `CARGO_BUILD_RUSTFLAGS` + \"env2\", # environment variable `CARGO_BUILD_RUSTFLAGS` +] +", + ) + .with_stderr("") + .run(); +} + +#[cargo_test] +fn show_origin_json() { + let sub_folder = common_setup(); + cargo_process("config get --show-origin --format=json -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_status(101) + .with_stderr("error: the `json` format does not support --show-origin, try the `toml` format instead") + .run(); +} + +#[cargo_test] +fn unmerged_toml() { + let sub_folder = common_setup(); + cargo_process("config get --merged=no -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_ALIAS_BAR", "cat dog") + .env("CARGO_BUILD_JOBS", "100") + .with_stdout( + "\ +# Environment variables +# CARGO=[..] +# CARGO_ALIAS_BAR=[..]cat dog[..] +# CARGO_BUILD_JOBS=100 +# CARGO_HOME=[ROOT]/home/.cargo + +# [ROOT]/foo/.cargo/config.toml +alias.sub-example = [\"sub\", \"example\"] +build.rustflags = [\"--flag-directory\"] + +# [ROOT]/home/.cargo/config.toml +alias.foo = \"abc --xyz\" +build.jobs = 99 +build.rustflags = [\"--flag-global\"] +extra-table.somekey = \"somevalue\" +profile.dev.opt-level = 3 +profile.dev.package.foo.opt-level = 1 +target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" + +", + ) + .with_stderr("") + .run(); + + cargo_process("config get --merged=no build.rustflags -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_BUILD_RUSTFLAGS", "env1 env2") + .with_stdout( + "\ +# Environment variables +# CARGO_BUILD_RUSTFLAGS=[..]env1 env2[..] + +# [ROOT]/foo/.cargo/config.toml +build.rustflags = [\"--flag-directory\"] + +# [ROOT]/home/.cargo/config.toml +build.rustflags = [\"--flag-global\"] + +", + ) + .with_stderr("") + .run(); + + cargo_process("config get --merged=no does.not.exist -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_stderr("") + .with_stderr("") + .run(); + + cargo_process("config get --merged=no build.rustflags.extra -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_status(101) + .with_stderr( + "error: expected table for configuration key `build.rustflags`, \ + but found array in [ROOT]/foo/.cargo/config.toml", + ) + .run(); +} + +#[cargo_test] +fn unmerged_toml_cli() { + let sub_folder = common_setup(); + cargo_process("config get --merged=no build.rustflags -Zunstable-options --config") + .arg("build.rustflags=[\"cli1\",\"cli2\"]") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .env("CARGO_BUILD_RUSTFLAGS", "env1 env2") + .with_stdout( + "\ +# --config cli option +build.rustflags = [\"cli1\", \"cli2\"] + +# Environment variables +# CARGO_BUILD_RUSTFLAGS=[..]env1 env2[..] + +# [ROOT]/foo/.cargo/config.toml +build.rustflags = [\"--flag-directory\"] + +# [ROOT]/home/.cargo/config.toml +build.rustflags = [\"--flag-global\"] + +", + ) + .with_stderr("") + .run(); +} + +#[cargo_test] +fn unmerged_json() { + let sub_folder = common_setup(); + cargo_process("config get --merged=no --format=json -Zunstable-options") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config"]) + .with_status(101) + .with_stderr( + "error: the `json` format does not support --merged=no, try the `toml` format instead", + ) + .run(); +} + +#[cargo_test] +fn includes() { + let sub_folder = common_setup(); + fs::write( + sub_folder.join("config.toml"), + " + include = 'other.toml' + [build] + rustflags = [\"--flag-directory\"] + ", + ) + .unwrap(); + fs::write( + sub_folder.join("other.toml"), + " + [build] + rustflags = [\"--flag-other\"] + ", + ) + .unwrap(); + + cargo_process("config get build.rustflags -Zunstable-options -Zconfig-include") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config", "config-include"]) + .with_stdout(r#"build.rustflags = ["--flag-other", "--flag-directory", "--flag-global"]"#) + .with_stderr("") + .run(); + + cargo_process("config get build.rustflags --show-origin -Zunstable-options -Zconfig-include") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config", "config-include"]) + .with_stdout( + "\ +build.rustflags = [ + \"--flag-other\", # [ROOT]/foo/.cargo/other.toml + \"--flag-directory\", # [ROOT]/foo/.cargo/config.toml + \"--flag-global\", # [ROOT]/home/.cargo/config.toml +] +", + ) + .with_stderr("") + .run(); + + cargo_process("config get --merged=no -Zunstable-options -Zconfig-include") + .cwd(&sub_folder.parent().unwrap()) + .masquerade_as_nightly_cargo(&["cargo-config", "config-include"]) + .with_stdout( + "\ +# Environment variables +# CARGO=[..] +# CARGO_HOME=[ROOT]/home/.cargo + +# [ROOT]/foo/.cargo/other.toml +build.rustflags = [\"--flag-other\"] + +# [ROOT]/foo/.cargo/config.toml +build.rustflags = [\"--flag-directory\"] +include = \"other.toml\" + +# [ROOT]/home/.cargo/config.toml +alias.foo = \"abc --xyz\" +build.jobs = 99 +build.rustflags = [\"--flag-global\"] +extra-table.somekey = \"somevalue\" +profile.dev.opt-level = 3 +profile.dev.package.foo.opt-level = 1 +target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" + +", + ) + .with_stderr("") + .run(); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_doc/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_doc/help/mod.rs new file mode 100644 index 000000000..b0fd4f3e8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_doc/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("doc") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_doc/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_doc/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_doc/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_doc/help/stdout.log new file mode 100644 index 000000000..480e189c1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_doc/help/stdout.log @@ -0,0 +1,53 @@ +Build a package's documentation + +Usage: cargo[EXE] doc [OPTIONS] + +Options: + --open Opens the docs in a browser after the operation + --no-deps Don't build documentation for dependencies + --document-private-items Document private items + --ignore-rust-version Ignore `rust-version` specification in packages + --message-format Error format + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package to document + --workspace Document all packages in the workspace + --exclude Exclude packages from the build + --all Alias for --workspace (deprecated) + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Target Selection: + --lib Document only this package's library + --bins Document all binaries + --bin [] Document only the specified binary + --examples Document all examples + --example [] Document only the specified example + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + -r, --release Build artifacts in release mode, with optimizations + --profile Build artifacts with the specified profile + --target Build for the target triple + --target-dir Directory for all generated artifacts + --unit-graph Output build graph in JSON (unstable) + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help doc` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_doc/mod.rs b/src/tools/cargo/tests/testsuite/cargo_doc/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_doc/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_fetch/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_fetch/help/mod.rs new file mode 100644 index 000000000..79025bc32 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_fetch/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("fetch") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_fetch/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_fetch/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_fetch/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_fetch/help/stdout.log new file mode 100644 index 000000000..b9bd6c35b --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_fetch/help/stdout.log @@ -0,0 +1,22 @@ +Fetch dependencies of a package from the network + +Usage: cargo[EXE] fetch [OPTIONS] + +Options: + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Compilation Options: + --target Fetch dependencies for the target triple + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help fetch` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_fetch/mod.rs b/src/tools/cargo/tests/testsuite/cargo_fetch/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_fetch/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_fix/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_fix/help/mod.rs new file mode 100644 index 000000000..2c67e1556 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_fix/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("fix") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_fix/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_fix/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_fix/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_fix/help/stdout.log new file mode 100644 index 000000000..c0a98218a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_fix/help/stdout.log @@ -0,0 +1,60 @@ +Automatically fix lint warnings reported by rustc + +Usage: cargo[EXE] fix [OPTIONS] + +Options: + --edition Fix in preparation for the next edition + --edition-idioms Fix warnings to migrate to the idioms of an edition + --broken-code Fix code even if it already has compiler errors + --allow-no-vcs Fix code even if a VCS was not detected + --allow-dirty Fix code even if the working directory is dirty + --allow-staged Fix code even if the working directory has staged changes + --ignore-rust-version Ignore `rust-version` specification in packages + --message-format Error format + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package(s) to fix + --workspace Fix all packages in the workspace + --exclude Exclude packages from the fixes + --all Alias for --workspace (deprecated) + +Target Selection: + --lib Fix only this package's library + --bins Fix all binaries + --bin [] Fix only the specified binary + --examples Fix all examples + --example [] Fix only the specified example + --tests Fix all tests + --test [] Fix only the specified test target + --benches Fix all benches + --bench [] Fix only the specified bench target + --all-targets Fix all targets (default) + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + -r, --release Fix artifacts in release mode, with optimizations + --profile Build artifacts with the specified profile + --target Fix for the target triple + --target-dir Directory for all generated artifacts + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help fix` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_fix/mod.rs b/src/tools/cargo/tests/testsuite/cargo_fix/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_fix/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/mod.rs new file mode 100644 index 000000000..0408ce06b --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("generate-lockfile") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/stdout.log new file mode 100644 index 000000000..07eff888a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/help/stdout.log @@ -0,0 +1,19 @@ +Generate the lockfile for a package + +Usage: cargo[EXE] generate-lockfile [OPTIONS] + +Options: + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help generate-lockfile` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/mod.rs b/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_generate_lockfile/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_git_checkout/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_git_checkout/help/mod.rs new file mode 100644 index 000000000..5ff877fbb --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_git_checkout/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("git-checkout") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_git_checkout/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_git_checkout/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_git_checkout/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_git_checkout/help/stdout.log new file mode 100644 index 000000000..675090fd3 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_git_checkout/help/stdout.log @@ -0,0 +1 @@ +The `git-checkout` command has been removed. diff --git a/src/tools/cargo/tests/testsuite/cargo_git_checkout/mod.rs b/src/tools/cargo/tests/testsuite/cargo_git_checkout/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_git_checkout/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_help/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_help/help/mod.rs new file mode 100644 index 000000000..af445cda1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_help/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("help") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_help/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_help/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_help/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_help/help/stdout.log new file mode 100644 index 000000000..a03946b45 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_help/help/stdout.log @@ -0,0 +1,18 @@ +Displays help for a cargo subcommand + +Usage: cargo[EXE] help [OPTIONS] [COMMAND] + +Arguments: + [COMMAND] + +Options: + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network diff --git a/src/tools/cargo/tests/testsuite/cargo_help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_help/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_help/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_init/auto_git/in b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/in new file mode 120000 index 000000000..1202506b6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/cargo_init/auto_git/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/mod.rs new file mode 100644 index 000000000..68c217520 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib") + .current_dir(project_root) + .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); + assert!(project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/auto_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/auto_git/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/auto_git/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/auto_git/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/auto_git/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/in/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/in/src/main.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/in/src/main.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/mod.rs new file mode 100644 index 000000000..326bd218a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --bin --vcs none") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/out/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/out/src/main.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/out/src/main.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/in/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/in/main.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/in/main.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/mod.rs new file mode 100644 index 000000000..1f16fb659 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --bin --vcs none") + .current_dir(project_root) + .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); + assert!(!project_root.join("src").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/out/Cargo.toml new file mode 100644 index 000000000..5c6c9158c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[[bin]] +name = "case" +path = "main.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/out/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/out/main.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/out/main.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_explicit_nosrc/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/in/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/in/src/main.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/in/src/main.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/mod.rs new file mode 100644 index 000000000..12349a09b --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs none") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/out/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/out/src/main.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/out/src/main.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/in/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/in/case.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/in/case.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/mod.rs new file mode 100644 index 000000000..fe65940db --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs none") + .current_dir(project_root) + .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); + assert!(!project_root.join("src").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/out/Cargo.toml new file mode 100644 index 000000000..8da5fe778 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[[bin]] +name = "case" +path = "case.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/out/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/out/case.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/out/case.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namenosrc/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/in/src/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/in/src/case.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/in/src/case.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/mod.rs new file mode 100644 index 000000000..d3e8e66df --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs none") + .current_dir(project_root) + .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); + assert!(!project_root.join("src/main.rs").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/out/Cargo.toml new file mode 100644 index 000000000..dec0aaea9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[[bin]] +name = "case" +path = "src/case.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/out/src/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/out/src/case.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/out/src/case.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_namesrc/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/in/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/in/main.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/in/main.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/mod.rs new file mode 100644 index 000000000..fe65940db --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs none") + .current_dir(project_root) + .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); + assert!(!project_root.join("src").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/out/Cargo.toml new file mode 100644 index 000000000..5c6c9158c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[[bin]] +name = "case" +path = "main.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/out/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/out/main.rs new file mode 100644 index 000000000..65fdcf8da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/out/main.rs @@ -0,0 +1,4 @@ +fn main() { + println!("Check that our file is not overwritten") +} + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/bin_already_exists_implicit_nosrc/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/mod.rs new file mode 100644 index 000000000..c9232320a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/mod.rs @@ -0,0 +1,19 @@ +use cargo_test_support::paths; +use cargo_test_support::prelude::*; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let cwd = paths::root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --bin") + .current_dir(&cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert!(!cwd.join("Cargo.toml").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/stderr.log new file mode 100644 index 000000000..9d635a427 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/stderr.log @@ -0,0 +1 @@ +error: can't specify both lib and binary outputs diff --git a/src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/both_lib_and_bin/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/in/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/in/case.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/in/case.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/in/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/in/lib.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/in/lib.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/mod.rs new file mode 100644 index 000000000..5e9e1b94c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/mod.rs @@ -0,0 +1,18 @@ +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib") + .current_dir(project_root) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/stderr.log new file mode 100644 index 000000000..c08dce96b --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/stderr.log @@ -0,0 +1 @@ +error: cannot have a package with multiple libraries, found both `case.rs` and `lib.rs` diff --git a/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/cant_create_library_when_both_binlib_present/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/in/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/in/lib.rs new file mode 100644 index 000000000..321163744 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/in/lib.rs @@ -0,0 +1 @@ +fn f() { println!("lib.rs"); } diff --git a/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/in/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/in/src/lib.rs new file mode 100644 index 000000000..f71455a1a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/in/src/lib.rs @@ -0,0 +1 @@ +fn f() { println!("src/lib.rs"); } diff --git a/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/mod.rs new file mode 100644 index 000000000..d1cba2ff7 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs none") + .current_dir(project_root) + .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); + assert!(!project_root.join("Cargo.toml").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/out/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/out/lib.rs new file mode 100644 index 000000000..321163744 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/out/lib.rs @@ -0,0 +1 @@ +fn f() { println!("lib.rs"); } diff --git a/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/out/src/lib.rs new file mode 100644 index 000000000..f71455a1a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/out/src/lib.rs @@ -0,0 +1 @@ +fn f() { println!("src/lib.rs"); } diff --git a/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/stderr.log new file mode 100644 index 000000000..8dbd2aaf0 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/stderr.log @@ -0,0 +1 @@ +error: cannot have a package with multiple libraries, found both `src/lib.rs` and `lib.rs` diff --git a/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/confused_by_multiple_lib_files/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/in/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/in/case.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/in/case.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/in/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/in/lib.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/in/lib.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/mod.rs new file mode 100644 index 000000000..326bd218a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --bin --vcs none") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/Cargo.toml new file mode 100644 index 000000000..675c888a5 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[[bin]] +name = "case" +path = "case.rs" + +[lib] +name = "case" +path = "lib.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/case.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/case.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/lib.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/out/lib.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_both_binlib_present/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/in/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/in/case.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/in/case.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/mod.rs new file mode 100644 index 000000000..326bd218a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --bin --vcs none") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml new file mode 100644 index 000000000..8da5fe778 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[[bin]] +name = "case" +path = "case.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/out/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/out/case.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/out/case.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/stderr.log new file mode 100644 index 000000000..ec428f31c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/stderr.log @@ -0,0 +1,2 @@ +warning: file `case.rs` seems to be a library file + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/creates_binary_when_instructed_and_has_lib_file/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/in/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/in/case.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/in/case.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/mod.rs new file mode 100644 index 000000000..59c192cb9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --vcs none") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml new file mode 100644 index 000000000..2c0464468 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[lib] +name = "case" +path = "case.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/out/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/out/case.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/out/case.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/stderr.log new file mode 100644 index 000000000..bf070e2da --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/stderr.log @@ -0,0 +1,2 @@ +warning: file `case.rs` seems to be a binary (application) file + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/creates_library_when_instructed_and_has_bin_file/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/empty_dir/.keep b/src/tools/cargo/tests/testsuite/cargo_init/empty_dir/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/empty_dir/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/empty_dir/mod.rs new file mode 100644 index 000000000..074954f01 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/empty_dir/mod.rs @@ -0,0 +1,7 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::{command_is_available, paths, Project}; +use std::fs; +use std::process::Command; + +use crate::test_root; diff --git a/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/in b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/in new file mode 120000 index 000000000..1202506b6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/mod.rs new file mode 100644 index 000000000..7314e955c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs git --bin") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/out/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/out/src/main.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/out/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/explicit_bin_with_git/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/formats_source/in/rustfmt.toml b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/in/rustfmt.toml new file mode 100644 index 000000000..b196eaa2d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/in/rustfmt.toml @@ -0,0 +1 @@ +tab_spaces = 2 diff --git a/src/tools/cargo/tests/testsuite/cargo_init/formats_source/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/mod.rs new file mode 100644 index 000000000..ac1fb6271 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/mod.rs @@ -0,0 +1,29 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::{process, Project}; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + // This cannot use `requires_rustfmt` because rustfmt is not available in + // the rust-lang/rust environment. Additionally, if running cargo without + // rustup (but with rustup installed), this test also fails due to HOME + // preventing the proxy from choosing a toolchain. + if let Err(e) = process("rustfmt").arg("-V").exec_with_output() { + eprintln!("skipping test, rustfmt not available:\n{e:?}"); + return; + } + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --vcs none") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/rustfmt.toml b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/rustfmt.toml new file mode 100644 index 000000000..b196eaa2d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/rustfmt.toml @@ -0,0 +1 @@ +tab_spaces = 2 diff --git a/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/src/lib.rs new file mode 100644 index 000000000..3b9acffd5 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/formats_source/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/formats_source/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/formats_source/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/in/.fossil/.keep b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/in/.fossil/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/mod.rs new file mode 100644 index 000000000..d45ba868a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib") + .current_dir(project_root) + .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); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/.fossil-settings/clean-glob b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/.fossil-settings/clean-glob new file mode 100644 index 000000000..a9d37c560 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/.fossil-settings/clean-glob @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/.fossil-settings/ignore-glob b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/.fossil-settings/ignore-glob new file mode 100644 index 000000000..a9d37c560 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/.fossil-settings/ignore-glob @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/fossil_autodetect/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/mod.rs new file mode 100644 index 000000000..aef47bc7d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::paths; +use cargo_test_support::prelude::*; +use std::fs; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project_root = &paths::root().join("foo"); + // Need to create `.git` dir manually because it cannot be tracked under a git repo + fs::create_dir_all(project_root.join(".git")).unwrap(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib") + .current_dir(project_root) + .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); + assert!(project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/out/Cargo.toml new file mode 100644 index 000000000..1d9cfe317 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "foo" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/git_autodetect/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/mod.rs new file mode 100644 index 000000000..cd4437c65 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --edition 2015") + .current_dir(project_root) + .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); + assert!(project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml new file mode 100644 index 000000000..a6269fdcd --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2015" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/help/mod.rs new file mode 100644 index 000000000..7f00d347a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("init") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/help/stdout.log new file mode 100644 index 000000000..5dfb02498 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/help/stdout.log @@ -0,0 +1,31 @@ +Create a new cargo package in an existing directory + +Usage: cargo[EXE] init [OPTIONS] [path] + +Arguments: + [path] [default: .] + +Options: + --vcs Initialize a new repository for the given version control system (git, + hg, pijul, or fossil) or do not initialize any version control at all + (none), overriding a global configuration. [possible values: git, hg, + pijul, fossil, none] + --bin Use a binary (application) template [default] + --lib Use a library template + --edition Edition to set for the crate generated [possible values: 2015, 2018, + 2021] + --name Set the resulting package name, defaults to the directory name + --registry Registry to use + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help init` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/in/rustfmt.toml b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/in/rustfmt.toml new file mode 100644 index 000000000..b196eaa2d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/in/rustfmt.toml @@ -0,0 +1 @@ +tab_spaces = 2 diff --git a/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/mod.rs new file mode 100644 index 000000000..fd9394049 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --vcs none") + .env("PATH", "") // pretend that `rustfmt` is missing + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/rustfmt.toml b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/rustfmt.toml new file mode 100644 index 000000000..b196eaa2d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/rustfmt.toml @@ -0,0 +1 @@ +tab_spaces = 2 diff --git a/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/ignores_failure_to_format_source/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/in/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/in/main.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/in/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/mod.rs new file mode 100644 index 000000000..80bec8893 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs git") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/out/Cargo.toml new file mode 100644 index 000000000..5c6c9158c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[[bin]] +name = "case" +path = "main.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/out/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/out/main.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/out/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/inferred_bin_with_git/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/in/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/in/lib.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/in/lib.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/mod.rs new file mode 100644 index 000000000..80bec8893 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs git") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/out/Cargo.toml new file mode 100644 index 000000000..39e95fe94 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[lib] +name = "case" +path = "lib.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/out/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/out/lib.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/out/lib.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/inferred_lib_with_git/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/Cargo.toml new file mode 100644 index 000000000..b7a2e9036 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/Cargo.toml @@ -0,0 +1,21 @@ +[workspace] +members = [ + "crates/*", +] + +[workspace.package] +authors = ["Rustaceans"] +description = "foo" +edition = "2018" +homepage = "foo" +keywords = ["foo", "bar"] +readme = "README.md" +rust-version = "1.67.0" +categories = ["algorithms"] +documentation = "foo" +exclude = ["foo"] +include = ["foo"] +license = "MIT OR Apache-2.0" +publish = false +repository = "foo" +version = "1.2.3" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/README.md b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/crates/foo/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/crates/foo/src/main.rs new file mode 100644 index 000000000..43f0dac5e --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/crates/foo/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Check that our file is not overwritten") +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/in/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs new file mode 100644 index 000000000..4e1dda845 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("init") + .args(["crates/foo"]) + .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/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/Cargo.toml new file mode 100644 index 000000000..b7a2e9036 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/Cargo.toml @@ -0,0 +1,21 @@ +[workspace] +members = [ + "crates/*", +] + +[workspace.package] +authors = ["Rustaceans"] +description = "foo" +edition = "2018" +homepage = "foo" +keywords = ["foo", "bar"] +readme = "README.md" +rust-version = "1.67.0" +categories = ["algorithms"] +documentation = "foo" +exclude = ["foo"] +include = ["foo"] +license = "MIT OR Apache-2.0" +publish = false +repository = "foo" +version = "1.2.3" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/crates/foo/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/crates/foo/Cargo.toml new file mode 100644 index 000000000..137ed1c87 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/crates/foo/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "foo" +authors.workspace = true +description.workspace = true +edition.workspace = true +homepage.workspace = true +keywords.workspace = true +readme.workspace = true +rust-version.workspace = true +categories.workspace = true +documentation.workspace = true +exclude.workspace = true +include.workspace = true +license.workspace = true +publish.workspace = true +repository.workspace = true +version.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/crates/foo/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/crates/foo/src/main.rs new file mode 100644 index 000000000..43f0dac5e --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/crates/foo/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Check that our file is not overwritten") +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/inherit_workspace_package_table/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/mod.rs new file mode 100644 index 000000000..2b1be9022 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::paths; +use cargo_test_support::prelude::*; +use std::fs; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let foo = &paths::root().join("foo.bar"); + fs::create_dir_all(foo).unwrap(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init") + .current_dir(foo) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert!(!foo.join("Cargo.toml").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/stderr.log new file mode 100644 index 000000000..86d2c665f --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/stderr.log @@ -0,0 +1,8 @@ +error: invalid character `.` in package name: `foo.bar`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters) +If you need a package name to not match the directory name, consider using --name flag. +If you need a binary with the name "foo.bar", use a valid package name, and set the binary name to be different from the package. This can be done by setting the binary filename to `src/bin/foo.bar.rs` or change the name in Cargo.toml with: + + [[bin]] + name = "foo.bar" + path = "src/main.rs" + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/invalid_dir_name/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/in/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/in/lib.rs new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/mod.rs new file mode 100644 index 000000000..d3e8e66df --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs none") + .current_dir(project_root) + .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); + assert!(!project_root.join("src/main.rs").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/out/Cargo.toml new file mode 100644 index 000000000..39e95fe94 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/out/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[lib] +name = "case" +path = "lib.rs" diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/out/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/out/lib.rs new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_nosrc/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/in/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/in/src/lib.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/in/src/lib.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/mod.rs new file mode 100644 index 000000000..d3e8e66df --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --vcs none") + .current_dir(project_root) + .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); + assert!(!project_root.join("src/main.rs").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/out/src/lib.rs new file mode 100644 index 000000000..59760b549 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/out/src/lib.rs @@ -0,0 +1 @@ +fn f() {} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/lib_already_exists_src/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/mod.rs new file mode 100644 index 000000000..d45ba868a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib") + .current_dir(project_root) + .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); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/mercurial_autodetect/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/mod.rs new file mode 100644 index 000000000..a1988a06a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/mod.rs @@ -0,0 +1,44 @@ +//! Tests for the `cargo init` command. + +mod auto_git; +mod bin_already_exists_explicit; +mod bin_already_exists_explicit_nosrc; +mod bin_already_exists_implicit; +mod bin_already_exists_implicit_namenosrc; +mod bin_already_exists_implicit_namesrc; +mod bin_already_exists_implicit_nosrc; +mod both_lib_and_bin; +mod cant_create_library_when_both_binlib_present; +mod confused_by_multiple_lib_files; +mod creates_binary_when_both_binlib_present; +mod creates_binary_when_instructed_and_has_lib_file; +mod creates_library_when_instructed_and_has_bin_file; +mod explicit_bin_with_git; +mod formats_source; +mod fossil_autodetect; +mod git_autodetect; +mod git_ignore_exists_no_conflicting_entries; +mod help; +mod ignores_failure_to_format_source; +mod inferred_bin_with_git; +mod inferred_lib_with_git; +mod inherit_workspace_package_table; +mod invalid_dir_name; +mod lib_already_exists_nosrc; +mod lib_already_exists_src; +mod mercurial_autodetect; +mod multibin_project_name_clash; +#[cfg(not(windows))] +mod no_filename; +#[cfg(unix)] +mod path_contains_separator; +mod pijul_autodetect; +mod reserved_name; +mod simple_bin; +mod simple_git; +mod simple_git_ignore_exists; +mod simple_hg; +mod simple_hg_ignore_exists; +mod simple_lib; +mod unknown_flags; +mod with_argument; diff --git a/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/in/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/in/case.rs new file mode 100644 index 000000000..b31221118 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/in/case.rs @@ -0,0 +1 @@ +fn main() { println!("foo.rs"); } diff --git a/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/in/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/in/main.rs new file mode 100644 index 000000000..7937627b9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/in/main.rs @@ -0,0 +1 @@ +fn main() { println!("main.rs"); } diff --git a/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/mod.rs new file mode 100644 index 000000000..fdd4476d9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --vcs none") + .current_dir(project_root) + .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); + assert!(!project_root.join("Cargo.toml").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/out/case.rs b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/out/case.rs new file mode 100644 index 000000000..b31221118 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/out/case.rs @@ -0,0 +1 @@ +fn main() { println!("foo.rs"); } diff --git a/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/out/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/out/main.rs new file mode 100644 index 000000000..7937627b9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/out/main.rs @@ -0,0 +1 @@ +fn main() { println!("main.rs"); } diff --git a/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/stderr.log new file mode 100644 index 000000000..21a1dabee --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/stderr.log @@ -0,0 +1,4 @@ +error: multiple possible binary sources found: + main.rs + case.rs +cannot automatically generate Cargo.toml as the main target would be ambiguous diff --git a/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/multibin_project_name_clash/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/no_filename/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/no_filename/mod.rs new file mode 100644 index 000000000..8edfd2823 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/no_filename/mod.rs @@ -0,0 +1,16 @@ +use cargo_test_support::paths; +use cargo_test_support::prelude::*; + +use cargo_test_support::curr_dir; + +#[cfg(not(windows))] +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg_line("init /") + .current_dir(paths::root()) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/no_filename/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/no_filename/stderr.log new file mode 100644 index 000000000..bd087ec90 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/no_filename/stderr.log @@ -0,0 +1 @@ +error: cannot auto-detect package name from path "/" ; use --name to override diff --git a/src/tools/cargo/tests/testsuite/cargo_init/no_filename/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/no_filename/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/in/.keep b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/in/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/mod.rs new file mode 100644 index 000000000..0a12f4269 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/mod.rs @@ -0,0 +1,26 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::{t, Project}; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root().join("test:ing"); + + if !project_root.exists() { + t!(std::fs::create_dir(&project_root)); + } + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --bin --vcs none --edition 2015 --name testing") + .current_dir(project_root) + .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); + assert!(!project_root.join(".gitignore").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/out/Cargo.toml new file mode 100644 index 000000000..11465f1fc --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "testing" +version = "0.1.0" +edition = "2015" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/out/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/out/src/main.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/out/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/stderr.log new file mode 100644 index 000000000..d7947aea2 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/stderr.log @@ -0,0 +1,3 @@ +warning: the path `[ROOT]/case/test:ing/.` contains invalid PATH characters (usually `:`, `;`, or `"`) +It is recommended to use a different name to avoid problems. + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/path_contains_separator/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/in/.pijul/.keep b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/in/.pijul/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/mod.rs new file mode 100644 index 000000000..d45ba868a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib") + .current_dir(project_root) + .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); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/.ignore b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/.ignore new file mode 100644 index 000000000..4fffb2f89 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/.ignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/pijul_autodetect/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/reserved_name/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/reserved_name/mod.rs new file mode 100644 index 000000000..cc65fd0a1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/reserved_name/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::paths; +use cargo_test_support::prelude::*; +use std::fs; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project_root = &paths::root().join("test"); + fs::create_dir_all(project_root).unwrap(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init") + .current_dir(project_root) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert!(!project_root.join("Cargo.toml").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/reserved_name/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/reserved_name/stderr.log new file mode 100644 index 000000000..748971bdf --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/reserved_name/stderr.log @@ -0,0 +1,8 @@ +error: the name `test` cannot be used as a package name, it conflicts with Rust's built-in test library +If you need a package name to not match the directory name, consider using --name flag. +If you need a binary with the name "test", use a valid package name, and set the binary name to be different from the package. This can be done by setting the binary filename to `src/bin/test.rs` or change the name in Cargo.toml with: + + [[bin]] + name = "test" + path = "src/main.rs" + diff --git a/src/tools/cargo/tests/testsuite/cargo_init/reserved_name/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/reserved_name/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/in b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/in new file mode 120000 index 000000000..1202506b6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/mod.rs new file mode 100644 index 000000000..eaf0955f9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/mod.rs @@ -0,0 +1,29 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --bin --vcs none --edition 2015") + .current_dir(project_root) + .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); + assert!(!project_root.join(".gitignore").is_file()); + + snapbox::cmd::Command::cargo_ui() + .current_dir(project_root) + .arg("build") + .assert() + .success(); + assert!(project.bin("case").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/out/Cargo.toml new file mode 100644 index 000000000..a6269fdcd --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2015" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/out/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/out/src/main.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/out/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_bin/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git/in b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/in new file mode 120000 index 000000000..1202506b6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/mod.rs new file mode 100644 index 000000000..c373fe2a2 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --vcs git") + .current_dir(project_root) + .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); + assert!(project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_git/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/mod.rs new file mode 100644 index 000000000..142e86efd --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/mod.rs @@ -0,0 +1,28 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --edition 2015") + .current_dir(project_root) + .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); + assert!(project_root.join(".git").is_dir()); + + snapbox::cmd::Command::cargo_ui() + .current_dir(project_root) + .arg("build") + .assert() + .success(); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/out/Cargo.toml new file mode 100644 index 000000000..a6269fdcd --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2015" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_git_ignore_exists/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/in b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/in new file mode 120000 index 000000000..1202506b6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/mod.rs new file mode 100644 index 000000000..1d6765453 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test(requires_hg)] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --vcs hg") + .current_dir(project_root) + .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); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/mod.rs new file mode 100644 index 000000000..d45ba868a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib") + .current_dir(project_root) + .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); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/Cargo.toml new file mode 100644 index 000000000..dcdb8da2c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_hg_ignore_exists/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/in b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/in new file mode 120000 index 000000000..1202506b6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/mod.rs new file mode 100644 index 000000000..d6bae5167 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/mod.rs @@ -0,0 +1,29 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init --lib --vcs none --edition 2015") + .current_dir(project_root) + .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); + assert!(!project_root.join(".gitignore").is_file()); + + snapbox::cmd::Command::cargo_ui() + .current_dir(project_root) + .arg("build") + .assert() + .success(); + assert!(!project.bin("foo").is_file()); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/out/Cargo.toml new file mode 100644 index 000000000..a6269fdcd --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/out/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "case" +version = "0.1.0" +edition = "2015" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/out/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/out/src/lib.rs new file mode 100644 index 000000000..7d12d9af8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/out/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/stderr.log new file mode 100644 index 000000000..f459bf226 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/stderr.log @@ -0,0 +1 @@ + Created library package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/simple_lib/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/mod.rs new file mode 100644 index 000000000..4289b4b9e --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/mod.rs @@ -0,0 +1,15 @@ +use cargo_test_support::paths; +use cargo_test_support::prelude::*; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg_line("init foo --flag") + .current_dir(paths::root()) + .assert() + .code(1) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/stderr.log new file mode 100644 index 000000000..980e8acd8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/stderr.log @@ -0,0 +1,7 @@ +error: unexpected argument '--flag' found + + tip: to pass '--flag' as a value, use '-- --flag' + +Usage: cargo[EXE] init + +For more information, try '--help'. diff --git a/src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/unknown_flags/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/with_argument/in/foo/.keep b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/in/foo/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_init/with_argument/mod.rs b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/mod.rs new file mode 100644 index 000000000..0b5e342a1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo_ui() + .arg_line("init foo --vcs none") + .current_dir(project_root) + .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/src/tools/cargo/tests/testsuite/cargo_init/with_argument/out/foo/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/out/foo/Cargo.toml new file mode 100644 index 000000000..1d9cfe317 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/out/foo/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "foo" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/cargo/tests/testsuite/cargo_init/with_argument/out/foo/src/main.rs b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/out/foo/src/main.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/out/foo/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_init/with_argument/stderr.log b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/stderr.log new file mode 100644 index 000000000..3847e4e4a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/stderr.log @@ -0,0 +1 @@ + Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/cargo_init/with_argument/stdout.log b/src/tools/cargo/tests/testsuite/cargo_init/with_argument/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_install/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_install/help/mod.rs new file mode 100644 index 000000000..a2c1c724b --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_install/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("install") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_install/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_install/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_install/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_install/help/stdout.log new file mode 100644 index 000000000..a07fa47f6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_install/help/stdout.log @@ -0,0 +1,56 @@ +Install a Rust binary. Default location is $HOME/.cargo/bin + +Usage: cargo[EXE] install [OPTIONS] [crate]... + +Arguments: + [crate]... + +Options: + --version Specify a version to install + --index Registry index to install from + --registry Registry to use + --git Git URL to install the specified crate from + --branch Branch to use when installing from git + --tag Tag to use when installing from git + --rev Specific commit to use when installing from git + --path Filesystem path to local crate to install + --root Directory to install packages into + -f, --force Force overwriting existing crates or binaries + --no-track Do not save tracking information + --list list all installed packages and their versions + --ignore-rust-version Ignore `rust-version` specification in packages + --message-format Error format + -q, --quiet Do not print cargo log messages + --debug Build in debug mode (with the 'dev' profile) instead of release mode + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Target Selection: + --bin [] Install only the specified binary + --bins Install all binaries + --example [] Install only the specified example + --examples Install all examples + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + --profile Install artifacts with the specified profile + --target Build for the target triple + --target-dir Directory for all generated artifacts + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help install` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_install/mod.rs b/src/tools/cargo/tests/testsuite/cargo_install/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_install/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_locate_project/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_locate_project/help/mod.rs new file mode 100644 index 000000000..f6b7e8eaf --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_locate_project/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("locate-project") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_locate_project/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_locate_project/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_locate_project/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_locate_project/help/stdout.log new file mode 100644 index 000000000..1c6ea7b25 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_locate_project/help/stdout.log @@ -0,0 +1,22 @@ +Print a JSON representation of a Cargo.toml file's location + +Usage: cargo[EXE] locate-project [OPTIONS] + +Options: + --workspace Locate Cargo.toml of the workspace root + --message-format Output representation [possible values: json, plain] + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help locate-project` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_locate_project/mod.rs b/src/tools/cargo/tests/testsuite/cargo_locate_project/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_locate_project/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_login/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_login/help/mod.rs new file mode 100644 index 000000000..86b95da15 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_login/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("login") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_login/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_login/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_login/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_login/help/stdout.log new file mode 100644 index 000000000..faec55c18 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_login/help/stdout.log @@ -0,0 +1,23 @@ +Log in to a registry. + +Usage: cargo[EXE] login [OPTIONS] [token] [-- [args]...] + +Arguments: + [token] + [args]... Arguments for the credential provider (unstable) + +Options: + --registry Registry to use + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help login` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_login/mod.rs b/src/tools/cargo/tests/testsuite/cargo_login/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_login/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_logout/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_logout/help/mod.rs new file mode 100644 index 000000000..f895b60dd --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_logout/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("logout") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_logout/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_logout/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_logout/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_logout/help/stdout.log new file mode 100644 index 000000000..fe328d765 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_logout/help/stdout.log @@ -0,0 +1,19 @@ +Remove an API token from the registry locally + +Usage: cargo[EXE] logout [OPTIONS] + +Options: + --registry Registry to use + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help logout` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_logout/mod.rs b/src/tools/cargo/tests/testsuite/cargo_logout/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_logout/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_metadata/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_metadata/help/mod.rs new file mode 100644 index 000000000..a88c374fe --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_metadata/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("metadata") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_metadata/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_metadata/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_metadata/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_metadata/help/stdout.log new file mode 100644 index 000000000..939fc40c9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_metadata/help/stdout.log @@ -0,0 +1,30 @@ +Output the resolved dependencies of a package, the concrete used versions including overrides, in +machine-readable format + +Usage: cargo[EXE] metadata [OPTIONS] + +Options: + --filter-platform Only include resolve dependencies matching the given target-triple + --no-deps Output information only about the workspace members and don't + fetch dependencies + --format-version Format version [possible values: 1] + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help metadata` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_metadata/mod.rs b/src/tools/cargo/tests/testsuite/cargo_metadata/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_metadata/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_new/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_new/help/mod.rs new file mode 100644 index 000000000..6a1721deb --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_new/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("new") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_new/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_new/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_new/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_new/help/stdout.log new file mode 100644 index 000000000..7252e0da1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_new/help/stdout.log @@ -0,0 +1,31 @@ +Create a new cargo package at + +Usage: cargo[EXE] new [OPTIONS] + +Arguments: + + +Options: + --vcs Initialize a new repository for the given version control system (git, + hg, pijul, or fossil) or do not initialize any version control at all + (none), overriding a global configuration. [possible values: git, hg, + pijul, fossil, none] + --bin Use a binary (application) template [default] + --lib Use a library template + --edition Edition to set for the crate generated [possible values: 2015, 2018, + 2021] + --name Set the resulting package name, defaults to the directory name + --registry Registry to use + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help new` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_new/mod.rs b/src/tools/cargo/tests/testsuite/cargo_new/mod.rs index e895cf883..887316395 100644 --- a/src/tools/cargo/tests/testsuite/cargo_new/mod.rs +++ b/src/tools/cargo/tests/testsuite/cargo_new/mod.rs @@ -1,3 +1,4 @@ +mod help; mod inherit_workspace_lints; mod inherit_workspace_package_table; mod inherit_workspace_package_table_with_edition; diff --git a/src/tools/cargo/tests/testsuite/cargo_owner/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_owner/help/mod.rs new file mode 100644 index 000000000..20583e5b1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_owner/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("owner") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_owner/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_owner/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_owner/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_owner/help/stdout.log new file mode 100644 index 000000000..3c8495ff0 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_owner/help/stdout.log @@ -0,0 +1,27 @@ +Manage the owners of a crate on the registry + +Usage: cargo[EXE] owner [OPTIONS] [crate] + +Arguments: + [crate] + +Options: + -a, --add Name of a user or team to invite as an owner + -r, --remove Name of a user or team to remove as an owner + -l, --list List owners of a crate + --index Registry index to modify owners for + --token API token to use when authenticating + --registry Registry to use + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help owner` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_owner/mod.rs b/src/tools/cargo/tests/testsuite/cargo_owner/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_owner/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_package/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_package/help/mod.rs new file mode 100644 index 000000000..4e2f28e4f --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_package/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("package") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_package/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_package/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_package/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_package/help/stdout.log new file mode 100644 index 000000000..35e32f313 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_package/help/stdout.log @@ -0,0 +1,39 @@ +Assemble the local package into a distributable tarball + +Usage: cargo[EXE] package [OPTIONS] + +Options: + -l, --list Print files included in a package without making one + --no-verify Don't verify the contents by building them + --no-metadata Ignore warnings about a lack of human-usable metadata + --allow-dirty Allow dirty working directories to be packaged + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Package Selection: + -p, --package [] Package(s) to assemble + --workspace Assemble all packages in the workspace + --exclude Don't assemble specified packages + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + --target Build for the target triple + --target-dir Directory for all generated artifacts + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help package` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_package/mod.rs b/src/tools/cargo/tests/testsuite/cargo_package/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_package/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_pkgid/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_pkgid/help/mod.rs new file mode 100644 index 000000000..6d182d116 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_pkgid/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("pkgid") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_pkgid/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_pkgid/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_pkgid/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_pkgid/help/stdout.log new file mode 100644 index 000000000..ed48bb7ea --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_pkgid/help/stdout.log @@ -0,0 +1,25 @@ +Print a fully qualified package specification + +Usage: cargo[EXE] pkgid [OPTIONS] [spec] + +Arguments: + [spec] + +Options: + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Package Selection: + -p, --package [] Argument to get the package ID specifier for + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help pkgid` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_pkgid/mod.rs b/src/tools/cargo/tests/testsuite/cargo_pkgid/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_pkgid/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_publish/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_publish/help/mod.rs new file mode 100644 index 000000000..183b6aac4 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_publish/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("publish") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_publish/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_publish/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_publish/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_publish/help/stdout.log new file mode 100644 index 000000000..c02522887 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_publish/help/stdout.log @@ -0,0 +1,39 @@ +Upload a package to the registry + +Usage: cargo[EXE] publish [OPTIONS] + +Options: + --dry-run Perform all checks without uploading + --index Registry index URL to upload the package to + --registry Registry to publish to + --token Token to use when uploading + --no-verify Don't verify the contents by building them + --allow-dirty Allow dirty working directories to be packaged + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Package Selection: + -p, --package [] Package to publish + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + --target Build for the target triple + --target-dir Directory for all generated artifacts + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help publish` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_publish/mod.rs b/src/tools/cargo/tests/testsuite/cargo_publish/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_publish/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_read_manifest/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_read_manifest/help/mod.rs new file mode 100644 index 000000000..d0055f6d8 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_read_manifest/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("read-manifest") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_read_manifest/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_read_manifest/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_read_manifest/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_read_manifest/help/stdout.log new file mode 100644 index 000000000..83db5413d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_read_manifest/help/stdout.log @@ -0,0 +1,19 @@ +Print a JSON representation of a Cargo.toml manifest. + +Deprecated, use `cargo metadata --no-deps` instead. + +Usage: cargo[EXE] read-manifest [OPTIONS] + +Options: + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network diff --git a/src/tools/cargo/tests/testsuite/cargo_read_manifest/mod.rs b/src/tools/cargo/tests/testsuite/cargo_read_manifest/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_read_manifest/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log index dd71023a8..486ef359f 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/avoid_empty_tables/stderr.log @@ -1,2 +1 @@ Removing clippy from dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/build/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/build/stderr.log index f037ebe28..a51bea48c 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/build/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/build/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/dev/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/dev/stderr.log index c629b26b1..ccabdb193 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/dev/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/dev/stderr.log @@ -1,2 +1 @@ Removing regex from dev-dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/Cargo.toml new file mode 100644 index 000000000..28b028417 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/Cargo.toml @@ -0,0 +1,8 @@ +# Cargo.toml + +[workspace] +members = ["serde", "serde_derive"] + +[patch.crates-io] +serde = { path = "serde" } + diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde/Cargo.toml new file mode 100644 index 000000000..c05589aba --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde/Cargo.toml @@ -0,0 +1,9 @@ +# serde/Cargo.toml + +[package] +name = "serde" +version = "1.0.0" + +[dependencies] +serde_derive = { path = "../serde_derive" } + diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde/src/lib.rs new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde_derive/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde_derive/Cargo.toml new file mode 100644 index 000000000..2b9b48b50 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde_derive/Cargo.toml @@ -0,0 +1,8 @@ +# serde_derive/Cargo.toml + +[package] +name = "serde_derive" +version = "1.0.0" + +[dev-dependencies] +serde_json = "1.0.0" diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde_derive/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde_derive/src/lib.rs new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/mod.rs b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/mod.rs new file mode 100644 index 000000000..f66478c5d --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/mod.rs @@ -0,0 +1,27 @@ +use cargo_test_support::compare::assert_ui; +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +#[cargo_test] +fn case() { + cargo_test_support::registry::init(); + cargo_test_support::registry::Package::new("serde", "1.0.0").publish(); + cargo_test_support::registry::Package::new("serde_json", "1.0.0") + .dep("serde", "1.0.0") + .publish(); + + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + + snapbox::cmd::Command::cargo_ui() + .current_dir(&project_root) + .arg("remove") + .args(["--package", "serde", "serde_derive"]) + .assert() + .code(0) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert_ui().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/Cargo.toml new file mode 100644 index 000000000..28b028417 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/Cargo.toml @@ -0,0 +1,8 @@ +# Cargo.toml + +[workspace] +members = ["serde", "serde_derive"] + +[patch.crates-io] +serde = { path = "serde" } + diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde/Cargo.toml new file mode 100644 index 000000000..a91d8ebd5 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde/Cargo.toml @@ -0,0 +1,6 @@ +# serde/Cargo.toml + +[package] +name = "serde" +version = "1.0.0" + diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde/src/lib.rs new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde_derive/Cargo.toml b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde_derive/Cargo.toml new file mode 100644 index 000000000..2b9b48b50 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde_derive/Cargo.toml @@ -0,0 +1,8 @@ +# serde_derive/Cargo.toml + +[package] +name = "serde_derive" +version = "1.0.0" + +[dev-dependencies] +serde_json = "1.0.0" diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde_derive/src/lib.rs b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde_derive/src/lib.rs new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/stderr.log new file mode 100644 index 000000000..b4377b3a4 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/stderr.log @@ -0,0 +1 @@ + Removing serde_derive from dependencies diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/stdout.log b/src/tools/cargo/tests/testsuite/cargo_remove/gc_keep_used_patch/stdout.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/mod.rs b/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/mod.rs index ec521a5bb..d4d305323 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/mod.rs +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/mod.rs @@ -23,6 +23,13 @@ fn case() { }) .url(); + let git_project3 = git::new("bar3", |project| { + project + .file("Cargo.toml", &basic_manifest("bar", "0.1.0")) + .file("src/lib.rs", "") + }) + .url(); + let in_project = project() .file( "Cargo.toml", @@ -38,7 +45,7 @@ fn case() { bar = {{ git = \"{git_project1}\" }}\n\ \n\ [patch.\"{git_project1}\"]\n\ - bar = {{ git = \"{git_project2}\" }}\n\ + bar = {{ git = \"{git_project3}\" }}\n\ \n\ [patch.crates-io]\n\ bar = {{ git = \"{git_project2}\" }}\n", diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/out/Cargo.lock b/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/out/Cargo.lock new file mode 100644 index 000000000..4a1467ba1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/out/Cargo.lock @@ -0,0 +1,19 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bar" +version = "0.1.0" +source = "git+[..]" + +[[package]] +name = "my-member" +version = "0.1.0" +dependencies = [ + "bar", +] + +[[package]] +name = "my-project" +version = "0.1.0" diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/stderr.log index 1dd2e7757..ba519ba1b 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_patch/stderr.log @@ -1,3 +1 @@ Removing bar from dependencies - Updating git repository `[ROOTURL]/bar2` - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_profile/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/gc_profile/stderr.log index 0e2e38f26..9dee9e2b7 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/gc_profile/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_profile/stderr.log @@ -1,2 +1 @@ Removing toml from dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/gc_replace/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/gc_replace/stderr.log index 0e2e38f26..9dee9e2b7 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/gc_replace/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/gc_replace/stderr.log @@ -1,2 +1 @@ Removing toml from dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_remove/help/mod.rs new file mode 100644 index 000000000..69fb60f03 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("remove") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_remove/help/stdout.log new file mode 100644 index 000000000..81a2d78b6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_remove/help/stdout.log @@ -0,0 +1,29 @@ +Remove dependencies from a Cargo.toml manifest file + +Usage: cargo[EXE] remove [OPTIONS] ... + +Arguments: + ... Dependencies to be removed + +Options: + --dry-run Don't actually write the manifest + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Section: + --dev Remove as development dependency + --build Remove as build dependency + --target Remove as dependency from the given target platform + +Package Selection: + -p, --package [] Package to remove from + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/mod.rs b/src/tools/cargo/tests/testsuite/cargo_remove/mod.rs index feb08cea4..ea7902bd8 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/mod.rs +++ b/src/tools/cargo/tests/testsuite/cargo_remove/mod.rs @@ -2,9 +2,11 @@ mod avoid_empty_tables; mod build; mod dev; mod dry_run; +mod gc_keep_used_patch; mod gc_patch; mod gc_profile; mod gc_replace; +mod help; mod invalid_arg; mod invalid_dep; mod invalid_package; diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/multiple_deps/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/multiple_deps/stderr.log index 1eb59aca1..111b1e94a 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/multiple_deps/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/multiple_deps/stderr.log @@ -1,3 +1,2 @@ Removing docopt from dependencies Removing semver from dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/multiple_dev/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/multiple_dev/stderr.log index a3042dcc3..8a69c94f5 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/multiple_dev/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/multiple_dev/stderr.log @@ -1,3 +1,2 @@ Removing regex from dev-dependencies Removing serde from dev-dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log index 72c9f9217..d3656ec54 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/optional_dep_feature/stderr.log @@ -1,2 +1 @@ Removing serde from dev-dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/optional_feature/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/optional_feature/stderr.log index 2dc546fa7..ef7354ef1 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/optional_feature/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/optional_feature/stderr.log @@ -1,2 +1 @@ Removing semver from dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/package/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/package/stderr.log index 231026f2b..7083976b1 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/package/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/package/stderr.log @@ -1,2 +1 @@ Removing docopt from dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/remove_basic/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/remove_basic/stderr.log index 231026f2b..7083976b1 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/remove_basic/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/remove_basic/stderr.log @@ -1,2 +1 @@ Removing docopt from dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/target/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/target/stderr.log index 810abd994..8fb1b5000 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/target/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/target/stderr.log @@ -1,2 +1 @@ Removing dbus from dependencies for target `x86_64-unknown-linux-gnu` - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/target_build/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/target_build/stderr.log index b06f8f319..673a47ceb 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/target_build/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/target_build/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies for target `x86_64-unknown-linux-gnu` - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/target_dev/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/target_dev/stderr.log index 68553a3bd..854aff44a 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/target_dev/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/target_dev/stderr.log @@ -1,2 +1 @@ Removing ncurses from dev-dependencies for target `x86_64-unknown-linux-gnu` - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/update_lock_file/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/update_lock_file/stderr.log index 164f8f4b9..1494b0fc5 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/update_lock_file/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/update_lock_file/stderr.log @@ -1,2 +1 @@ Removing rustc-serialize from dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/workspace/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/workspace/stderr.log index f037ebe28..a51bea48c 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/workspace/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/workspace/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log index f037ebe28..a51bea48c 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_remove/workspace_preserved/stderr.log b/src/tools/cargo/tests/testsuite/cargo_remove/workspace_preserved/stderr.log index f037ebe28..a51bea48c 100644 --- a/src/tools/cargo/tests/testsuite/cargo_remove/workspace_preserved/stderr.log +++ b/src/tools/cargo/tests/testsuite/cargo_remove/workspace_preserved/stderr.log @@ -1,2 +1 @@ Removing semver from build-dependencies - Updating `dummy-registry` index diff --git a/src/tools/cargo/tests/testsuite/cargo_report/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_report/help/mod.rs new file mode 100644 index 000000000..3d2975769 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_report/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("report") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_report/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_report/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_report/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_report/help/stdout.log new file mode 100644 index 000000000..67819de55 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_report/help/stdout.log @@ -0,0 +1,20 @@ +Generate and display various kinds of reports + +Usage: cargo[EXE] report [OPTIONS] + +Commands: + future-incompatibilities Reports any crates which will eventually stop compiling + +Options: + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help report` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_report/mod.rs b/src/tools/cargo/tests/testsuite/cargo_report/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_report/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_run/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_run/help/mod.rs new file mode 100644 index 000000000..0a8a6bde0 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_run/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("run") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_run/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_run/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_run/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_run/help/stdout.log new file mode 100644 index 000000000..6ab0e76b1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_run/help/stdout.log @@ -0,0 +1,47 @@ +Run a binary or example of the local package + +Usage: cargo[EXE] run [OPTIONS] [args]... + +Arguments: + [args]... Arguments for the binary or example to run + +Options: + --ignore-rust-version Ignore `rust-version` specification in packages + --message-format Error format + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package with the target to run + +Target Selection: + --bin [] Name of the bin target to run + --example [] Name of the example target to run + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + -r, --release Build artifacts in release mode, with optimizations + --profile Build artifacts with the specified profile + --target Build for the target triple + --target-dir Directory for all generated artifacts + --unit-graph Output build graph in JSON (unstable) + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help run` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_run/mod.rs b/src/tools/cargo/tests/testsuite/cargo_run/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_run/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_rustc/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_rustc/help/mod.rs new file mode 100644 index 000000000..0a3b31686 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_rustc/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("rustc") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_rustc/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_rustc/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_rustc/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_rustc/help/stdout.log new file mode 100644 index 000000000..f587c3276 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_rustc/help/stdout.log @@ -0,0 +1,58 @@ +Compile a package, and pass extra options to the compiler + +Usage: cargo[EXE] rustc [OPTIONS] [args]... + +Arguments: + [args]... Extra rustc flags + +Options: + --print Output compiler information without compiling + --crate-type Comma separated list of types of crates for the compiler to emit + --future-incompat-report Outputs a future incompatibility report at the end of the build + --ignore-rust-version Ignore `rust-version` specification in packages + --message-format Error format + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package to build + +Target Selection: + --lib Build only this package's library + --bins Build all binaries + --bin [] Build only the specified binary + --examples Build all examples + --example [] Build only the specified example + --tests Build all tests + --test [] Build only the specified test target + --benches Build all benches + --bench [] Build only the specified bench target + --all-targets Build all targets + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + -r, --release Build artifacts in release mode, with optimizations + --profile Build artifacts with the specified profile + --target Target triple which compiles will be for + --target-dir Directory for all generated artifacts + --unit-graph Output build graph in JSON (unstable) + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help rustc` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_rustc/mod.rs b/src/tools/cargo/tests/testsuite/cargo_rustc/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_rustc/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_rustdoc/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_rustdoc/help/mod.rs new file mode 100644 index 000000000..88652749f --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_rustdoc/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("rustdoc") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_rustdoc/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_rustdoc/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_rustdoc/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_rustdoc/help/stdout.log new file mode 100644 index 000000000..4cac29e0a --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_rustdoc/help/stdout.log @@ -0,0 +1,56 @@ +Build a package's documentation, using specified custom flags. + +Usage: cargo[EXE] rustdoc [OPTIONS] [args]... + +Arguments: + [args]... Extra rustdoc flags + +Options: + --open Opens the docs in a browser after the operation + --ignore-rust-version Ignore `rust-version` specification in packages + --message-format Error format + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package to document + +Target Selection: + --lib Build only this package's library + --bins Build all binaries + --bin [] Build only the specified binary + --examples Build all examples + --example [] Build only the specified example + --tests Build all tests + --test [] Build only the specified test target + --benches Build all benches + --bench [] Build only the specified bench target + --all-targets Build all targets + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + --keep-going Do not abort the build as soon as there is an error (unstable) + -r, --release Build artifacts in release mode, with optimizations + --profile Build artifacts with the specified profile + --target Build for the target triple + --target-dir Directory for all generated artifacts + --unit-graph Output build graph in JSON (unstable) + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help rustdoc` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_rustdoc/mod.rs b/src/tools/cargo/tests/testsuite/cargo_rustdoc/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_rustdoc/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_search/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_search/help/mod.rs new file mode 100644 index 000000000..b580816e7 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_search/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("search") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_search/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_search/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_search/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_search/help/stdout.log new file mode 100644 index 000000000..8572064e3 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_search/help/stdout.log @@ -0,0 +1,24 @@ +Search packages in crates.io + +Usage: cargo[EXE] search [OPTIONS] [query]... + +Arguments: + [query]... + +Options: + --limit Limit the number of results (default: 10, max: 100) + --index Registry index URL to upload the package to + --registry Registry to use + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help search` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_search/mod.rs b/src/tools/cargo/tests/testsuite/cargo_search/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_search/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_test/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_test/help/mod.rs new file mode 100644 index 000000000..ae5b092b7 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_test/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("test") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_test/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_test/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_test/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_test/help/stdout.log new file mode 100644 index 000000000..d693dc3c9 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_test/help/stdout.log @@ -0,0 +1,63 @@ +Execute all unit and integration tests and build examples of a local package + +Usage: cargo[EXE] test [OPTIONS] [TESTNAME] [-- [args]...] + +Arguments: + [TESTNAME] If specified, only run tests containing this string in their names + [args]... Arguments for the test binary + +Options: + --doc Test only this library's documentation + --no-run Compile, but don't run tests + --no-fail-fast Run all tests regardless of failure + --ignore-rust-version Ignore `rust-version` specification in packages + --future-incompat-report Outputs a future incompatibility report at the end of the build + --message-format Error format + -q, --quiet Display one character per test instead of one line + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Package Selection: + -p, --package [] Package to run tests for + --workspace Test all packages in the workspace + --exclude Exclude packages from the test + --all Alias for --workspace (deprecated) + +Target Selection: + --lib Test only this package's library unit tests + --bins Test all binaries + --bin [] Test only the specified binary + --examples Test all examples + --example [] Test only the specified example + --tests Test all tests + --test [] Test only the specified test target + --benches Test all benches + --bench [] Test only the specified bench target + --all-targets Test all targets (does not include doctests) + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + -j, --jobs Number of parallel jobs, defaults to # of CPUs. + -r, --release Build artifacts in release mode, with optimizations + --profile Build artifacts with the specified profile + --target Build for the target triple + --target-dir Directory for all generated artifacts + --unit-graph Output build graph in JSON (unstable) + --timings[=] Timing output formats (unstable) (comma separated): html, json + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help test` for more detailed information. +Run `cargo test -- --help` for test binary options. diff --git a/src/tools/cargo/tests/testsuite/cargo_test/mod.rs b/src/tools/cargo/tests/testsuite/cargo_test/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_test/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_tree/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_tree/help/mod.rs new file mode 100644 index 000000000..269ac2cdc --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_tree/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("tree") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_tree/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_tree/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_tree/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_tree/help/stdout.log new file mode 100644 index 000000000..268b6b2ad --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_tree/help/stdout.log @@ -0,0 +1,45 @@ +Display a tree visualization of a dependency graph + +Usage: cargo[EXE] tree [OPTIONS] + +Options: + -q, --quiet Do not print cargo log messages + -e, --edges The kinds of dependencies to display (features, normal, build, dev, all, + no-normal, no-build, no-dev, no-proc-macro) + -i, --invert [] Invert the tree direction and focus on the given package + --prune Prune the given package from the display of the dependency tree + --depth Maximum display depth of the dependency tree + --prefix Change the prefix (indentation) of how each entry is displayed [default: + indent] [possible values: depth, indent, none] + --no-dedupe Do not de-duplicate (repeats all shared dependencies) + -d, --duplicates Show only dependencies which come in multiple versions (implies -i) + --charset Character set to use in output [default: utf8] [possible values: utf8, + ascii] + -f, --format Format string used for printing dependencies [default: {p}] + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Package Selection: + -p, --package [] Package to be used as the root of the tree + --workspace Display the tree for all packages in the workspace + --exclude Exclude specific workspace members + +Feature Selection: + -F, --features Space or comma separated list of features to activate + --all-features Activate all available features + --no-default-features Do not activate the `default` feature + +Compilation Options: + --target Filter dependencies matching the given target-triple (default host + platform). Pass `all` to include all targets. + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help tree` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_tree/mod.rs b/src/tools/cargo/tests/testsuite/cargo_tree/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_tree/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_uninstall/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_uninstall/help/mod.rs new file mode 100644 index 000000000..60c4faed0 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_uninstall/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("uninstall") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_uninstall/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_uninstall/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_uninstall/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_uninstall/help/stdout.log new file mode 100644 index 000000000..2da1a5d57 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_uninstall/help/stdout.log @@ -0,0 +1,28 @@ +Remove a Rust binary + +Usage: cargo[EXE] uninstall [OPTIONS] [spec]... + +Arguments: + [spec]... + +Options: + --root Directory to uninstall packages from + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Package Selection: + -p, --package [] Package to uninstall + +Target Selection: + --bin Only uninstall the binary NAME + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help uninstall` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_uninstall/mod.rs b/src/tools/cargo/tests/testsuite/cargo_uninstall/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_uninstall/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_update/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_update/help/mod.rs new file mode 100644 index 000000000..ae310977c --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_update/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("update") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_update/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_update/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_update/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_update/help/stdout.log new file mode 100644 index 000000000..6cc109151 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_update/help/stdout.log @@ -0,0 +1,26 @@ +Update dependencies as recorded in the local lock file + +Usage: cargo[EXE] update [OPTIONS] + +Options: + --dry-run Don't actually write the lockfile + --aggressive Force updating all dependencies of SPEC as well when used with -p + --precise Update a single dependency to exactly PRECISE when used with -p + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Package Selection: + -w, --workspace Only update the workspace packages + -p, --package [] Package to update + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help update` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_update/mod.rs b/src/tools/cargo/tests/testsuite/cargo_update/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_update/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_vendor/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_vendor/help/mod.rs new file mode 100644 index 000000000..c111b99c0 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_vendor/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("vendor") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_vendor/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_vendor/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_vendor/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_vendor/help/stdout.log new file mode 100644 index 000000000..7f37ab56e --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_vendor/help/stdout.log @@ -0,0 +1,27 @@ +Vendor all dependencies for a project locally + +Usage: cargo[EXE] vendor [OPTIONS] [path] + +Arguments: + [path] Where to vendor crates (`vendor` by default) + +Options: + --no-delete Don't delete older crates in the vendor directory + -s, --sync Additional `Cargo.toml` to sync and vendor + --respect-source-config Respect `[source]` config in `.cargo/config` + --versioned-dirs Always include version in subdir name + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for + details + -h, --help Print help + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help vendor` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_vendor/mod.rs b/src/tools/cargo/tests/testsuite/cargo_vendor/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_vendor/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_verify_project/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_verify_project/help/mod.rs new file mode 100644 index 000000000..8f6c9bab1 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_verify_project/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("verify-project") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_verify_project/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_verify_project/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_verify_project/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_verify_project/help/stdout.log new file mode 100644 index 000000000..a61534500 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_verify_project/help/stdout.log @@ -0,0 +1,19 @@ +Check correctness of crate manifest + +Usage: cargo[EXE] verify-project [OPTIONS] + +Options: + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --manifest-path Path to Cargo.toml + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help verify-project` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_verify_project/mod.rs b/src/tools/cargo/tests/testsuite/cargo_verify_project/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_verify_project/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_version/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_version/help/mod.rs new file mode 100644 index 000000000..daa8548c6 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_version/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("version") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_version/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_version/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_version/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_version/help/stdout.log new file mode 100644 index 000000000..3f79051ad --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_version/help/stdout.log @@ -0,0 +1,18 @@ +Show version information + +Usage: cargo[EXE] version [OPTIONS] + +Options: + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help version` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_version/mod.rs b/src/tools/cargo/tests/testsuite/cargo_version/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_version/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/cargo_yank/help/mod.rs b/src/tools/cargo/tests/testsuite/cargo_yank/help/mod.rs new file mode 100644 index 000000000..12034f152 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_yank/help/mod.rs @@ -0,0 +1,13 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::prelude::*; + +#[cargo_test] +fn case() { + snapbox::cmd::Command::cargo_ui() + .arg("yank") + .arg("--help") + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/src/tools/cargo/tests/testsuite/cargo_yank/help/stderr.log b/src/tools/cargo/tests/testsuite/cargo_yank/help/stderr.log new file mode 100644 index 000000000..e69de29bb diff --git a/src/tools/cargo/tests/testsuite/cargo_yank/help/stdout.log b/src/tools/cargo/tests/testsuite/cargo_yank/help/stdout.log new file mode 100644 index 000000000..25b04e6c7 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_yank/help/stdout.log @@ -0,0 +1,26 @@ +Remove a pushed crate from the index + +Usage: cargo[EXE] yank [OPTIONS] [crate] + +Arguments: + [crate] + +Options: + --version The version to yank or un-yank + --undo Undo a yank, putting a version back into the index + --index Registry index to yank from + --registry Registry to use + --token API token to use when authenticating + -q, --quiet Do not print cargo log messages + -v, --verbose... Use verbose output (-vv very verbose/build.rs output) + --color Coloring: auto, always, never + --config Override a configuration value + -Z Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details + -h, --help Print help + +Manifest Options: + --frozen Require Cargo.lock and cache are up to date + --locked Require Cargo.lock is up to date + --offline Run without accessing the network + +Run `cargo help yank` for more detailed information. diff --git a/src/tools/cargo/tests/testsuite/cargo_yank/mod.rs b/src/tools/cargo/tests/testsuite/cargo_yank/mod.rs new file mode 100644 index 000000000..c0ce11180 --- /dev/null +++ b/src/tools/cargo/tests/testsuite/cargo_yank/mod.rs @@ -0,0 +1 @@ +mod help; diff --git a/src/tools/cargo/tests/testsuite/credential_process.rs b/src/tools/cargo/tests/testsuite/credential_process.rs index 8c202c6a3..c010c01cd 100644 --- a/src/tools/cargo/tests/testsuite/credential_process.rs +++ b/src/tools/cargo/tests/testsuite/credential_process.rs @@ -1,8 +1,7 @@ //! Tests for credential-process. -use cargo_test_support::registry::TestRegistry; +use cargo_test_support::registry::{Package, TestRegistry}; use cargo_test_support::{basic_manifest, cargo_process, paths, project, registry, Project}; -use std::fs::{self, read_to_string}; fn toml_bin(proj: &Project, name: &str) -> String { proj.bin(name).display().to_string().replace('\\', "\\\\") @@ -24,7 +23,7 @@ fn gated() { ".cargo/config", r#" [registry] - credential-process = "false" + credential-provider = ["false"] "#, ) .file("Cargo.toml", &basic_manifest("foo", "1.0.0")) @@ -65,80 +64,6 @@ or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN .run(); } -#[cargo_test] -fn warn_both_token_and_process() { - // Specifying both credential-process and a token in config should issue a warning. - let _server = registry::RegistryBuilder::new() - .http_api() - .http_index() - .alternative() - .no_configure_token() - .build(); - let p = project() - .file( - ".cargo/config", - r#" - [registries.alternative] - token = "alternative-sekrit" - credential-process = "false" - "#, - ) - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.1.0" - description = "foo" - authors = [] - license = "MIT" - homepage = "https://example.com/" - "#, - ) - .file("src/lib.rs", "") - .build(); - - p.cargo("publish --no-verify --registry alternative -Z credential-process") - .masquerade_as_nightly_cargo(&["credential-process"]) - .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[ERROR] both `token` and `credential-process` were specified in the config for registry `alternative`. -Only one of these values may be set, remove one or the other to proceed. -", - ) - .run(); - - // Try with global credential-process, and registry-specific `token`. - // This should silently use the config token, and not run the "false" exe. - p.change_file( - ".cargo/config", - r#" - [registry] - credential-process = "false" - - [registries.alternative] - token = "alternative-sekrit" - "#, - ); - p.cargo("publish --no-verify --registry alternative -Z credential-process") - .masquerade_as_nightly_cargo(&["credential-process"]) - .with_stderr( - "\ -[UPDATING] [..] -[PACKAGING] foo v0.1.0 [..] -[PACKAGED] [..] -[UPLOADING] foo v0.1.0 [..] -[UPLOADED] foo v0.1.0 [..] -note: Waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.1.0 [..] -", - ) - .run(); -} - /// Setup for a test that will issue a command that needs to fetch a token. /// /// This does the following: @@ -158,29 +83,14 @@ fn get_token_test() -> (Project, TestRegistry) { )) .alternative() .http_api() + .http_index() + .auth_required() .build(); - // The credential process to use. - let cred_proj = project() - .at("cred_proj") - .file("Cargo.toml", &basic_manifest("test-cred", "1.0.0")) - .file( - "src/main.rs", - r#" - use std::fs::File; - use std::io::Write; - fn main() { - let mut f = File::options() - .write(true) - .create(true) - .append(true) - .open("runs.log") - .unwrap(); - write!(f, "+"); - println!("sekrit"); - } "#, - ) - .build(); - cred_proj.cargo("build").run(); + + let provider = build_provider( + "test-cred", + r#"{"Ok":{"kind":"get","token":"sekrit","cache":"session","operation_independent":false}}"#, + ); let p = project() .file( @@ -189,10 +99,9 @@ fn get_token_test() -> (Project, TestRegistry) { r#" [registries.alternative] index = "{}" - credential-process = ["{}"] + credential-provider = ["{provider}"] "#, server.index_url(), - toml_bin(&cred_proj, "test-cred") ), ) .file( @@ -202,7 +111,6 @@ fn get_token_test() -> (Project, TestRegistry) { name = "foo" version = "0.1.0" description = "foo" - authors = [] license = "MIT" homepage = "https://example.com/" "#, @@ -217,24 +125,22 @@ fn publish() { // Checks that credential-process is used for `cargo publish`. let (p, _t) = get_token_test(); - p.cargo("publish --no-verify --registry alternative -Z credential-process") + p.cargo("publish --no-verify --registry alternative -Z credential-process -Z registry-auth") .masquerade_as_nightly_cargo(&["credential-process"]) .with_stderr( - "\ -[UPDATING] [..] + r#"[UPDATING] [..] +{"v":1,"registry":{"index-url":"[..]","name":"alternative","headers":[..]},"kind":"get","operation":"read","args":[]} [PACKAGING] foo v0.1.0 [..] [PACKAGED] [..] +{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.0","cksum":"[..]","args":[]} [UPLOADING] foo v0.1.0 [..] [UPLOADED] foo v0.1.0 [..] note: Waiting [..] You may press ctrl-c [..] [PUBLISHED] foo v0.1.0 [..] -", +"#, ) .run(); - - let calls = read_to_string(p.root().join("runs.log")).unwrap().len(); - assert_eq!(calls, 1); } #[cargo_test] @@ -242,15 +148,8 @@ fn basic_unsupported() { // Non-action commands don't support login/logout. let registry = registry::RegistryBuilder::new() .no_configure_token() + .credential_provider(&["cargo:token-from-stdout", "false"]) .build(); - cargo_util::paths::append( - &paths::home().join(".cargo/config"), - br#" - [registry] - credential-process = "false" - "#, - ) - .unwrap(); cargo_process("login -Z credential-process abcdefg") .replace_crates_io(registry.index_url()) @@ -259,9 +158,10 @@ fn basic_unsupported() { .with_stderr( "\ [UPDATING] crates.io index -[ERROR] credential process `false` cannot be used to log in, \ -the credential-process configuration value must pass the \ -`{action}` argument in the config to support this command +[ERROR] credential provider `cargo:token-from-stdout false` failed action `login` + +Caused by: + requested operation not supported ", ) .run(); @@ -272,9 +172,10 @@ the credential-process configuration value must pass the \ .with_status(101) .with_stderr( "\ -[ERROR] credential process `false` cannot be used to log out, \ -the credential-process configuration value must pass the \ -`{action}` argument in the config to support this command +[ERROR] credential provider `cargo:token-from-stdout false` failed action `logout` + +Caused by: + requested operation not supported ", ) .run(); @@ -282,222 +183,475 @@ the credential-process configuration value must pass the \ #[cargo_test] fn login() { + let registry = registry::RegistryBuilder::new() + .no_configure_token() + .credential_provider(&[ + &build_provider("test-cred", r#"{"Ok": {"kind": "login"}}"#), + "cfg1", + "--cfg2", + ]) + .build(); + + cargo_process("login -Z credential-process abcdefg -- cmd3 --cmd4") + .masquerade_as_nightly_cargo(&["credential-process"]) + .replace_crates_io(registry.index_url()) + .with_stderr( + r#"[UPDATING] [..] +{"v":1,"registry":{"index-url":"https://github.com/rust-lang/crates.io-index","name":"crates-io"},"kind":"login","token":"abcdefg","login-url":"[..]","args":["cfg1","--cfg2","cmd3","--cmd4"]} +"#, + ) + .run(); +} + +#[cargo_test] +fn logout() { let server = registry::RegistryBuilder::new() .no_configure_token() + .credential_provider(&[&build_provider( + "test-cred", + r#"{"Ok": {"kind": "logout"}}"#, + )]) .build(); - // The credential process to use. + + cargo_process("logout -Z credential-process") + .masquerade_as_nightly_cargo(&["credential-process"]) + .replace_crates_io(server.index_url()) + .with_stderr( + r#"{"v":1,"registry":{"index-url":"https://github.com/rust-lang/crates.io-index","name":"crates-io"},"kind":"logout","args":[]} +"#, + ) + .run(); +} + +#[cargo_test] +fn yank() { + let (p, _t) = get_token_test(); + + p.cargo("yank --version 0.1.0 --registry alternative -Zcredential-process -Zregistry-auth") + .masquerade_as_nightly_cargo(&["credential-process"]) + .with_stderr( + r#"[UPDATING] [..] +{"v":1,"registry":{"index-url":"[..]","name":"alternative","headers":[..]},"kind":"get","operation":"read","args":[]} +{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"yank","name":"foo","vers":"0.1.0","args":[]} +[YANK] foo@0.1.0 +"#, + ) + .run(); +} + +#[cargo_test] +fn owner() { + let (p, _t) = get_token_test(); + + p.cargo("owner --add username --registry alternative -Zcredential-process -Zregistry-auth") + .masquerade_as_nightly_cargo(&["credential-process"]) + .with_stderr( + r#"[UPDATING] [..] +{"v":1,"registry":{"index-url":"[..]","name":"alternative","headers":[..]},"kind":"get","operation":"read","args":[]} +{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"owners","name":"foo","args":[]} +[OWNER] completed! +"#, + ) + .run(); +} + +#[cargo_test] +fn invalid_token_output() { + // Error when credential process does not output the expected format for a token. let cred_proj = project() .at("cred_proj") .file("Cargo.toml", &basic_manifest("test-cred", "1.0.0")) + .file("src/main.rs", r#"fn main() { print!("a\nb\n"); } "#) + .build(); + cred_proj.cargo("build").run(); + let _server = registry::RegistryBuilder::new() + .alternative() + .credential_provider(&[ + "cargo:token-from-stdout", + &toml_bin(&cred_proj, "test-cred"), + ]) + .no_configure_token() + .build(); + + let p = project() + .file("Cargo.toml", &basic_manifest("foo", "1.0.0")) + .file("src/lib.rs", "") + .build(); + + p.cargo("publish --no-verify --registry alternative -Z credential-process") + .masquerade_as_nightly_cargo(&["credential-process"]) + .with_status(101) + .with_stderr( + "\ +[UPDATING] [..] +[ERROR] credential provider `[..]test-cred[EXE]` failed action `get` + +Caused by: + process `[..]` returned more than one line of output; expected a single token +", + ) + .run(); +} + +/// Builds a credential provider that echos the request from cargo to stderr, +/// and prints the `response` to stdout. +fn build_provider(name: &str, response: &str) -> String { + // The credential process to use. + let cred_proj = project() + .at(name) + .file("Cargo.toml", &basic_manifest(name, "1.0.0")) .file( "src/main.rs", - r#" - use std::io::Read; - - fn main() {{ - assert_eq!(std::env::var("CARGO_REGISTRY_NAME_OPT").unwrap(), "crates-io"); - assert_eq!(std::env::var("CARGO_REGISTRY_INDEX_URL").unwrap(), "https://github.com/rust-lang/crates.io-index"); - assert_eq!(std::env::args().skip(1).next().unwrap(), "store"); + &r####" + fn main() { + println!(r#"{{"v":[1]}}"#); + assert_eq!(std::env::args().skip(1).next().unwrap(), "--cargo-plugin"); let mut buffer = String::new(); - std::io::stdin().read_to_string(&mut buffer).unwrap(); - assert_eq!(buffer, "abcdefg\n"); - std::fs::write("token-store", buffer).unwrap(); - }} - "#, + std::io::stdin().read_line(&mut buffer).unwrap(); + eprint!("{}", buffer); + use std::io::Write; + std::io::stdout().write_all(r###"[RESPONSE]"###.as_bytes()).unwrap(); + println!(); + } "#### + .replace("[RESPONSE]", response), ) .build(); cred_proj.cargo("build").run(); + toml_bin(&cred_proj, name) +} +#[cargo_test] +fn all_not_found() { + let server = registry::RegistryBuilder::new() + .no_configure_token() + .auth_required() + .http_index() + .build(); + let not_found = build_provider("not_found", r#"{"Err": {"kind": "not-found"}}"#); cargo_util::paths::append( &paths::home().join(".cargo/config"), format!( r#" [registry] - credential-process = ["{}", "{{action}}"] + global-credential-providers = ["not_found"] + [credential-alias] + not_found = ["{not_found}"] "#, - toml_bin(&cred_proj, "test-cred") ) .as_bytes(), ) .unwrap(); - cargo_process("login -Z credential-process abcdefg") - .masquerade_as_nightly_cargo(&["credential-process"]) + cargo_process("install -v foo -Zcredential-process -Zregistry-auth") + .masquerade_as_nightly_cargo(&["credential-process", "registry-auth"]) .replace_crates_io(server.index_url()) + .with_status(101) .with_stderr( - "\ -[UPDATING] [..] -[LOGIN] token for `crates.io` saved -", + r#"[UPDATING] [..] +[CREDENTIAL] [..]not_found[..] get crates-io +{"v":1,"registry":{"index-url":"[..]","name":"crates-io","headers":[[..]"WWW-Authenticate: Cargo login_url=\"https://test-registry-login/me\""[..]]},"kind":"get","operation":"read","args":[]} +[ERROR] failed to query replaced source registry `crates-io` + +Caused by: + no token found, please run `cargo login` + or use environment variable CARGO_REGISTRY_TOKEN +"#, ) .run(); - assert_eq!( - fs::read_to_string(paths::root().join("token-store")).unwrap(), - "abcdefg\n" - ); } #[cargo_test] -fn logout() { +fn all_not_supported() { let server = registry::RegistryBuilder::new() .no_configure_token() + .auth_required() + .http_index() .build(); - // The credential process to use. - let cred_proj = project() - .at("cred_proj") - .file("Cargo.toml", &basic_manifest("test-cred", "1.0.0")) - .file( - "src/main.rs", - r#" - use std::io::Read; - - fn main() {{ - assert_eq!(std::env::var("CARGO_REGISTRY_NAME_OPT").unwrap(), "crates-io"); - assert_eq!(std::env::var("CARGO_REGISTRY_INDEX_URL").unwrap(), "https://github.com/rust-lang/crates.io-index"); - assert_eq!(std::env::args().skip(1).next().unwrap(), "erase"); - std::fs::write("token-store", "").unwrap(); - eprintln!("token for `crates-io` has been erased!") - }} - "#, - ) - .build(); - cred_proj.cargo("build").run(); - + let not_supported = + build_provider("not_supported", r#"{"Err": {"kind": "url-not-supported"}}"#); cargo_util::paths::append( &paths::home().join(".cargo/config"), format!( r#" [registry] - credential-process = ["{}", "{{action}}"] + global-credential-providers = ["not_supported"] + [credential-alias] + not_supported = ["{not_supported}"] "#, - toml_bin(&cred_proj, "test-cred") ) .as_bytes(), ) .unwrap(); - cargo_process("logout -Z credential-process") - .masquerade_as_nightly_cargo(&["credential-process"]) + cargo_process("install -v foo -Zcredential-process -Zregistry-auth") + .masquerade_as_nightly_cargo(&["credential-process", "registry-auth"]) .replace_crates_io(server.index_url()) + .with_status(101) .with_stderr( - "\ -token for `crates-io` has been erased! -[LOGOUT] token for `crates-io` has been removed from local storage -[NOTE] This does not revoke the token on the registry server. - If you need to revoke the token, visit \ - and follow the instructions there. -", + r#"[UPDATING] [..] +[CREDENTIAL] [..]not_supported[..] get crates-io +{"v":1,"registry":{"index-url":"[..]","name":"crates-io","headers":[[..]"WWW-Authenticate: Cargo login_url=\"https://test-registry-login/me\""[..]]},"kind":"get","operation":"read","args":[]} +[ERROR] failed to query replaced source registry `crates-io` + +Caused by: + no credential providers could handle the request +"#, ) .run(); - assert_eq!( - fs::read_to_string(paths::root().join("token-store")).unwrap(), - "" - ); } #[cargo_test] -fn yank() { - let (p, _t) = get_token_test(); +fn multiple_providers() { + let server = registry::RegistryBuilder::new() + .no_configure_token() + .build(); - p.cargo("yank --version 0.1.0 --registry alternative -Z credential-process") + // Set up two credential providers: the first will fail with "UrlNotSupported" + // and Cargo should skip it. The second should succeed. + let url_not_supported = build_provider( + "url_not_supported", + r#"{"Err": {"kind": "url-not-supported"}}"#, + ); + + let success_provider = build_provider("success_provider", r#"{"Ok": {"kind": "login"}}"#); + + cargo_util::paths::append( + &paths::home().join(".cargo/config"), + format!( + r#" + [registry] + global-credential-providers = ["success_provider", "url_not_supported"] + + [credential-alias] + success_provider = ["{success_provider}"] + url_not_supported = ["{url_not_supported}"] + "#, + ) + .as_bytes(), + ) + .unwrap(); + + cargo_process("login -Z credential-process -v abcdefg") .masquerade_as_nightly_cargo(&["credential-process"]) + .replace_crates_io(server.index_url()) .with_stderr( - "\ -[UPDATING] [..] -[YANK] foo@0.1.0 -", + r#"[UPDATING] [..] +[CREDENTIAL] [..]url_not_supported[..] login crates-io +{"v":1,"registry":{"index-url":"https://github.com/rust-lang/crates.io-index","name":"crates-io"},"kind":"login","token":"abcdefg","login-url":"[..]","args":[]} +[CREDENTIAL] [..]success_provider[..] login crates-io +{"v":1,"registry":{"index-url":"https://github.com/rust-lang/crates.io-index","name":"crates-io"},"kind":"login","token":"abcdefg","login-url":"[..]","args":[]} +"#, ) .run(); } #[cargo_test] -fn owner() { - let (p, _t) = get_token_test(); +fn both_token_and_provider() { + let server = registry::RegistryBuilder::new().build(); + cargo_util::paths::append( + &paths::home().join(".cargo/config"), + format!( + r#" + [registry] + credential-provider = ["cargo:token"] + "#, + ) + .as_bytes(), + ) + .unwrap(); - p.cargo("owner --add username --registry alternative -Z credential-process") + cargo_process("login -Z credential-process -v abcdefg") .masquerade_as_nightly_cargo(&["credential-process"]) + .replace_crates_io(server.index_url()) .with_stderr( - "\ -[UPDATING] [..] -[OWNER] completed! -", + r#"[UPDATING] [..] +[WARNING] registry `crates-io` has a token configured in [..]credentials.toml that will be ignored because a credential-provider is configured for this registry` +[CREDENTIAL] cargo:token login crates-io +[LOGIN] token for `crates-io` saved +"#, ) .run(); + let credentials = + std::fs::read_to_string(paths::home().join(".cargo/credentials.toml")).unwrap(); + assert_eq!(credentials, "[registry]\ntoken = \"abcdefg\"\n"); } #[cargo_test] -fn libexec_path() { - // cargo: prefixed names use the sysroot - let server = registry::RegistryBuilder::new() - .no_configure_token() - .build(); +fn both_asymmetric_and_token() { + let server = registry::RegistryBuilder::new().build(); cargo_util::paths::append( &paths::home().join(".cargo/config"), - br#" - [registry] - credential-process = "cargo:doesnotexist" - "#, + format!( + r#" + [registry] + token = "foo" + secret-key = "bar" + "#, + ) + .as_bytes(), ) .unwrap(); - cargo_process("login -Z credential-process abcdefg") + cargo_process("login -Z credential-process -v abcdefg") .masquerade_as_nightly_cargo(&["credential-process"]) .replace_crates_io(server.index_url()) - .with_status(101) .with_stderr( - // FIXME: Update "Caused by" error message once rust/pull/87704 is merged. - // On Windows, changing to a custom executable resolver has changed the - // error messages. - &format!("\ -[UPDATING] [..] -[ERROR] failed to execute `[..]libexec/cargo-credential-doesnotexist[EXE]` to store authentication token for registry `crates-io` - -Caused by: - [..] -"), + r#"[UPDATING] [..] +[WARNING] registry `crates-io` has a `secret_key` configured in [..]config that will be ignored because a `token` is also configured, and the `cargo:token` provider is configured with higher precedence +[CREDENTIAL] cargo:token login crates-io +[LOGIN] token for `crates-io` saved +"#, ) .run(); } #[cargo_test] -fn invalid_token_output() { - // Error when credential process does not output the expected format for a token. - let _server = registry::RegistryBuilder::new() - .alternative() +fn token_caching() { + let server = registry::RegistryBuilder::new() .no_configure_token() + .no_configure_registry() + .token(cargo_test_support::registry::Token::Plaintext( + "sekrit".to_string(), + )) + .alternative() + .http_api() + .http_index() .build(); + + // Token should not be re-used if it is expired + let expired_provider = build_provider( + "test-cred", + r#"{"Ok":{"kind":"get","token":"sekrit","cache":{"expires":0},"operation_independent":true}}"#, + ); + + // Token should not be re-used for a different operation if it is not operation_independent + let non_independent_provider = build_provider( + "test-cred", + r#"{"Ok":{"kind":"get","token":"sekrit","cache":"session","operation_independent":false}}"#, + ); + + let p = project() + .file( + ".cargo/config", + &format!( + r#" + [registries.alternative] + index = "{}" + credential-provider = ["{expired_provider}"] + "#, + server.index_url(), + ), + ) + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + description = "foo" + license = "MIT" + homepage = "https://example.com/" + "#, + ) + .file("src/lib.rs", "") + .build(); + + let output = r#"[UPDATING] `alternative` index +{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"read","args":[]} +[PACKAGING] foo v0.1.0 [..] +[PACKAGED] [..] +{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.0","cksum":"[..]","args":[]} +[UPLOADING] foo v0.1.0 [..] +[UPLOADED] foo v0.1.0 [..] +note: Waiting [..] +You may press ctrl-c [..] +[PUBLISHED] foo v0.1.0 [..] +"#; + + // The output should contain two JSON messages from the provider in boths cases: + // The first because the credential is expired, the second because the provider + // indicated that the token was non-operation-independent. + p.cargo("publish -Z credential-process --registry alternative --no-verify") + .masquerade_as_nightly_cargo(&["credential-process"]) + .with_stderr(output) + .run(); + + p.change_file( + ".cargo/config", + &format!( + r#" + [registries.alternative] + index = "{}" + credential-provider = ["{non_independent_provider}"] + "#, + server.index_url(), + ), + ); + + p.cargo("publish -Z credential-process --registry alternative --no-verify") + .masquerade_as_nightly_cargo(&["credential-process"]) + .with_stderr(output) + .run(); +} + +#[cargo_test] +fn basic_provider() { let cred_proj = project() .at("cred_proj") .file("Cargo.toml", &basic_manifest("test-cred", "1.0.0")) - .file("src/main.rs", r#"fn main() { print!("a\nb\n"); } "#) + .file("src/main.rs", r#"fn main() { + eprintln!("CARGO={:?}", std::env::var("CARGO").ok()); + eprintln!("CARGO_REGISTRY_NAME_OPT={:?}", std::env::var("CARGO_REGISTRY_NAME_OPT").ok()); + eprintln!("CARGO_REGISTRY_INDEX_URL={:?}", std::env::var("CARGO_REGISTRY_INDEX_URL").ok()); + print!("sekrit"); + }"#) .build(); cred_proj.cargo("build").run(); - cargo_util::paths::append( - &paths::home().join(".cargo/config"), - format!( + let _server = registry::RegistryBuilder::new() + .no_configure_token() + .credential_provider(&[ + "cargo:token-from-stdout", + &toml_bin(&cred_proj, "test-cred"), + ]) + .token(cargo_test_support::registry::Token::Plaintext( + "sekrit".to_string(), + )) + .alternative() + .http_api() + .auth_required() + .build(); + + let p = project() + .file( + "Cargo.toml", r#" - [registry] - credential-process = ["{}"] + [package] + name = "foo" + version = "0.0.1" + authors = [] + [dependencies.bar] + version = "0.0.1" + registry = "alternative" "#, - toml_bin(&cred_proj, "test-cred") ) - .as_bytes(), - ) - .unwrap(); - - let p = project() - .file("Cargo.toml", &basic_manifest("foo", "1.0.0")) - .file("src/lib.rs", "") + .file("src/main.rs", "fn main() {}") .build(); + Package::new("bar", "0.0.1").alternative(true).publish(); - p.cargo("publish --no-verify --registry alternative -Z credential-process") - .masquerade_as_nightly_cargo(&["credential-process"]) - .with_status(101) + p.cargo("check -Z credential-process -Z registry-auth") + .masquerade_as_nightly_cargo(&["credential-process", "registry-auth"]) .with_stderr( "\ -[UPDATING] [..] -[ERROR] credential process `[..]test-cred[EXE]` returned more than one line of output; expected a single token +[UPDATING] `alternative` index +CARGO=Some([..]) +CARGO_REGISTRY_NAME_OPT=Some(\"alternative\") +CARGO_REGISTRY_INDEX_URL=Some([..]) +[DOWNLOADING] crates ... +[DOWNLOADED] bar v0.0.1 (registry `alternative`) +[CHECKING] bar v0.0.1 (registry `alternative`) +[CHECKING] foo v0.0.1 ([..]) +[FINISHED] [..] ", ) .run(); diff --git a/src/tools/cargo/tests/testsuite/freshness.rs b/src/tools/cargo/tests/testsuite/freshness.rs index 86b186af8..f28f1ff46 100644 --- a/src/tools/cargo/tests/testsuite/freshness.rs +++ b/src/tools/cargo/tests/testsuite/freshness.rs @@ -14,7 +14,8 @@ use super::death; use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::registry::Package; use cargo_test_support::{ - basic_manifest, is_coarse_mtime, project, rustc_host, rustc_host_env, sleep_ms, + basic_lib_manifest, basic_manifest, is_coarse_mtime, project, rustc_host, rustc_host_env, + sleep_ms, }; #[cargo_test] @@ -2814,3 +2815,62 @@ directory sources are not [..] ) .run(); } + +#[cargo_test] +fn skip_mtime_check_in_selected_cargo_home_subdirs() { + let p = project() + .at("cargo_home/registry/foo") + .file("Cargo.toml", &basic_lib_manifest("foo")) + .file("src/lib.rs", "") + .build(); + let project_root = p.root(); + let cargo_home = project_root.parent().unwrap().parent().unwrap(); + p.cargo("check -v") + .env("CARGO_HOME", &cargo_home) + .with_stderr( + "\ +[CHECKING] foo v0.5.0 ([CWD]) +[RUNNING] `rustc --crate-name foo src/lib.rs [..] +[FINISHED] dev [..]", + ) + .run(); + p.change_file("src/lib.rs", "illegal syntax"); + p.cargo("check -v") + .env("CARGO_HOME", &cargo_home) + .with_stderr( + "\ +[FRESH] foo v0.5.0 ([CWD]) +[FINISHED] dev [..]", + ) + .run(); +} + +#[cargo_test] +fn use_mtime_cache_in_cargo_home() { + let p = project() + .at("cargo_home/foo") + .file("Cargo.toml", &basic_lib_manifest("foo")) + .file("src/lib.rs", "") + .build(); + let project_root = p.root(); + let cargo_home = project_root.parent().unwrap(); + p.cargo("check -v") + .env("CARGO_HOME", &cargo_home) + .with_stderr( + "\ +[CHECKING] foo v0.5.0 ([CWD]) +[RUNNING] `rustc --crate-name foo src/lib.rs [..] +[FINISHED] dev [..]", + ) + .run(); + p.change_file("src/lib.rs", "illegal syntax"); + p.cargo("check -v") + .env("CARGO_HOME", &cargo_home) + .with_stderr( + "\ +[DIRTY] foo v0.5.0 ([CWD]): [..] +[CHECKING] foo v0.5.0 ([CWD]) +[RUNNING] `rustc --crate-name foo src/lib.rs [..]", + ) + .run_expect_error(); +} diff --git a/src/tools/cargo/tests/testsuite/init/auto_git/in b/src/tools/cargo/tests/testsuite/init/auto_git/in deleted file mode 120000 index 1202506b6..000000000 --- a/src/tools/cargo/tests/testsuite/init/auto_git/in +++ /dev/null @@ -1 +0,0 @@ -../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/init/auto_git/mod.rs b/src/tools/cargo/tests/testsuite/init/auto_git/mod.rs deleted file mode 100644 index 68c217520..000000000 --- a/src/tools/cargo/tests/testsuite/init/auto_git/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib") - .current_dir(project_root) - .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); - assert!(project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/auto_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/auto_git/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/auto_git/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/auto_git/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/auto_git/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/auto_git/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/auto_git/stderr.log b/src/tools/cargo/tests/testsuite/init/auto_git/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/auto_git/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/auto_git/stdout.log b/src/tools/cargo/tests/testsuite/init/auto_git/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/in/src/main.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/in/src/main.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/in/src/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/mod.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/mod.rs deleted file mode 100644 index 326bd218a..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --bin --vcs none") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/out/src/main.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/out/src/main.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/out/src/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/stderr.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/stdout.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/in/main.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/in/main.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/in/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/mod.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/mod.rs deleted file mode 100644 index 1f16fb659..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --bin --vcs none") - .current_dir(project_root) - .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); - assert!(!project_root.join("src").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/Cargo.toml deleted file mode 100644 index 5c6c9158c..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[[bin]] -name = "case" -path = "main.rs" diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/main.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/main.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/stderr.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/stdout.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_explicit_nosrc/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/in/src/main.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/in/src/main.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/in/src/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/mod.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/mod.rs deleted file mode 100644 index 12349a09b..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs none") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/out/src/main.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/out/src/main.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/out/src/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/stderr.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/stdout.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/in/case.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/in/case.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/in/case.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/mod.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/mod.rs deleted file mode 100644 index fe65940db..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs none") - .current_dir(project_root) - .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); - assert!(!project_root.join("src").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml deleted file mode 100644 index 8da5fe778..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[[bin]] -name = "case" -path = "case.rs" diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/case.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/case.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/case.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stderr.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stdout.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/in/src/case.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/in/src/case.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/in/src/case.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/mod.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/mod.rs deleted file mode 100644 index d3e8e66df..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs none") - .current_dir(project_root) - .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); - assert!(!project_root.join("src/main.rs").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/Cargo.toml deleted file mode 100644 index dec0aaea9..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[[bin]] -name = "case" -path = "src/case.rs" diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/src/case.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/src/case.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/src/case.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/stderr.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/stdout.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_namesrc/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/in/main.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/in/main.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/in/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/mod.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/mod.rs deleted file mode 100644 index fe65940db..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs none") - .current_dir(project_root) - .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); - assert!(!project_root.join("src").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/Cargo.toml deleted file mode 100644 index 5c6c9158c..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[[bin]] -name = "case" -path = "main.rs" diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/main.rs b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/main.rs deleted file mode 100644 index 65fdcf8da..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} - diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/stderr.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/stdout.log b/src/tools/cargo/tests/testsuite/init/bin_already_exists_implicit_nosrc/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/both_lib_and_bin/mod.rs b/src/tools/cargo/tests/testsuite/init/both_lib_and_bin/mod.rs deleted file mode 100644 index c9232320a..000000000 --- a/src/tools/cargo/tests/testsuite/init/both_lib_and_bin/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -use cargo_test_support::paths; -use cargo_test_support::prelude::*; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let cwd = paths::root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --bin") - .current_dir(&cwd) - .assert() - .code(101) - .stdout_matches_path(curr_dir!().join("stdout.log")) - .stderr_matches_path(curr_dir!().join("stderr.log")); - - assert!(!cwd.join("Cargo.toml").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/both_lib_and_bin/stderr.log b/src/tools/cargo/tests/testsuite/init/both_lib_and_bin/stderr.log deleted file mode 100644 index 9d635a427..000000000 --- a/src/tools/cargo/tests/testsuite/init/both_lib_and_bin/stderr.log +++ /dev/null @@ -1 +0,0 @@ -error: can't specify both lib and binary outputs diff --git a/src/tools/cargo/tests/testsuite/init/both_lib_and_bin/stdout.log b/src/tools/cargo/tests/testsuite/init/both_lib_and_bin/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/case.rs b/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/case.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/lib.rs b/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/lib.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/mod.rs b/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/mod.rs deleted file mode 100644 index 5e9e1b94c..000000000 --- a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib") - .current_dir(project_root) - .assert() - .code(101) - .stdout_matches_path(curr_dir!().join("stdout.log")) - .stderr_matches_path(curr_dir!().join("stderr.log")); -} diff --git a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/stderr.log b/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/stderr.log deleted file mode 100644 index c08dce96b..000000000 --- a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/stderr.log +++ /dev/null @@ -1 +0,0 @@ -error: cannot have a package with multiple libraries, found both `case.rs` and `lib.rs` diff --git a/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/stdout.log b/src/tools/cargo/tests/testsuite/init/cant_create_library_when_both_binlib_present/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/in/lib.rs b/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/in/lib.rs deleted file mode 100644 index 321163744..000000000 --- a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/in/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() { println!("lib.rs"); } diff --git a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/in/src/lib.rs b/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/in/src/lib.rs deleted file mode 100644 index f71455a1a..000000000 --- a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/in/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() { println!("src/lib.rs"); } diff --git a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/mod.rs b/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/mod.rs deleted file mode 100644 index d1cba2ff7..000000000 --- a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs none") - .current_dir(project_root) - .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); - assert!(!project_root.join("Cargo.toml").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/out/lib.rs b/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/out/lib.rs deleted file mode 100644 index 321163744..000000000 --- a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/out/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() { println!("lib.rs"); } diff --git a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/out/src/lib.rs deleted file mode 100644 index f71455a1a..000000000 --- a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/out/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() { println!("src/lib.rs"); } diff --git a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/stderr.log b/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/stderr.log deleted file mode 100644 index 8dbd2aaf0..000000000 --- a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/stderr.log +++ /dev/null @@ -1 +0,0 @@ -error: cannot have a package with multiple libraries, found both `src/lib.rs` and `lib.rs` diff --git a/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/stdout.log b/src/tools/cargo/tests/testsuite/init/confused_by_multiple_lib_files/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/in/case.rs b/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/in/case.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/in/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/in/lib.rs b/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/in/lib.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/in/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/mod.rs b/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/mod.rs deleted file mode 100644 index 326bd218a..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --bin --vcs none") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/Cargo.toml deleted file mode 100644 index 675c888a5..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[[bin]] -name = "case" -path = "case.rs" - -[lib] -name = "case" -path = "lib.rs" diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/case.rs b/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/case.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/lib.rs b/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/lib.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/out/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/stderr.log b/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/stdout.log b/src/tools/cargo/tests/testsuite/init/creates_binary_when_both_binlib_present/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs b/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/mod.rs b/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/mod.rs deleted file mode 100644 index 326bd218a..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --bin --vcs none") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml deleted file mode 100644 index 8da5fe778..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[[bin]] -name = "case" -path = "case.rs" diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs b/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stderr.log b/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stderr.log deleted file mode 100644 index ec428f31c..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stderr.log +++ /dev/null @@ -1,2 +0,0 @@ -warning: file `case.rs` seems to be a library file - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stdout.log b/src/tools/cargo/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/in/case.rs b/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/in/case.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/in/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/mod.rs b/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/mod.rs deleted file mode 100644 index 59c192cb9..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --vcs none") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml deleted file mode 100644 index 2c0464468..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[lib] -name = "case" -path = "case.rs" diff --git a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/case.rs b/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/case.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stderr.log b/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stderr.log deleted file mode 100644 index bf070e2da..000000000 --- a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stderr.log +++ /dev/null @@ -1,2 +0,0 @@ -warning: file `case.rs` seems to be a binary (application) file - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stdout.log b/src/tools/cargo/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/empty_dir/.keep b/src/tools/cargo/tests/testsuite/init/empty_dir/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/empty_dir/mod.rs b/src/tools/cargo/tests/testsuite/init/empty_dir/mod.rs deleted file mode 100644 index 074954f01..000000000 --- a/src/tools/cargo/tests/testsuite/init/empty_dir/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::{command_is_available, paths, Project}; -use std::fs; -use std::process::Command; - -use crate::test_root; diff --git a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/in b/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/in deleted file mode 120000 index 1202506b6..000000000 --- a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/in +++ /dev/null @@ -1 +0,0 @@ -../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/mod.rs b/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/mod.rs deleted file mode 100644 index 7314e955c..000000000 --- a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs git --bin") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/out/src/main.rs b/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/out/src/main.rs deleted file mode 100644 index e7a11a969..000000000 --- a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/out/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/stderr.log b/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/stdout.log b/src/tools/cargo/tests/testsuite/init/explicit_bin_with_git/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/formats_source/in/rustfmt.toml b/src/tools/cargo/tests/testsuite/init/formats_source/in/rustfmt.toml deleted file mode 100644 index b196eaa2d..000000000 --- a/src/tools/cargo/tests/testsuite/init/formats_source/in/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -tab_spaces = 2 diff --git a/src/tools/cargo/tests/testsuite/init/formats_source/mod.rs b/src/tools/cargo/tests/testsuite/init/formats_source/mod.rs deleted file mode 100644 index ac1fb6271..000000000 --- a/src/tools/cargo/tests/testsuite/init/formats_source/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::{process, Project}; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - // This cannot use `requires_rustfmt` because rustfmt is not available in - // the rust-lang/rust environment. Additionally, if running cargo without - // rustup (but with rustup installed), this test also fails due to HOME - // preventing the proxy from choosing a toolchain. - if let Err(e) = process("rustfmt").arg("-V").exec_with_output() { - eprintln!("skipping test, rustfmt not available:\n{e:?}"); - return; - } - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --vcs none") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/formats_source/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/formats_source/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/formats_source/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/formats_source/out/rustfmt.toml b/src/tools/cargo/tests/testsuite/init/formats_source/out/rustfmt.toml deleted file mode 100644 index b196eaa2d..000000000 --- a/src/tools/cargo/tests/testsuite/init/formats_source/out/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -tab_spaces = 2 diff --git a/src/tools/cargo/tests/testsuite/init/formats_source/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/formats_source/out/src/lib.rs deleted file mode 100644 index 3b9acffd5..000000000 --- a/src/tools/cargo/tests/testsuite/init/formats_source/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/formats_source/stderr.log b/src/tools/cargo/tests/testsuite/init/formats_source/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/formats_source/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/formats_source/stdout.log b/src/tools/cargo/tests/testsuite/init/formats_source/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/in/.fossil/.keep b/src/tools/cargo/tests/testsuite/init/fossil_autodetect/in/.fossil/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/mod.rs b/src/tools/cargo/tests/testsuite/init/fossil_autodetect/mod.rs deleted file mode 100644 index d45ba868a..000000000 --- a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib") - .current_dir(project_root) - .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); - assert!(!project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/clean-glob b/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/clean-glob deleted file mode 100644 index a9d37c560..000000000 --- a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/clean-glob +++ /dev/null @@ -1,2 +0,0 @@ -target -Cargo.lock diff --git a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/ignore-glob b/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/ignore-glob deleted file mode 100644 index a9d37c560..000000000 --- a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/ignore-glob +++ /dev/null @@ -1,2 +0,0 @@ -target -Cargo.lock diff --git a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/stderr.log b/src/tools/cargo/tests/testsuite/init/fossil_autodetect/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/fossil_autodetect/stdout.log b/src/tools/cargo/tests/testsuite/init/fossil_autodetect/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/git_autodetect/mod.rs b/src/tools/cargo/tests/testsuite/init/git_autodetect/mod.rs deleted file mode 100644 index aef47bc7d..000000000 --- a/src/tools/cargo/tests/testsuite/init/git_autodetect/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::paths; -use cargo_test_support::prelude::*; -use std::fs; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project_root = &paths::root().join("foo"); - // Need to create `.git` dir manually because it cannot be tracked under a git repo - fs::create_dir_all(project_root.join(".git")).unwrap(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib") - .current_dir(project_root) - .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); - assert!(project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/git_autodetect/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/git_autodetect/out/Cargo.toml deleted file mode 100644 index 1d9cfe317..000000000 --- a/src/tools/cargo/tests/testsuite/init/git_autodetect/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "foo" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/git_autodetect/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/git_autodetect/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/git_autodetect/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/git_autodetect/stderr.log b/src/tools/cargo/tests/testsuite/init/git_autodetect/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/git_autodetect/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/git_autodetect/stdout.log b/src/tools/cargo/tests/testsuite/init/git_autodetect/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/mod.rs b/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/mod.rs deleted file mode 100644 index cd4437c65..000000000 --- a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --edition 2015") - .current_dir(project_root) - .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); - assert!(project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml deleted file mode 100644 index a6269fdcd..000000000 --- a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2015" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stderr.log b/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stdout.log b/src/tools/cargo/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/in/rustfmt.toml b/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/in/rustfmt.toml deleted file mode 100644 index b196eaa2d..000000000 --- a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/in/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -tab_spaces = 2 diff --git a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/mod.rs b/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/mod.rs deleted file mode 100644 index fd9394049..000000000 --- a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --vcs none") - .env("PATH", "") // pretend that `rustfmt` is missing - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/rustfmt.toml b/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/rustfmt.toml deleted file mode 100644 index b196eaa2d..000000000 --- a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -tab_spaces = 2 diff --git a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/stderr.log b/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/stdout.log b/src/tools/cargo/tests/testsuite/init/ignores_failure_to_format_source/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/in/main.rs b/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/in/main.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/in/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/mod.rs b/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/mod.rs deleted file mode 100644 index 80bec8893..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs git") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/out/Cargo.toml deleted file mode 100644 index 5c6c9158c..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[[bin]] -name = "case" -path = "main.rs" diff --git a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/out/main.rs b/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/out/main.rs deleted file mode 100644 index f328e4d9d..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/out/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/stderr.log b/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/stdout.log b/src/tools/cargo/tests/testsuite/init/inferred_bin_with_git/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/in/lib.rs b/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/in/lib.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/in/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/mod.rs b/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/mod.rs deleted file mode 100644 index 80bec8893..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs git") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/out/Cargo.toml deleted file mode 100644 index 39e95fe94..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[lib] -name = "case" -path = "lib.rs" diff --git a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/out/lib.rs b/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/out/lib.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/out/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/stderr.log b/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/stdout.log b/src/tools/cargo/tests/testsuite/init/inferred_lib_with_git/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/Cargo.toml b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/Cargo.toml deleted file mode 100644 index b7a2e9036..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[workspace] -members = [ - "crates/*", -] - -[workspace.package] -authors = ["Rustaceans"] -description = "foo" -edition = "2018" -homepage = "foo" -keywords = ["foo", "bar"] -readme = "README.md" -rust-version = "1.67.0" -categories = ["algorithms"] -documentation = "foo" -exclude = ["foo"] -include = ["foo"] -license = "MIT OR Apache-2.0" -publish = false -repository = "foo" -version = "1.2.3" diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/README.md b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/crates/foo/src/main.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/crates/foo/src/main.rs deleted file mode 100644 index 43f0dac5e..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/crates/foo/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/src/lib.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/in/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/mod.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/mod.rs deleted file mode 100644 index 4e1dda845..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::curr_dir; -use cargo_test_support::CargoCommand; -use cargo_test_support::Project; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo_ui() - .arg("init") - .args(["crates/foo"]) - .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/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/Cargo.toml deleted file mode 100644 index b7a2e9036..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[workspace] -members = [ - "crates/*", -] - -[workspace.package] -authors = ["Rustaceans"] -description = "foo" -edition = "2018" -homepage = "foo" -keywords = ["foo", "bar"] -readme = "README.md" -rust-version = "1.67.0" -categories = ["algorithms"] -documentation = "foo" -exclude = ["foo"] -include = ["foo"] -license = "MIT OR Apache-2.0" -publish = false -repository = "foo" -version = "1.2.3" diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/Cargo.toml b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/Cargo.toml deleted file mode 100644 index 137ed1c87..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "foo" -authors.workspace = true -description.workspace = true -edition.workspace = true -homepage.workspace = true -keywords.workspace = true -readme.workspace = true -rust-version.workspace = true -categories.workspace = true -documentation.workspace = true -exclude.workspace = true -include.workspace = true -license.workspace = true -publish.workspace = true -repository.workspace = true -version.workspace = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/src/main.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/src/main.rs deleted file mode 100644 index 43f0dac5e..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/crates/foo/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Check that our file is not overwritten") -} diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stderr.log b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stdout.log b/src/tools/cargo/tests/testsuite/init/inherit_workspace_package_table/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/invalid_dir_name/mod.rs b/src/tools/cargo/tests/testsuite/init/invalid_dir_name/mod.rs deleted file mode 100644 index 2b1be9022..000000000 --- a/src/tools/cargo/tests/testsuite/init/invalid_dir_name/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::paths; -use cargo_test_support::prelude::*; -use std::fs; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let foo = &paths::root().join("foo.bar"); - fs::create_dir_all(foo).unwrap(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init") - .current_dir(foo) - .assert() - .code(101) - .stdout_matches_path(curr_dir!().join("stdout.log")) - .stderr_matches_path(curr_dir!().join("stderr.log")); - - assert!(!foo.join("Cargo.toml").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/invalid_dir_name/stderr.log b/src/tools/cargo/tests/testsuite/init/invalid_dir_name/stderr.log deleted file mode 100644 index 86d2c665f..000000000 --- a/src/tools/cargo/tests/testsuite/init/invalid_dir_name/stderr.log +++ /dev/null @@ -1,8 +0,0 @@ -error: invalid character `.` in package name: `foo.bar`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters) -If you need a package name to not match the directory name, consider using --name flag. -If you need a binary with the name "foo.bar", use a valid package name, and set the binary name to be different from the package. This can be done by setting the binary filename to `src/bin/foo.bar.rs` or change the name in Cargo.toml with: - - [[bin]] - name = "foo.bar" - path = "src/main.rs" - diff --git a/src/tools/cargo/tests/testsuite/init/invalid_dir_name/stdout.log b/src/tools/cargo/tests/testsuite/init/invalid_dir_name/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/in/lib.rs b/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/in/lib.rs deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/mod.rs b/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/mod.rs deleted file mode 100644 index d3e8e66df..000000000 --- a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs none") - .current_dir(project_root) - .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); - assert!(!project_root.join("src/main.rs").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/out/Cargo.toml deleted file mode 100644 index 39e95fe94..000000000 --- a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/out/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[lib] -name = "case" -path = "lib.rs" diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/out/lib.rs b/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/out/lib.rs deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/stderr.log b/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/stdout.log b/src/tools/cargo/tests/testsuite/init/lib_already_exists_nosrc/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/in/src/lib.rs b/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/in/src/lib.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/in/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/mod.rs b/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/mod.rs deleted file mode 100644 index d3e8e66df..000000000 --- a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --vcs none") - .current_dir(project_root) - .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); - assert!(!project_root.join("src/main.rs").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/out/src/lib.rs deleted file mode 100644 index 59760b549..000000000 --- a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/out/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() {} diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/stderr.log b/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/stdout.log b/src/tools/cargo/tests/testsuite/init/lib_already_exists_src/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/mod.rs b/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/mod.rs deleted file mode 100644 index d45ba868a..000000000 --- a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib") - .current_dir(project_root) - .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); - assert!(!project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/stderr.log b/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/stdout.log b/src/tools/cargo/tests/testsuite/init/mercurial_autodetect/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/mod.rs b/src/tools/cargo/tests/testsuite/init/mod.rs deleted file mode 100644 index 7853a1a0b..000000000 --- a/src/tools/cargo/tests/testsuite/init/mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -//! Tests for the `cargo init` command. - -mod auto_git; -mod bin_already_exists_explicit; -mod bin_already_exists_explicit_nosrc; -mod bin_already_exists_implicit; -mod bin_already_exists_implicit_namenosrc; -mod bin_already_exists_implicit_namesrc; -mod bin_already_exists_implicit_nosrc; -mod both_lib_and_bin; -mod cant_create_library_when_both_binlib_present; -mod confused_by_multiple_lib_files; -mod creates_binary_when_both_binlib_present; -mod creates_binary_when_instructed_and_has_lib_file; -mod creates_library_when_instructed_and_has_bin_file; -mod explicit_bin_with_git; -mod formats_source; -mod fossil_autodetect; -mod git_autodetect; -mod git_ignore_exists_no_conflicting_entries; -mod ignores_failure_to_format_source; -mod inferred_bin_with_git; -mod inferred_lib_with_git; -mod inherit_workspace_package_table; -mod invalid_dir_name; -mod lib_already_exists_nosrc; -mod lib_already_exists_src; -mod mercurial_autodetect; -mod multibin_project_name_clash; -#[cfg(not(windows))] -mod no_filename; -#[cfg(unix)] -mod path_contains_separator; -mod pijul_autodetect; -mod reserved_name; -mod simple_bin; -mod simple_git; -mod simple_git_ignore_exists; -mod simple_hg; -mod simple_hg_ignore_exists; -mod simple_lib; -mod unknown_flags; -mod with_argument; diff --git a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/in/case.rs b/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/in/case.rs deleted file mode 100644 index b31221118..000000000 --- a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/in/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { println!("foo.rs"); } diff --git a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/in/main.rs b/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/in/main.rs deleted file mode 100644 index 7937627b9..000000000 --- a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/in/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { println!("main.rs"); } diff --git a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/mod.rs b/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/mod.rs deleted file mode 100644 index fdd4476d9..000000000 --- a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --vcs none") - .current_dir(project_root) - .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); - assert!(!project_root.join("Cargo.toml").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/out/case.rs b/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/out/case.rs deleted file mode 100644 index b31221118..000000000 --- a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/out/case.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { println!("foo.rs"); } diff --git a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/out/main.rs b/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/out/main.rs deleted file mode 100644 index 7937627b9..000000000 --- a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/out/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { println!("main.rs"); } diff --git a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/stderr.log b/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/stderr.log deleted file mode 100644 index 21a1dabee..000000000 --- a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/stderr.log +++ /dev/null @@ -1,4 +0,0 @@ -error: multiple possible binary sources found: - main.rs - case.rs -cannot automatically generate Cargo.toml as the main target would be ambiguous diff --git a/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/stdout.log b/src/tools/cargo/tests/testsuite/init/multibin_project_name_clash/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/no_filename/mod.rs b/src/tools/cargo/tests/testsuite/init/no_filename/mod.rs deleted file mode 100644 index 8edfd2823..000000000 --- a/src/tools/cargo/tests/testsuite/init/no_filename/mod.rs +++ /dev/null @@ -1,16 +0,0 @@ -use cargo_test_support::paths; -use cargo_test_support::prelude::*; - -use cargo_test_support::curr_dir; - -#[cfg(not(windows))] -#[cargo_test] -fn case() { - snapbox::cmd::Command::cargo_ui() - .arg_line("init /") - .current_dir(paths::root()) - .assert() - .code(101) - .stdout_matches_path(curr_dir!().join("stdout.log")) - .stderr_matches_path(curr_dir!().join("stderr.log")); -} diff --git a/src/tools/cargo/tests/testsuite/init/no_filename/stderr.log b/src/tools/cargo/tests/testsuite/init/no_filename/stderr.log deleted file mode 100644 index bd087ec90..000000000 --- a/src/tools/cargo/tests/testsuite/init/no_filename/stderr.log +++ /dev/null @@ -1 +0,0 @@ -error: cannot auto-detect package name from path "/" ; use --name to override diff --git a/src/tools/cargo/tests/testsuite/init/no_filename/stdout.log b/src/tools/cargo/tests/testsuite/init/no_filename/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/path_contains_separator/in/.keep b/src/tools/cargo/tests/testsuite/init/path_contains_separator/in/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/path_contains_separator/mod.rs b/src/tools/cargo/tests/testsuite/init/path_contains_separator/mod.rs deleted file mode 100644 index 0a12f4269..000000000 --- a/src/tools/cargo/tests/testsuite/init/path_contains_separator/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::{t, Project}; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root().join("test:ing"); - - if !project_root.exists() { - t!(std::fs::create_dir(&project_root)); - } - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --bin --vcs none --edition 2015 --name testing") - .current_dir(project_root) - .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); - assert!(!project_root.join(".gitignore").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/path_contains_separator/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/path_contains_separator/out/Cargo.toml deleted file mode 100644 index 11465f1fc..000000000 --- a/src/tools/cargo/tests/testsuite/init/path_contains_separator/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "testing" -version = "0.1.0" -edition = "2015" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/path_contains_separator/out/src/main.rs b/src/tools/cargo/tests/testsuite/init/path_contains_separator/out/src/main.rs deleted file mode 100644 index e7a11a969..000000000 --- a/src/tools/cargo/tests/testsuite/init/path_contains_separator/out/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/src/tools/cargo/tests/testsuite/init/path_contains_separator/stderr.log b/src/tools/cargo/tests/testsuite/init/path_contains_separator/stderr.log deleted file mode 100644 index d7947aea2..000000000 --- a/src/tools/cargo/tests/testsuite/init/path_contains_separator/stderr.log +++ /dev/null @@ -1,3 +0,0 @@ -warning: the path `[ROOT]/case/test:ing/.` contains invalid PATH characters (usually `:`, `;`, or `"`) -It is recommended to use a different name to avoid problems. - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/path_contains_separator/stdout.log b/src/tools/cargo/tests/testsuite/init/path_contains_separator/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/in/.pijul/.keep b/src/tools/cargo/tests/testsuite/init/pijul_autodetect/in/.pijul/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/mod.rs b/src/tools/cargo/tests/testsuite/init/pijul_autodetect/mod.rs deleted file mode 100644 index d45ba868a..000000000 --- a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib") - .current_dir(project_root) - .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); - assert!(!project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/.ignore b/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/.ignore deleted file mode 100644 index 4fffb2f89..000000000 --- a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/.ignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/Cargo.lock diff --git a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/stderr.log b/src/tools/cargo/tests/testsuite/init/pijul_autodetect/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/pijul_autodetect/stdout.log b/src/tools/cargo/tests/testsuite/init/pijul_autodetect/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/reserved_name/mod.rs b/src/tools/cargo/tests/testsuite/init/reserved_name/mod.rs deleted file mode 100644 index cc65fd0a1..000000000 --- a/src/tools/cargo/tests/testsuite/init/reserved_name/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::paths; -use cargo_test_support::prelude::*; -use std::fs; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project_root = &paths::root().join("test"); - fs::create_dir_all(project_root).unwrap(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init") - .current_dir(project_root) - .assert() - .code(101) - .stdout_matches_path(curr_dir!().join("stdout.log")) - .stderr_matches_path(curr_dir!().join("stderr.log")); - - assert!(!project_root.join("Cargo.toml").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/reserved_name/stderr.log b/src/tools/cargo/tests/testsuite/init/reserved_name/stderr.log deleted file mode 100644 index 748971bdf..000000000 --- a/src/tools/cargo/tests/testsuite/init/reserved_name/stderr.log +++ /dev/null @@ -1,8 +0,0 @@ -error: the name `test` cannot be used as a package name, it conflicts with Rust's built-in test library -If you need a package name to not match the directory name, consider using --name flag. -If you need a binary with the name "test", use a valid package name, and set the binary name to be different from the package. This can be done by setting the binary filename to `src/bin/test.rs` or change the name in Cargo.toml with: - - [[bin]] - name = "test" - path = "src/main.rs" - diff --git a/src/tools/cargo/tests/testsuite/init/reserved_name/stdout.log b/src/tools/cargo/tests/testsuite/init/reserved_name/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/simple_bin/in b/src/tools/cargo/tests/testsuite/init/simple_bin/in deleted file mode 120000 index 1202506b6..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_bin/in +++ /dev/null @@ -1 +0,0 @@ -../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/init/simple_bin/mod.rs b/src/tools/cargo/tests/testsuite/init/simple_bin/mod.rs deleted file mode 100644 index eaf0955f9..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_bin/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --bin --vcs none --edition 2015") - .current_dir(project_root) - .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); - assert!(!project_root.join(".gitignore").is_file()); - - snapbox::cmd::Command::cargo_ui() - .current_dir(project_root) - .arg("build") - .assert() - .success(); - assert!(project.bin("case").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_bin/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/simple_bin/out/Cargo.toml deleted file mode 100644 index a6269fdcd..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_bin/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2015" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/simple_bin/out/src/main.rs b/src/tools/cargo/tests/testsuite/init/simple_bin/out/src/main.rs deleted file mode 100644 index e7a11a969..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_bin/out/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_bin/stderr.log b/src/tools/cargo/tests/testsuite/init/simple_bin/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_bin/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/simple_bin/stdout.log b/src/tools/cargo/tests/testsuite/init/simple_bin/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/simple_git/in b/src/tools/cargo/tests/testsuite/init/simple_git/in deleted file mode 120000 index 1202506b6..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git/in +++ /dev/null @@ -1 +0,0 @@ -../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/init/simple_git/mod.rs b/src/tools/cargo/tests/testsuite/init/simple_git/mod.rs deleted file mode 100644 index c373fe2a2..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --vcs git") - .current_dir(project_root) - .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); - assert!(project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_git/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/simple_git/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/simple_git/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/simple_git/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_git/stderr.log b/src/tools/cargo/tests/testsuite/init/simple_git/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/simple_git/stdout.log b/src/tools/cargo/tests/testsuite/init/simple_git/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/mod.rs b/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/mod.rs deleted file mode 100644 index 142e86efd..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --edition 2015") - .current_dir(project_root) - .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); - assert!(project_root.join(".git").is_dir()); - - snapbox::cmd::Command::cargo_ui() - .current_dir(project_root) - .arg("build") - .assert() - .success(); -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/out/Cargo.toml deleted file mode 100644 index a6269fdcd..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2015" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/stderr.log b/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/stdout.log b/src/tools/cargo/tests/testsuite/init/simple_git_ignore_exists/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg/in b/src/tools/cargo/tests/testsuite/init/simple_hg/in deleted file mode 120000 index 1202506b6..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg/in +++ /dev/null @@ -1 +0,0 @@ -../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs b/src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs deleted file mode 100644 index 1d6765453..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test(requires_hg)] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --vcs hg") - .current_dir(project_root) - .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); - assert!(!project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/simple_hg/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/simple_hg/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg/stderr.log b/src/tools/cargo/tests/testsuite/init/simple_hg/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg/stdout.log b/src/tools/cargo/tests/testsuite/init/simple_hg/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs b/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs deleted file mode 100644 index d45ba868a..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib") - .current_dir(project_root) - .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); - assert!(!project_root.join(".git").is_dir()); -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/out/Cargo.toml deleted file mode 100644 index dcdb8da2c..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/stderr.log b/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/stdout.log b/src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/simple_lib/in b/src/tools/cargo/tests/testsuite/init/simple_lib/in deleted file mode 120000 index 1202506b6..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_lib/in +++ /dev/null @@ -1 +0,0 @@ -../empty_dir \ No newline at end of file diff --git a/src/tools/cargo/tests/testsuite/init/simple_lib/mod.rs b/src/tools/cargo/tests/testsuite/init/simple_lib/mod.rs deleted file mode 100644 index d6bae5167..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_lib/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init --lib --vcs none --edition 2015") - .current_dir(project_root) - .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); - assert!(!project_root.join(".gitignore").is_file()); - - snapbox::cmd::Command::cargo_ui() - .current_dir(project_root) - .arg("build") - .assert() - .success(); - assert!(!project.bin("foo").is_file()); -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_lib/out/Cargo.toml b/src/tools/cargo/tests/testsuite/init/simple_lib/out/Cargo.toml deleted file mode 100644 index a6269fdcd..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_lib/out/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "case" -version = "0.1.0" -edition = "2015" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/simple_lib/out/src/lib.rs b/src/tools/cargo/tests/testsuite/init/simple_lib/out/src/lib.rs deleted file mode 100644 index 7d12d9af8..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_lib/out/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/src/tools/cargo/tests/testsuite/init/simple_lib/stderr.log b/src/tools/cargo/tests/testsuite/init/simple_lib/stderr.log deleted file mode 100644 index f459bf226..000000000 --- a/src/tools/cargo/tests/testsuite/init/simple_lib/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created library package diff --git a/src/tools/cargo/tests/testsuite/init/simple_lib/stdout.log b/src/tools/cargo/tests/testsuite/init/simple_lib/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/unknown_flags/mod.rs b/src/tools/cargo/tests/testsuite/init/unknown_flags/mod.rs deleted file mode 100644 index 4289b4b9e..000000000 --- a/src/tools/cargo/tests/testsuite/init/unknown_flags/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -use cargo_test_support::paths; -use cargo_test_support::prelude::*; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - snapbox::cmd::Command::cargo_ui() - .arg_line("init foo --flag") - .current_dir(paths::root()) - .assert() - .code(1) - .stdout_matches_path(curr_dir!().join("stdout.log")) - .stderr_matches_path(curr_dir!().join("stderr.log")); -} diff --git a/src/tools/cargo/tests/testsuite/init/unknown_flags/stderr.log b/src/tools/cargo/tests/testsuite/init/unknown_flags/stderr.log deleted file mode 100644 index 980e8acd8..000000000 --- a/src/tools/cargo/tests/testsuite/init/unknown_flags/stderr.log +++ /dev/null @@ -1,7 +0,0 @@ -error: unexpected argument '--flag' found - - tip: to pass '--flag' as a value, use '-- --flag' - -Usage: cargo[EXE] init - -For more information, try '--help'. diff --git a/src/tools/cargo/tests/testsuite/init/unknown_flags/stdout.log b/src/tools/cargo/tests/testsuite/init/unknown_flags/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/with_argument/in/foo/.keep b/src/tools/cargo/tests/testsuite/init/with_argument/in/foo/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/init/with_argument/mod.rs b/src/tools/cargo/tests/testsuite/init/with_argument/mod.rs deleted file mode 100644 index 0b5e342a1..000000000 --- a/src/tools/cargo/tests/testsuite/init/with_argument/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -use cargo_test_support::compare::assert_ui; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -use cargo_test_support::curr_dir; - -#[cargo_test] -fn case() { - let project = Project::from_template(curr_dir!().join("in")); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo_ui() - .arg_line("init foo --vcs none") - .current_dir(project_root) - .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/src/tools/cargo/tests/testsuite/init/with_argument/out/foo/Cargo.toml b/src/tools/cargo/tests/testsuite/init/with_argument/out/foo/Cargo.toml deleted file mode 100644 index 1d9cfe317..000000000 --- a/src/tools/cargo/tests/testsuite/init/with_argument/out/foo/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "foo" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/src/tools/cargo/tests/testsuite/init/with_argument/out/foo/src/main.rs b/src/tools/cargo/tests/testsuite/init/with_argument/out/foo/src/main.rs deleted file mode 100644 index e7a11a969..000000000 --- a/src/tools/cargo/tests/testsuite/init/with_argument/out/foo/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/src/tools/cargo/tests/testsuite/init/with_argument/stderr.log b/src/tools/cargo/tests/testsuite/init/with_argument/stderr.log deleted file mode 100644 index 3847e4e4a..000000000 --- a/src/tools/cargo/tests/testsuite/init/with_argument/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/src/tools/cargo/tests/testsuite/init/with_argument/stdout.log b/src/tools/cargo/tests/testsuite/init/with_argument/stdout.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tools/cargo/tests/testsuite/lints.rs b/src/tools/cargo/tests/testsuite/lints.rs index fb31da30a..854de69e9 100644 --- a/src/tools/cargo/tests/testsuite/lints.rs +++ b/src/tools/cargo/tests/testsuite/lints.rs @@ -637,3 +637,58 @@ error: unresolved link to `bar` ) .run(); } + +#[cargo_test] +fn doctest_respects_lints() { + let foo = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [lints.rust] + confusable-idents = 'allow' + "#, + ) + .file( + "src/lib.rs", + r#" +/// Test +/// +/// [`Foo`] +/// +/// ``` +/// let s = "rust"; +/// let s_s = "rust2"; +/// ``` +pub fn f() {} +pub const Ě: i32 = 1; +pub const Ĕ: i32 = 2; +"#, + ) + .build(); + + foo.cargo("check -Zlints") + .masquerade_as_nightly_cargo(&["lints"]) + .with_stderr( + "\ +[CHECKING] foo v0.0.1 ([CWD]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s +", + ) + .run(); + + foo.cargo("test --doc -Zlints") + .masquerade_as_nightly_cargo(&["lints"]) + .with_stderr( + "\ +[COMPILING] foo v0.0.1 ([CWD]) +[FINISHED] test [unoptimized + debuginfo] target(s) in [..]s +[DOCTEST] foo +", + ) + .run(); +} diff --git a/src/tools/cargo/tests/testsuite/lockfile_compat.rs b/src/tools/cargo/tests/testsuite/lockfile_compat.rs index 63148cc07..97dcff123 100644 --- a/src/tools/cargo/tests/testsuite/lockfile_compat.rs +++ b/src/tools/cargo/tests/testsuite/lockfile_compat.rs @@ -966,3 +966,198 @@ version = "0.0.1" let lock = p.read_lockfile(); assert_match_exact(lockfile, &lock); } + +fn create_branch(repo: &git2::Repository, branch: &str, head_id: git2::Oid) { + repo.branch(branch, &repo.find_commit(head_id).unwrap(), true) + .unwrap(); +} + +fn create_tag(repo: &git2::Repository, tag: &str, head_id: git2::Oid) { + repo.tag( + tag, + &repo.find_object(head_id, None).unwrap(), + &repo.signature().unwrap(), + "make a new tag", + false, + ) + .unwrap(); +} + +fn v3_and_git_url_encoded(ref_kind: &str, f: impl FnOnce(&git2::Repository, &str, git2::Oid)) { + let (git_project, repo) = git::new_repo("dep1", |project| { + project + .file("Cargo.toml", &basic_lib_manifest("dep1")) + .file("src/lib.rs", "") + }); + let url = git_project.url(); + let head_id = repo.head().unwrap().target().unwrap(); + // Ref name with special characters + let git_ref = "a-_+#$)"; + f(&repo, git_ref, head_id); + + let lockfile = format!( + r#"# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "dep1" +version = "0.5.0" +source = "git+{url}?{ref_kind}={git_ref}#{head_id}" + +[[package]] +name = "foo" +version = "0.0.1" +dependencies = [ + "dep1", +] +"#, + ); + + let p = project() + .file( + "Cargo.toml", + &format!( + r#" + [package] + name = "foo" + version = "0.0.1" + + [dependencies] + dep1 = {{ git = '{url}', {ref_kind} = '{git_ref}' }} + "#, + ), + ) + .file("src/lib.rs", "") + .file("Cargo.lock", "version = 3") + .build(); + + p.cargo("check") + .with_stderr(format!( + "\ +[UPDATING] git repository `{url}` +[CHECKING] dep1 v0.5.0 ({url}?{ref_kind}={git_ref}#[..]) +[CHECKING] foo v0.0.1 ([CWD]) +[FINISHED] dev [..] +" + )) + .run(); + + let lock = p.read_lockfile(); + assert_match_exact(&lockfile, &lock); + + // v3 doesn't URL-encode URL parameters, but `url` crate does decode as it + // was URL-encoded. Therefore Cargo thinks they are from different source + // and clones the repository again. + p.cargo("check") + .with_stderr(format!( + "\ +[UPDATING] git repository `{url}` +[FINISHED] dev [..] +" + )) + .run(); +} + +#[cargo_test] +fn v3_and_git_url_encoded_branch() { + v3_and_git_url_encoded("branch", create_branch); +} + +#[cargo_test] +fn v3_and_git_url_encoded_tag() { + v3_and_git_url_encoded("tag", create_tag); +} + +#[cargo_test] +fn v3_and_git_url_encoded_rev() { + v3_and_git_url_encoded("rev", create_tag); +} + +fn v4_and_git_url_encoded(ref_kind: &str, f: impl FnOnce(&git2::Repository, &str, git2::Oid)) { + let (git_project, repo) = git::new_repo("dep1", |project| { + project + .file("Cargo.toml", &basic_lib_manifest("dep1")) + .file("src/lib.rs", "") + }); + let url = git_project.url(); + let head_id = repo.head().unwrap().target().unwrap(); + // Ref name with special characters + let git_ref = "a-_+#$)"; + let encoded_ref = "a-_%2B%23%24%29"; + f(&repo, git_ref, head_id); + + let lockfile = format!( + r#"# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "dep1" +version = "0.5.0" +source = "git+{url}?{ref_kind}={encoded_ref}#{head_id}" + +[[package]] +name = "foo" +version = "0.0.1" +dependencies = [ + "dep1", +] +"#, + ); + + let p = project() + .file( + "Cargo.toml", + &format!( + r#" + [package] + name = "foo" + version = "0.0.1" + + [dependencies] + dep1 = {{ git = '{url}', {ref_kind} = '{git_ref}' }} + "#, + ), + ) + .file("src/lib.rs", "") + .file("Cargo.lock", "version = 4") + .build(); + + p.cargo("check -Znext-lockfile-bump") + .masquerade_as_nightly_cargo(&["-Znext-lockfile-bump"]) + .with_stderr(format!( + "\ +[UPDATING] git repository `{url}` +[CHECKING] dep1 v0.5.0 ({url}?{ref_kind}={git_ref}#[..]) +[CHECKING] foo v0.0.1 ([CWD]) +[FINISHED] dev [..] +" + )) + .run(); + + let lock = p.read_lockfile(); + assert_match_exact(&lockfile, &lock); + + // Unlike v3_and_git_url_encoded, v4 encodes URL parameters so no git + // repository re-clone happen. + p.cargo("check -Znext-lockfile-bump") + .masquerade_as_nightly_cargo(&["-Znext-lockfile-bump"]) + .with_stderr("[FINISHED] dev [..]") + .run(); +} + +#[cargo_test] +fn v4_and_git_url_encoded_branch() { + v4_and_git_url_encoded("branch", create_branch); +} + +#[cargo_test] +fn v4_and_git_url_encoded_tag() { + v4_and_git_url_encoded("tag", create_tag); +} + +#[cargo_test] +fn v4_and_git_url_encoded_rev() { + v4_and_git_url_encoded("rev", create_tag) +} diff --git a/src/tools/cargo/tests/testsuite/login.rs b/src/tools/cargo/tests/testsuite/login.rs index 85b299f28..16bd29dce 100644 --- a/src/tools/cargo/tests/testsuite/login.rs +++ b/src/tools/cargo/tests/testsuite/login.rs @@ -109,12 +109,14 @@ fn empty_login_token() { cargo_process("login") .replace_crates_io(registry.index_url()) - .with_stdout("please paste the token found on [..]/me below") .with_stdin("\t\n") .with_stderr( "\ [UPDATING] crates.io index -[ERROR] please provide a non-empty token +[ERROR] credential provider `cargo:token` failed action `login` + +Caused by: + please provide a non-empty token ", ) .with_status(101) @@ -125,7 +127,10 @@ fn empty_login_token() { .arg("") .with_stderr( "\ -[ERROR] please provide a non-empty token +[ERROR] credential provider `cargo:token` failed action `login` + +Caused by: + please provide a non-empty token ", ) .with_status(101) @@ -143,7 +148,6 @@ fn invalid_login_token() { let check = |stdin: &str, stderr: &str, status: i32| { cargo_process("login") .replace_crates_io(registry.index_url()) - .with_stdout("please paste the token found on [..]/me below") .with_stdin(stdin) .with_stderr(stderr) .with_status(status) @@ -153,12 +157,15 @@ fn invalid_login_token() { let invalid = |stdin: &str| { check( stdin, - "[ERROR] token contains invalid characters. -Only printable ISO-8859-1 characters are allowed as it is sent in a HTTPS header.", + "[ERROR] credential provider `cargo:token` failed action `login` + +Caused by: + token contains invalid characters. + Only printable ISO-8859-1 characters are allowed as it is sent in a HTTPS header.", 101, ) }; - let valid = |stdin: &str| check(stdin, "[LOGIN] token for `crates.io` saved", 0); + let valid = |stdin: &str| check(stdin, "[LOGIN] token for `crates-io` saved", 0); // Update config.json so that the rest of the tests don't need to care // whether or not `Updating` is printed. @@ -166,7 +173,7 @@ Only printable ISO-8859-1 characters are allowed as it is sent in a HTTPS header "test", "\ [UPDATING] crates.io index -[LOGIN] token for `crates.io` saved +[LOGIN] token for `crates-io` saved ", 0, ); @@ -184,54 +191,19 @@ Only printable ISO-8859-1 characters are allowed as it is sent in a HTTPS header #[cargo_test] fn bad_asymmetric_token_args() { - // These cases are kept brief as the implementation is covered by clap, so this is only smoke testing that we have clap configured correctly. - cargo_process("login --key-subject=foo tok") - .with_stderr_contains( - "error: the argument '--key-subject ' cannot be used with '[token]'", - ) - .with_status(1) - .run(); - - cargo_process("login --generate-keypair tok") - .with_stderr_contains( - "error: the argument '--generate-keypair' cannot be used with '[token]'", - ) - .with_status(1) - .run(); - - cargo_process("login --secret-key tok") - .with_stderr_contains("error: the argument '--secret-key' cannot be used with '[token]'") - .with_status(1) - .run(); + let registry = RegistryBuilder::new() + .credential_provider(&["cargo:paseto"]) + .no_configure_token() + .build(); - cargo_process("login --generate-keypair --secret-key") + // These cases are kept brief as the implementation is covered by clap, so this is only smoke testing that we have clap configured correctly. + cargo_process("login -Zcredential-process -- --key-subject") + .masquerade_as_nightly_cargo(&["credential-process"]) + .replace_crates_io(registry.index_url()) .with_stderr_contains( - "error: the argument '--generate-keypair' cannot be used with '--secret-key'", + " error: a value is required for '--key-subject ' but none was supplied", ) - .with_status(1) - .run(); -} - -#[cargo_test] -fn asymmetric_requires_nightly() { - let registry = registry::init(); - cargo_process("login --key-subject=foo") - .replace_crates_io(registry.index_url()) - .with_status(101) - .with_stderr_contains("[ERROR] the `key-subject` flag is unstable, pass `-Z registry-auth` to enable it\n\ - See https://github.com/rust-lang/cargo/issues/10519 for more information about the `key-subject` flag.") - .run(); - cargo_process("login --generate-keypair") - .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr_contains("[ERROR] the `generate-keypair` flag is unstable, pass `-Z registry-auth` to enable it\n\ - See https://github.com/rust-lang/cargo/issues/10519 for more information about the `generate-keypair` flag.") - .run(); - cargo_process("login --secret-key") - .replace_crates_io(registry.index_url()) - .with_status(101) - .with_stderr_contains("[ERROR] the `secret-key` flag is unstable, pass `-Z registry-auth` to enable it\n\ - See https://github.com/rust-lang/cargo/issues/10519 for more information about the `secret-key` flag.") .run(); } @@ -249,6 +221,28 @@ fn login_with_no_cargo_dir() { assert_eq!(credentials, "[registry]\ntoken = \"foo\"\n"); } +#[cargo_test] +fn login_with_asymmetric_token_and_subject_on_stdin() { + let registry = RegistryBuilder::new() + .credential_provider(&["cargo:paseto"]) + .no_configure_token() + .build(); + let credentials = credentials_toml(); + cargo_process("login -v -Z credential-process -- --key-subject=foo") + .masquerade_as_nightly_cargo(&["credential-process"]) + .replace_crates_io(registry.index_url()) + .with_stderr_contains( + "\ +k3.public.AmDwjlyf8jAV3gm5Z7Kz9xAOcsKslt_Vwp5v-emjFzBHLCtcANzTaVEghTNEMj9PkQ", + ) + .with_stdin("k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36") + .run(); + let credentials = fs::read_to_string(&credentials).unwrap(); + assert!(credentials.starts_with("[registry]\n")); + assert!(credentials.contains("secret-key-subject = \"foo\"\n")); + assert!(credentials.contains("secret-key = \"k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36\"\n")); +} + #[cargo_test] fn login_with_differently_sized_token() { // Verify that the configuration file gets properly truncated. @@ -278,97 +272,45 @@ fn login_with_token_on_stdin() { .run(); cargo_process("login") .replace_crates_io(registry.index_url()) - .with_stdout("please paste the token found on [..]/me below") .with_stdin("some token") .run(); let credentials = fs::read_to_string(&credentials).unwrap(); assert_eq!(credentials, "[registry]\ntoken = \"some token\"\n"); } -#[cargo_test] -fn login_with_asymmetric_token_and_subject_on_stdin() { - let registry = registry::init(); - let credentials = credentials_toml(); - fs::remove_file(&credentials).unwrap(); - cargo_process("login --key-subject=foo --secret-key -v -Z registry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) - .replace_crates_io(registry.index_url()) - .with_stdout( - "\ - please paste the API secret key below -k3.public.AmDwjlyf8jAV3gm5Z7Kz9xAOcsKslt_Vwp5v-emjFzBHLCtcANzTaVEghTNEMj9PkQ", - ) - .with_stdin("k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36") - .run(); - let credentials = fs::read_to_string(&credentials).unwrap(); - assert!(credentials.starts_with("[registry]\n")); - assert!(credentials.contains("secret-key-subject = \"foo\"\n")); - assert!(credentials.contains("secret-key = \"k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36\"\n")); -} - #[cargo_test] fn login_with_asymmetric_token_on_stdin() { - let registry = registry::init(); + let _registry = RegistryBuilder::new() + .credential_provider(&["cargo:paseto"]) + .alternative() + .no_configure_token() + .build(); let credentials = credentials_toml(); - fs::remove_file(&credentials).unwrap(); - cargo_process("login --secret-key -v -Z registry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) - .replace_crates_io(registry.index_url()) - .with_stdout( + cargo_process("login -vZ credential-process --registry alternative") + .masquerade_as_nightly_cargo(&["credential-process"]) + .with_stderr( "\ - please paste the API secret key below -k3.public.AmDwjlyf8jAV3gm5Z7Kz9xAOcsKslt_Vwp5v-emjFzBHLCtcANzTaVEghTNEMj9PkQ", - ) - .with_stdin("k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36") - .run(); - let credentials = fs::read_to_string(&credentials).unwrap(); - assert_eq!(credentials, "[registry]\nsecret-key = \"k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36\"\n"); -} - -#[cargo_test] -fn login_with_asymmetric_key_subject_without_key() { - let registry = registry::init(); - let credentials = credentials_toml(); - fs::remove_file(&credentials).unwrap(); - cargo_process("login --key-subject=foo -Z registry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) - .replace_crates_io(registry.index_url()) - .with_stderr_contains("error: need a secret_key to set a key_subject") - .with_status(101) - .run(); - - // ok so add a secret_key to the credentials - cargo_process("login --secret-key -v -Z registry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) - .replace_crates_io(registry.index_url()) - .with_stdout( - "please paste the API secret key below +[UPDATING] [..] +[CREDENTIAL] cargo:paseto login alternative k3.public.AmDwjlyf8jAV3gm5Z7Kz9xAOcsKslt_Vwp5v-emjFzBHLCtcANzTaVEghTNEMj9PkQ", ) .with_stdin("k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36") .run(); - - // and then it should work - cargo_process("login --key-subject=foo -Z registry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) - .replace_crates_io(registry.index_url()) - .run(); - let credentials = fs::read_to_string(&credentials).unwrap(); - assert!(credentials.starts_with("[registry]\n")); - assert!(credentials.contains("secret-key-subject = \"foo\"\n")); - assert!(credentials.contains("secret-key = \"k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36\"\n")); + assert_eq!(credentials, "[registries.alternative]\nsecret-key = \"k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36\"\n"); } #[cargo_test] fn login_with_generate_asymmetric_token() { - let registry = registry::init(); + let _registry = RegistryBuilder::new() + .credential_provider(&["cargo:paseto"]) + .alternative() + .no_configure_token() + .build(); let credentials = credentials_toml(); - fs::remove_file(&credentials).unwrap(); - cargo_process("login --generate-keypair -Z registry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) - .replace_crates_io(registry.index_url()) - .with_stdout("k3.public.[..]") + cargo_process("login -Z credential-process --registry alternative") + .masquerade_as_nightly_cargo(&["credential-process"]) + .with_stderr("[UPDATING] `alternative` index\nk3.public.[..]") .run(); let credentials = fs::read_to_string(&credentials).unwrap(); assert!(credentials.contains("secret-key = \"k3.secret.")); diff --git a/src/tools/cargo/tests/testsuite/main.rs b/src/tools/cargo/tests/testsuite/main.rs index 2c282c0a3..8279f5818 100644 --- a/src/tools/cargo/tests/testsuite/main.rs +++ b/src/tools/cargo/tests/testsuite/main.rs @@ -18,15 +18,50 @@ mod build_script; mod build_script_env; mod build_script_extra_link_arg; mod cache_messages; +mod cargo; mod cargo_add; mod cargo_alias_config; +mod cargo_bench; +mod cargo_build; +mod cargo_check; +mod cargo_clean; mod cargo_command; mod cargo_config; +mod cargo_doc; mod cargo_env_config; mod cargo_features; +mod cargo_fetch; +mod cargo_fix; +mod cargo_generate_lockfile; +mod cargo_git_checkout; +mod cargo_help; +mod cargo_init; +mod cargo_install; +mod cargo_locate_project; +mod cargo_login; +mod cargo_logout; +mod cargo_metadata; mod cargo_new; +mod cargo_owner; +mod cargo_package; +mod cargo_pkgid; +mod cargo_publish; +mod cargo_read_manifest; mod cargo_remove; +mod cargo_report; +mod cargo_run; +mod cargo_rustc; +mod cargo_rustdoc; +mod cargo_search; mod cargo_targets; +mod cargo_test; +mod cargo_tree; +mod cargo_uninstall; +mod cargo_update; +mod cargo_vendor; +mod cargo_verify_project; +mod cargo_version; +mod cargo_yank; mod cfg; mod check; mod check_cfg; @@ -65,7 +100,6 @@ mod glob_targets; mod help; mod https; mod inheritable_workspace_fields; -mod init; mod install; mod install_upgrade; mod jobserver; diff --git a/src/tools/cargo/tests/testsuite/owner.rs b/src/tools/cargo/tests/testsuite/owner.rs index 9fc960c92..7b38bcc5e 100644 --- a/src/tools/cargo/tests/testsuite/owner.rs +++ b/src/tools/cargo/tests/testsuite/owner.rs @@ -117,8 +117,8 @@ fn simple_add_with_asymmetric() { // The http_api server will check that the authorization is correct. // If the authorization was not sent then we would get an unauthorized error. p.cargo("owner -a username") - .arg("-Zregistry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) + .arg("-Zcredential-process") + .masquerade_as_nightly_cargo(&["credential-process"]) .replace_crates_io(registry.index_url()) .with_status(0) .run(); @@ -184,9 +184,9 @@ fn simple_remove_with_asymmetric() { // The http_api server will check that the authorization is correct. // If the authorization was not sent then we would get an unauthorized error. p.cargo("owner -r username") - .arg("-Zregistry-auth") + .arg("-Zcredential-process") .replace_crates_io(registry.index_url()) - .masquerade_as_nightly_cargo(&["registry-auth"]) + .masquerade_as_nightly_cargo(&["credential-process"]) .with_status(0) .run(); } diff --git a/src/tools/cargo/tests/testsuite/package.rs b/src/tools/cargo/tests/testsuite/package.rs index 3b4328242..010523fda 100644 --- a/src/tools/cargo/tests/testsuite/package.rs +++ b/src/tools/cargo/tests/testsuite/package.rs @@ -2983,3 +2983,115 @@ src/main.rs.bak ], ); } + +#[cargo_test] +#[cfg(windows)] // windows is the platform that is most consistently configured for case insensitive filesystems +fn normalize_case() { + let p = project() + .file("src/main.rs", r#"fn main() { println!("hello"); }"#) + .file("src/bar.txt", "") // should be ignored when packaging + .build(); + // Workaround `project()` making a `Cargo.toml` on our behalf + std::fs::remove_file(p.root().join("Cargo.toml")).unwrap(); + std::fs::write( + p.root().join("cargo.toml"), + r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + exclude = ["*.txt"] + license = "MIT" + description = "foo" + "#, + ) + .unwrap(); + + p.cargo("package") + .with_stderr( + "\ +[WARNING] manifest has no documentation[..] +See [..] +[PACKAGING] foo v0.0.1 ([CWD]) +[VERIFYING] foo v0.0.1 ([CWD]) +[COMPILING] foo v0.0.1 ([CWD][..]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +[PACKAGED] 4 files, [..] ([..] compressed) +", + ) + .run(); + assert!(p.root().join("target/package/foo-0.0.1.crate").is_file()); + p.cargo("package -l") + .with_stdout( + "\ +Cargo.lock +Cargo.toml +Cargo.toml.orig +src/main.rs +", + ) + .run(); + p.cargo("package").with_stdout("").run(); + + let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); + validate_crate_contents( + f, + "foo-0.0.1.crate", + &["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"], + &[], + ); +} + +#[cargo_test] +#[cfg(target_os = "linux")] // linux is generally configured to be case sensitive +fn mixed_case() { + let manifest = r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + exclude = ["*.txt"] + license = "MIT" + description = "foo" + "#; + let p = project() + .file("Cargo.toml", manifest) + .file("cargo.toml", manifest) + .file("src/main.rs", r#"fn main() { println!("hello"); }"#) + .file("src/bar.txt", "") // should be ignored when packaging + .build(); + + p.cargo("package") + .with_stderr( + "\ +[WARNING] manifest has no documentation[..] +See [..] +[PACKAGING] foo v0.0.1 ([CWD]) +[VERIFYING] foo v0.0.1 ([CWD]) +[COMPILING] foo v0.0.1 ([CWD][..]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +[PACKAGED] 4 files, [..] ([..] compressed) +", + ) + .run(); + assert!(p.root().join("target/package/foo-0.0.1.crate").is_file()); + p.cargo("package -l") + .with_stdout( + "\ +Cargo.lock +Cargo.toml +Cargo.toml.orig +src/main.rs +", + ) + .run(); + p.cargo("package").with_stdout("").run(); + + let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); + validate_crate_contents( + f, + "foo-0.0.1.crate", + &["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"], + &[], + ); +} diff --git a/src/tools/cargo/tests/testsuite/profile_targets.rs b/src/tools/cargo/tests/testsuite/profile_targets.rs index a88ca34fd..f2de169b9 100644 --- a/src/tools/cargo/tests/testsuite/profile_targets.rs +++ b/src/tools/cargo/tests/testsuite/profile_targets.rs @@ -328,7 +328,7 @@ fn profile_selection_test() { [RUNNING] `[..]/deps/foo-[..]` [RUNNING] `[..]/deps/test1-[..]` [DOCTEST] foo -[RUNNING] `rustdoc [..]--test [..] +[RUNNING] `[..] rustdoc [..]--test [..] ").run(); p.cargo("test -vv") .with_stderr_unordered( @@ -341,7 +341,7 @@ fn profile_selection_test() { [RUNNING] `[..]/deps/foo-[..]` [RUNNING] `[..]/deps/test1-[..]` [DOCTEST] foo -[RUNNING] `rustdoc [..]--test [..] +[RUNNING] `[..] rustdoc [..]--test [..] ", ) .run(); @@ -395,7 +395,7 @@ fn profile_selection_test_release() { [RUNNING] `[..]/deps/foo-[..]` [RUNNING] `[..]/deps/test1-[..]` [DOCTEST] foo -[RUNNING] `rustdoc [..]--test [..]` +[RUNNING] `[..] rustdoc [..]--test [..]` ").run(); p.cargo("test --release -vv") .with_stderr_unordered( @@ -408,7 +408,7 @@ fn profile_selection_test_release() { [RUNNING] `[..]/deps/foo-[..]` [RUNNING] `[..]/deps/test1-[..]` [DOCTEST] foo -[RUNNING] `rustdoc [..]--test [..] +[RUNNING] `[..] rustdoc [..]--test [..] ", ) .run(); diff --git a/src/tools/cargo/tests/testsuite/publish.rs b/src/tools/cargo/tests/testsuite/publish.rs index 45b7c7da5..50ad697d5 100644 --- a/src/tools/cargo/tests/testsuite/publish.rs +++ b/src/tools/cargo/tests/testsuite/publish.rs @@ -194,8 +194,8 @@ fn simple_publish_with_asymmetric() { .file("src/main.rs", "fn main() {}") .build(); - p.cargo("publish --no-verify -Zregistry-auth --registry dummy-registry") - .masquerade_as_nightly_cargo(&["registry-auth"]) + p.cargo("publish --no-verify -Zcredential-process --registry dummy-registry") + .masquerade_as_nightly_cargo(&["credential-process"]) .with_stderr( "\ [UPDATING] `dummy-registry` index @@ -338,7 +338,7 @@ fn git_deps() { .file("src/main.rs", "fn main() {}") .build(); - p.cargo("publish -v --no-verify") + p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) .with_stderr( @@ -2023,10 +2023,10 @@ fn api_other_error() { [ERROR] failed to publish to registry at http://127.0.0.1:[..]/ Caused by: - invalid response from server + invalid response body from server Caused by: - response body was not valid utf-8 + invalid utf-8 sequence of [..] ", ) .run(); diff --git a/src/tools/cargo/tests/testsuite/registry.rs b/src/tools/cargo/tests/testsuite/registry.rs index bd5e42b45..8982b1cb6 100644 --- a/src/tools/cargo/tests/testsuite/registry.rs +++ b/src/tools/cargo/tests/testsuite/registry.rs @@ -3529,3 +3529,38 @@ fn unpack_again_when_cargo_ok_is_unrecognized() { let ok = fs::read_to_string(&cargo_ok).unwrap(); assert_eq!(&ok, r#"{"v":1}"#); } + +#[cargo_test] +fn differ_only_by_metadata() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies] + baz = "=0.0.1" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + Package::new("baz", "0.0.1+b").publish(); + Package::new("baz", "0.0.1+c").yanked(true).publish(); + + p.cargo("check") + .with_stderr( + "\ +[UPDATING] `dummy-registry` index +[DOWNLOADING] crates ... +[DOWNLOADED] [..] v0.0.1+b (registry `dummy-registry`) +[CHECKING] baz v0.0.1+b +[CHECKING] foo v0.0.1 ([CWD]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s +", + ) + .run(); +} diff --git a/src/tools/cargo/tests/testsuite/registry_auth.rs b/src/tools/cargo/tests/testsuite/registry_auth.rs index 97cdf6748..4422c638a 100644 --- a/src/tools/cargo/tests/testsuite/registry_auth.rs +++ b/src/tools/cargo/tests/testsuite/registry_auth.rs @@ -6,8 +6,9 @@ use cargo_test_support::{project, Execs, Project}; fn cargo(p: &Project, s: &str) -> Execs { let mut e = p.cargo(s); - e.masquerade_as_nightly_cargo(&["registry-auth"]) - .arg("-Zregistry-auth"); + e.masquerade_as_nightly_cargo(&["registry-auth", "credential-process"]) + .arg("-Zregistry-auth") + .arg("-Zcredential-process"); e } @@ -148,95 +149,6 @@ fn environment_token_with_asymmetric() { .run(); } -#[cargo_test] -fn warn_both_asymmetric_and_token() { - let _server = RegistryBuilder::new() - .alternative() - .no_configure_token() - .build(); - let p = project() - .file( - ".cargo/config", - r#" - [registries.alternative] - token = "sekrit" - secret-key = "k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36" - "#, - ) - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.1.0" - description = "foo" - authors = [] - license = "MIT" - homepage = "https://example.com/" - "#, - ) - .file("src/lib.rs", "") - .build(); - - p.cargo("publish --no-verify --registry alternative") - .masquerade_as_nightly_cargo(&["credential-process", "registry-auth"]) - .arg("-Zregistry-auth") - .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[ERROR] both `token` and `secret-key` were specified in the config for registry `alternative`. -Only one of these values may be set, remove one or the other to proceed. -", - ) - .run(); -} - -#[cargo_test] -fn warn_both_asymmetric_and_credential_process() { - let _server = RegistryBuilder::new() - .alternative() - .no_configure_token() - .build(); - let p = project() - .file( - ".cargo/config", - r#" - [registries.alternative] - credential-process = "false" - secret-key = "k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36" - "#, - ) - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.1.0" - description = "foo" - authors = [] - license = "MIT" - homepage = "https://example.com/" - "#, - ) - .file("src/lib.rs", "") - .build(); - - p.cargo("publish --no-verify --registry alternative") - .masquerade_as_nightly_cargo(&["credential-process", "registry-auth"]) - .arg("-Zcredential-process") - .arg("-Zregistry-auth") - .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[ERROR] both `credential-process` and `secret-key` were specified in the config for registry `alternative`. -Only one of these values may be set, remove one or the other to proceed. -", - ) - .run(); -} - #[cargo_test] fn bad_environment_token_with_asymmetric_subject() { let registry = RegistryBuilder::new() @@ -463,7 +375,6 @@ fn login() { let p = make_project(); cargo(&p, "login --registry alternative") - .with_stdout("please paste the token found on https://test-registry-login/me below") .with_stdin("sekrit") .run(); } @@ -478,7 +389,6 @@ fn login_existing_token() { let p = make_project(); cargo(&p, "login --registry alternative") - .with_stdout("please paste the token found on file://[..]/me below") .with_stdin("sekrit") .run(); } diff --git a/src/tools/cargo/tests/testsuite/run.rs b/src/tools/cargo/tests/testsuite/run.rs index 586502288..64cf4e16c 100644 --- a/src/tools/cargo/tests/testsuite/run.rs +++ b/src/tools/cargo/tests/testsuite/run.rs @@ -1,6 +1,8 @@ //! Tests for the `cargo run` command. -use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, project, Project}; +use cargo_test_support::{ + basic_bin_manifest, basic_lib_manifest, basic_manifest, project, Project, +}; use cargo_util::paths::dylib_path_envvar; #[cargo_test] @@ -1416,6 +1418,24 @@ fn default_run_workspace() { p.cargo("run").with_stdout("run-a").run(); } +#[cargo_test] +fn print_env_verbose() { + let p = project() + .file("Cargo.toml", &basic_manifest("a", "0.0.1")) + .file("src/main.rs", r#"fn main() {println!("run-a");}"#) + .build(); + + p.cargo("run -vv") + .with_stderr( + "\ +[COMPILING] a v0.0.1 ([CWD]) +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] rustc --crate-name a[..]` +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] target/debug/a[EXE]`", + ) + .run(); +} + #[cargo_test] #[cfg(target_os = "macos")] fn run_link_system_path_macos() { diff --git a/src/tools/cargo/tests/testsuite/script.rs b/src/tools/cargo/tests/testsuite/script.rs index fcf58de69..0c0441d62 100644 --- a/src/tools/cargo/tests/testsuite/script.rs +++ b/src/tools/cargo/tests/testsuite/script.rs @@ -35,7 +35,7 @@ args: [] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] echo v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/echo[EXE]` @@ -59,7 +59,7 @@ args: [] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] echo v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/echo[EXE]` @@ -136,7 +136,7 @@ args: [] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] echo v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/echo[EXE]` @@ -260,7 +260,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE]` @@ -289,7 +289,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE]` @@ -306,7 +306,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE]` ", @@ -323,7 +323,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE]` @@ -435,7 +435,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE]` @@ -460,7 +460,7 @@ args: ["-NotAnArg"] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE] -NotAnArg` @@ -485,7 +485,7 @@ args: ["-NotAnArg"] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE] -NotAnArg` @@ -510,7 +510,7 @@ args: ["--help"] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE] --help` @@ -534,7 +534,7 @@ args: [] "#, ) .with_stderr( - r#"[WARNING] `package.edition` is unspecifiead, defaulting to `2021` + r#"[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] s-h-w-c- v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/s-h-w-c-[EXE]` @@ -543,6 +543,52 @@ args: [] .run(); } +#[cargo_test] +fn test_name_has_leading_number() { + let script = ECHO_SCRIPT; + let p = cargo_test_support::project() + .file("42answer.rs", script) + .build(); + + p.cargo("-Zscript -v 42answer.rs") + .masquerade_as_nightly_cargo(&["script"]) + .with_stdout( + r#"bin: [..]/debug/answer[EXE] +args: [] +"#, + ) + .with_stderr( + r#"[WARNING] `package.edition` is unspecified, defaulting to `2021` +[COMPILING] answer v0.0.0 ([ROOT]/foo) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s +[RUNNING] `[..]/debug/answer[EXE]` +"#, + ) + .run(); +} + +#[cargo_test] +fn test_name_is_number() { + let script = ECHO_SCRIPT; + let p = cargo_test_support::project().file("42.rs", script).build(); + + p.cargo("-Zscript -v 42.rs") + .masquerade_as_nightly_cargo(&["script"]) + .with_stdout( + r#"bin: [..]/debug/package[EXE] +args: [] +"#, + ) + .with_stderr( + r#"[WARNING] `package.edition` is unspecified, defaulting to `2021` +[COMPILING] package v0.0.0 ([ROOT]/foo) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s +[RUNNING] `[..]/debug/package[EXE]` +"#, + ) + .run(); +} + #[cargo_test] fn script_like_dir() { let p = cargo_test_support::project() @@ -600,7 +646,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [UPDATING] `dummy-registry` index [DOWNLOADING] crates ... [DOWNLOADED] script v1.0.0 (registry `dummy-registry`) @@ -640,7 +686,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] bar v0.0.1 ([ROOT]/foo/bar) [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s @@ -670,7 +716,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE] --help` @@ -699,7 +745,7 @@ fn main() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE] --help` @@ -724,7 +770,7 @@ args: [] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[ROOT]/home/.cargo/target/[..]/debug/script[EXE]` @@ -752,7 +798,7 @@ args: [] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[ROOT]/home/.cargo/target/[..]/debug/script[EXE]` @@ -815,7 +861,7 @@ fn cmd_check_with_embedded() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [CHECKING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s ", @@ -876,7 +922,7 @@ fn cmd_build_with_embedded() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s ", @@ -904,7 +950,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] test [unoptimized + debuginfo] target(s) in [..]s [RUNNING] unittests script.rs ([..]) @@ -933,7 +979,7 @@ fn cmd_clean_with_embedded() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` ", ) .run(); @@ -954,7 +1000,7 @@ fn cmd_generate_lockfile_with_embedded() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` ", ) .run(); @@ -1039,7 +1085,7 @@ fn cmd_metadata_with_embedded() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` ", ) .run(); @@ -1095,7 +1141,7 @@ fn cmd_read_manifest_with_embedded() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` ", ) .run(); @@ -1116,7 +1162,7 @@ args: [] ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` [COMPILING] script v0.0.0 ([ROOT]/foo) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s [RUNNING] `[..]/debug/script[EXE]` @@ -1140,7 +1186,7 @@ script v0.0.0 ([ROOT]/foo) ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` ", ) .run(); @@ -1160,7 +1206,7 @@ fn cmd_update_with_embedded() { ) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` ", ) .run(); @@ -1177,7 +1223,61 @@ fn cmd_verify_project_with_embedded() { .with_json(r#"{"success":"true"}"#) .with_stderr( "\ -[WARNING] `package.edition` is unspecifiead, defaulting to `2021` +[WARNING] `package.edition` is unspecified, defaulting to `2021` +", + ) + .run(); +} + +#[cargo_test] +fn cmd_pkgid_with_embedded() { + let p = cargo_test_support::project() + .file("script.rs", ECHO_SCRIPT) + .build(); + + p.cargo("-Zscript pkgid --manifest-path script.rs") + .masquerade_as_nightly_cargo(&["script"]) + .with_status(101) + .with_stderr( + "\ +[WARNING] `package.edition` is unspecified, defaulting to `2021` +[ERROR] [ROOT]/foo/script.rs is unsupported by `cargo pkgid` +", + ) + .run(); +} + +#[cargo_test] +fn cmd_package_with_embedded() { + let p = cargo_test_support::project() + .file("script.rs", ECHO_SCRIPT) + .build(); + + p.cargo("-Zscript package --manifest-path script.rs") + .masquerade_as_nightly_cargo(&["script"]) + .with_status(101) + .with_stderr( + "\ +[WARNING] `package.edition` is unspecified, defaulting to `2021` +[ERROR] [ROOT]/foo/script.rs is unsupported by `cargo package` +", + ) + .run(); +} + +#[cargo_test] +fn cmd_publish_with_embedded() { + let p = cargo_test_support::project() + .file("script.rs", ECHO_SCRIPT) + .build(); + + p.cargo("-Zscript publish --manifest-path script.rs") + .masquerade_as_nightly_cargo(&["script"]) + .with_status(101) + .with_stderr( + "\ +[WARNING] `package.edition` is unspecified, defaulting to `2021` +[ERROR] [ROOT]/foo/script.rs is unsupported by `cargo publish` ", ) .run(); diff --git a/src/tools/cargo/tests/testsuite/test.rs b/src/tools/cargo/tests/testsuite/test.rs index 6a062cfb6..c6ae4ce61 100644 --- a/src/tools/cargo/tests/testsuite/test.rs +++ b/src/tools/cargo/tests/testsuite/test.rs @@ -389,10 +389,10 @@ failures: ---- test_hello stdout ---- [..]thread '[..]' panicked at [..]", ) - .with_stdout_contains("[..]assertion failed[..]") - .with_stdout_contains("[..]`(left == right)`[..]") - .with_stdout_contains("[..]left: `\"hello\"`,[..]") - .with_stdout_contains("[..]right: `\"nope\"`[..]") + .with_stdout_contains("[..]assertion [..]failed[..]") + .with_stdout_contains("[..]left == right[..]") + .with_stdout_contains("[..]left: [..]\"hello\"[..]") + .with_stdout_contains("[..]right: [..]\"nope\"[..]") .with_stdout_contains("[..]src/main.rs:12[..]") .with_stdout_contains( "\ @@ -4792,6 +4792,21 @@ error: test failed, to rerun pass `--test t1` [RUNNING] tests/t2.rs (target/debug/deps/t2[..]) error: test failed, to rerun pass `--test t2` +Caused by: + process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2[..]` (exit [..]: 4) +note: test exited abnormally; to see the full output pass --nocapture to the harness. +", + ) + .with_status(4) + .run(); + + p.cargo("test --test t2 -- --nocapture") + .with_stderr( + "\ +[FINISHED] test [..] +[RUNNING] tests/t2.rs (target/debug/deps/t2[..]) +error: test failed, to rerun pass `--test t2` + Caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2[..]` (exit [..]: 4) ", @@ -4811,6 +4826,7 @@ error: test failed, to rerun pass `--test t2` Caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2[..]` (exit [..]: 4) +note: test exited abnormally; to see the full output pass --nocapture to the harness. error: 2 targets failed: `--test t1` `--test t2` @@ -4818,4 +4834,51 @@ error: 2 targets failed: ) .with_status(101) .run(); + + p.cargo("test --no-fail-fast -- --nocapture") + .with_stderr_does_not_contain("test exited abnormally; to see the full output pass --nocapture to the harness.") + .with_stderr_contains("[..]thread 't' panicked [..] tests/t1[..]") + .with_stderr_contains("note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace") + .with_stderr_contains("[..]process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2[..]` (exit [..]: 4)") + .with_status(101) + .run(); +} + +#[cargo_test] +fn cargo_test_no_keep_going() { + let p = project() + .file("Cargo.toml", &basic_bin_manifest("foo")) + .file("src/main.rs", "") + .build(); + + p.cargo("test --keep-going") + .with_stderr( + "\ +error: unexpected argument `--keep-going` found + + tip: to run as many tests as possible without failing fast, use `--no-fail-fast`", + ) + .with_status(101) + .run(); +} + +#[cargo_test] +fn cargo_test_print_env_verbose() { + let p = project() + .file("Cargo.toml", &basic_manifest("foo", "0.0.1")) + .file("src/lib.rs", "") + .build(); + + p.cargo("test -vv") + .with_stderr( + "\ +[COMPILING] foo v0.0.1 ([CWD]) +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] rustc --crate-name foo[..]` +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] rustc --crate-name foo[..]` +[FINISHED] test [unoptimized + debuginfo] target(s) in [..] +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] [CWD]/target/debug/deps/foo-[..][EXE]` +[DOCTEST] foo +[RUNNING] `[..]CARGO_MANIFEST_DIR=[CWD][..] rustdoc --crate-type lib --crate-name foo[..]", + ) + .run(); } diff --git a/src/tools/cargo/tests/testsuite/update.rs b/src/tools/cargo/tests/testsuite/update.rs index 1d3ee05b7..d42345355 100644 --- a/src/tools/cargo/tests/testsuite/update.rs +++ b/src/tools/cargo/tests/testsuite/update.rs @@ -464,6 +464,46 @@ fn update_aggressive() { .run(); } +#[cargo_test] +fn update_aggressive_conflicts_with_precise() { + Package::new("log", "0.1.0").publish(); + Package::new("serde", "0.2.1").dep("log", "0.1").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "bar" + version = "0.0.1" + authors = [] + + [dependencies] + serde = "0.2" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("check").run(); + + Package::new("log", "0.1.1").publish(); + Package::new("serde", "0.2.2").dep("log", "0.1").publish(); + + p.cargo("update -p serde:0.2.1 --precise 0.2.2 --aggressive") + .with_status(1) + .with_stderr( + "\ +error: the argument '--precise ' cannot be used with '--aggressive' + +Usage: cargo[EXE] update --package [] --precise + +For more information, try '--help'. +", + ) + .run(); +} + // cargo update should respect its arguments even without a lockfile. // See issue "Running cargo update without a Cargo.lock ignores arguments" // at . diff --git a/src/tools/cargo/tests/testsuite/yank.rs b/src/tools/cargo/tests/testsuite/yank.rs index 684a04508..c0bd24776 100644 --- a/src/tools/cargo/tests/testsuite/yank.rs +++ b/src/tools/cargo/tests/testsuite/yank.rs @@ -76,14 +76,14 @@ fn explicit_version_with_asymmetric() { // The http_api server will check that the authorization is correct. // If the authorization was not sent then we would get an unauthorized error. p.cargo("yank --version 0.0.1") - .arg("-Zregistry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) + .arg("-Zcredential-process") + .masquerade_as_nightly_cargo(&["credential-process"]) .replace_crates_io(registry.index_url()) .run(); p.cargo("yank --undo --version 0.0.1") - .arg("-Zregistry-auth") - .masquerade_as_nightly_cargo(&["registry-auth"]) + .arg("-Zcredential-process") + .masquerade_as_nightly_cargo(&["credential-process"]) .replace_crates_io(registry.index_url()) .run(); } -- cgit v1.2.3