From 92fbc4e34482c2ecae8fcd513a590e8e6638ce5f Mon Sep 17 00:00:00 2001 From: Scott Schafer Date: Fri, 6 May 2022 20:51:29 -0500 Subject: [PATCH 1/2] move all `snapshot/cargo_add/` tests to `testsuite/cargo_add/` --- crates/cargo-test-support/src/lib.rs | 7 + tests/testsuite/cargo_add.rs | 2354 ----------------- .../cargo_add}/add-basic.in/Cargo.toml | 0 .../cargo_add}/add-basic.in/src/lib.rs | 0 .../add => testsuite/cargo_add}/add_basic/in | 0 tests/testsuite/cargo_add/add_basic/mod.rs | 25 + .../cargo_add}/add_basic/out/Cargo.toml | 0 .../cargo_add}/add_basic/stderr.log | 0 .../cargo_add}/add_basic/stdout.log | 0 .../cargo_add}/add_multiple/in | 0 tests/testsuite/cargo_add/add_multiple/mod.rs | 25 + .../cargo_add}/add_multiple/out/Cargo.toml | 0 .../cargo_add}/add_multiple/stderr.log | 0 .../cargo_add}/add_multiple/stdout.log | 0 .../add_normalized_name_external/in | 0 .../add_normalized_name_external/mod.rs | 25 + .../out/Cargo.toml | 0 .../add_normalized_name_external/stderr.log | 0 .../add_normalized_name_external/stdout.log | 0 .../add => testsuite/cargo_add}/build/in | 0 tests/testsuite/cargo_add/build/mod.rs | 25 + .../cargo_add}/build/out/Cargo.toml | 0 .../cargo_add}/build/stderr.log | 0 .../cargo_add}/build/stdout.log | 0 .../change_rename_target/in/Cargo.toml | 0 .../change_rename_target/in/src/lib.rs | 0 .../cargo_add/change_rename_target/mod.rs | 25 + .../change_rename_target/out/Cargo.toml | 0 .../change_rename_target/stderr.log | 0 .../change_rename_target/stdout.log | 0 .../cargo_add}/default_features/in | 0 .../cargo_add/default_features/mod.rs | 25 + .../default_features/out/Cargo.toml | 0 .../cargo_add}/default_features/stderr.log | 0 .../cargo_add}/default_features/stdout.log | 0 .../deprecated_default_features/in/Cargo.toml | 0 .../deprecated_default_features/in/src/lib.rs | 0 .../deprecated_default_features/mod.rs | 25 + .../out/Cargo.toml | 0 .../deprecated_default_features/stderr.log | 0 .../deprecated_default_features/stdout.log | 0 .../deprecated_section/in/Cargo.toml | 0 .../deprecated_section/in/src/lib.rs | 0 .../cargo_add/deprecated_section/mod.rs | 25 + .../deprecated_section/out/Cargo.toml | 0 .../cargo_add}/deprecated_section/stderr.log | 0 .../cargo_add}/deprecated_section/stdout.log | 0 .../detect_workspace_inherit/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../cargo_add/detect_workspace_inherit/mod.rs | 26 + .../detect_workspace_inherit/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../detect_workspace_inherit/stderr.log | 0 .../detect_workspace_inherit/stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../detect_workspace_inherit_features/mod.rs | 26 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../detect_workspace_inherit_optional/mod.rs | 26 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../add => testsuite/cargo_add}/dev/in | 0 tests/testsuite/cargo_add/dev/mod.rs | 25 + .../cargo_add}/dev/out/Cargo.toml | 0 .../cargo_add}/dev/stderr.log | 0 .../cargo_add}/dev/stdout.log | 0 .../cargo_add}/dev_build_conflict/in | 0 .../cargo_add/dev_build_conflict/mod.rs | 25 + .../dev_build_conflict/out/Cargo.toml | 0 .../cargo_add}/dev_build_conflict/stderr.log | 0 .../cargo_add}/dev_build_conflict/stdout.log | 0 .../dev_prefer_existing_version/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../dev_prefer_existing_version/in/src/lib.rs | 0 .../dev_prefer_existing_version/mod.rs | 25 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../dev_prefer_existing_version/stderr.log | 0 .../dev_prefer_existing_version/stdout.log | 0 .../add => testsuite/cargo_add}/dry_run/in | 0 tests/testsuite/cargo_add/dry_run/mod.rs | 25 + .../cargo_add}/dry_run/out/Cargo.toml | 0 .../cargo_add}/dry_run/stderr.log | 0 .../cargo_add}/dry_run/stdout.log | 0 .../add => testsuite/cargo_add}/features/in | 0 tests/testsuite/cargo_add/features/mod.rs | 25 + .../cargo_add}/features/out/Cargo.toml | 0 .../cargo_add}/features/stderr.log | 0 .../cargo_add}/features/stdout.log | 0 .../cargo_add}/features_empty/in | 0 .../testsuite/cargo_add/features_empty/mod.rs | 25 + .../cargo_add}/features_empty/out/Cargo.toml | 0 .../cargo_add}/features_empty/stderr.log | 0 .../cargo_add}/features_empty/stdout.log | 0 .../features_multiple_occurrences/in | 0 .../features_multiple_occurrences/mod.rs | 25 + .../out/Cargo.toml | 0 .../features_multiple_occurrences/stderr.log | 0 .../features_multiple_occurrences/stdout.log | 0 .../features_preserve/in/Cargo.toml | 0 .../features_preserve/in/src/lib.rs | 0 .../cargo_add/features_preserve/mod.rs | 25 + .../features_preserve/out/Cargo.toml | 0 .../cargo_add}/features_preserve/stderr.log | 0 .../cargo_add}/features_preserve/stdout.log | 0 .../cargo_add}/features_spaced_values/in | 0 .../cargo_add/features_spaced_values/mod.rs | 25 + .../features_spaced_values/out/Cargo.toml | 0 .../features_spaced_values/stderr.log | 0 .../features_spaced_values/stdout.log | 0 .../cargo_add}/features_unknown/in | 0 .../cargo_add/features_unknown/mod.rs | 25 + .../features_unknown/out/Cargo.toml | 0 .../cargo_add}/features_unknown/stderr.log | 0 .../cargo_add}/features_unknown/stdout.log | 0 .../add => testsuite/cargo_add}/git/in | 0 tests/testsuite/cargo_add/git/mod.rs | 34 + .../cargo_add}/git/out/Cargo.toml | 0 .../cargo_add}/git/stderr.log | 0 .../cargo_add}/git/stdout.log | 0 .../add => testsuite/cargo_add}/git_branch/in | 0 tests/testsuite/cargo_add/git_branch/mod.rs | 37 + .../cargo_add}/git_branch/out/Cargo.toml | 0 .../cargo_add}/git_branch/stderr.log | 0 .../cargo_add}/git_branch/stdout.log | 0 .../cargo_add}/git_conflicts_namever/in | 0 .../cargo_add/git_conflicts_namever/mod.rs | 29 + .../git_conflicts_namever/out/Cargo.toml | 0 .../git_conflicts_namever/stderr.log | 0 .../git_conflicts_namever/stdout.log | 0 .../add => testsuite/cargo_add}/git_dev/in | 0 tests/testsuite/cargo_add/git_dev/mod.rs | 34 + .../cargo_add}/git_dev/out/Cargo.toml | 0 .../cargo_add}/git_dev/stderr.log | 0 .../cargo_add}/git_dev/stdout.log | 0 .../cargo_add}/git_inferred_name/in | 0 .../cargo_add/git_inferred_name/mod.rs | 34 + .../git_inferred_name/out/Cargo.toml | 0 .../cargo_add}/git_inferred_name/stderr.log | 0 .../cargo_add}/git_inferred_name/stdout.log | 0 .../cargo_add}/git_inferred_name_multiple/in | 0 .../git_inferred_name_multiple/mod.rs | 39 + .../git_inferred_name_multiple/out/Cargo.toml | 0 .../git_inferred_name_multiple/stderr.log | 0 .../git_inferred_name_multiple/stdout.log | 0 .../cargo_add}/git_multiple_names/in | 0 .../cargo_add/git_multiple_names/mod.rs | 39 + .../git_multiple_names/out/Cargo.toml | 0 .../cargo_add}/git_multiple_names/stderr.log | 0 .../cargo_add}/git_multiple_names/stdout.log | 0 .../cargo_add}/git_normalized_name/in | 0 .../cargo_add/git_normalized_name/mod.rs | 34 + .../git_normalized_name/out/Cargo.toml | 0 .../cargo_add}/git_normalized_name/stderr.log | 0 .../cargo_add}/git_normalized_name/stdout.log | 0 .../cargo_add}/git_registry/in/Cargo.toml | 0 .../cargo_add}/git_registry/in/src/lib.rs | 0 tests/testsuite/cargo_add/git_registry/mod.rs | 40 + .../cargo_add}/git_registry/out/Cargo.toml | 0 .../cargo_add}/git_registry/stderr.log | 0 .../cargo_add}/git_registry/stdout.log | 0 .../add => testsuite/cargo_add}/git_rev/in | 0 tests/testsuite/cargo_add/git_rev/mod.rs | 36 + .../cargo_add}/git_rev/out/Cargo.toml | 0 .../cargo_add}/git_rev/stderr.log | 0 .../cargo_add}/git_rev/stdout.log | 0 .../add => testsuite/cargo_add}/git_tag/in | 0 tests/testsuite/cargo_add/git_tag/mod.rs | 36 + .../cargo_add}/git_tag/out/Cargo.toml | 0 .../cargo_add}/git_tag/stderr.log | 0 .../cargo_add}/git_tag/stdout.log | 0 .../cargo_add}/infer_prerelease/in | 0 .../cargo_add/infer_prerelease/mod.rs | 25 + .../infer_prerelease/out/Cargo.toml | 0 .../cargo_add}/infer_prerelease/stderr.log | 0 .../cargo_add}/infer_prerelease/stdout.log | 0 .../cargo_add}/invalid_arg/in | 0 tests/testsuite/cargo_add/invalid_arg/mod.rs | 25 + .../cargo_add}/invalid_arg/out/Cargo.toml | 0 .../cargo_add}/invalid_arg/stderr.log | 0 .../cargo_add}/invalid_arg/stdout.log | 0 .../cargo_add}/invalid_git_external/in | 0 .../cargo_add/invalid_git_external/mod.rs | 28 + .../invalid_git_external/out/Cargo.toml | 0 .../invalid_git_external/stderr.log | 0 .../invalid_git_external/stdout.log | 0 .../cargo_add}/invalid_git_name/in | 0 .../cargo_add/invalid_git_name/mod.rs | 34 + .../invalid_git_name/out/Cargo.toml | 0 .../cargo_add}/invalid_git_name/stderr.log | 0 .../cargo_add}/invalid_git_name/stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../invalid_key_inherit_dependency/mod.rs | 24 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../invalid_key_inherit_dependency/stderr.log | 0 .../invalid_key_inherit_dependency/stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../mod.rs | 24 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency-alt/Cargo.toml | 0 .../in/dependency-alt/src/lib.rs | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../mod.rs | 24 + .../out/Cargo.toml | 0 .../out/dependency-alt/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../cargo_add}/invalid_manifest/in/Cargo.toml | 0 .../cargo_add}/invalid_manifest/in/src/lib.rs | 0 .../cargo_add/invalid_manifest/mod.rs | 25 + .../invalid_manifest/out/Cargo.toml | 0 .../cargo_add}/invalid_manifest/stderr.log | 0 .../cargo_add}/invalid_manifest/stdout.log | 0 .../cargo_add}/invalid_name_external/in | 0 .../cargo_add/invalid_name_external/mod.rs | 25 + .../invalid_name_external/out/Cargo.toml | 0 .../invalid_name_external/stderr.log | 0 .../invalid_name_external/stdout.log | 0 .../cargo_add}/invalid_path/in | 0 tests/testsuite/cargo_add/invalid_path/mod.rs | 25 + .../cargo_add}/invalid_path/out/Cargo.toml | 0 .../cargo_add}/invalid_path/stderr.log | 0 .../cargo_add}/invalid_path/stdout.log | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../invalid_path_name/in/primary/Cargo.toml | 0 .../invalid_path_name/in/primary/src/lib.rs | 0 .../cargo_add/invalid_path_name/mod.rs | 25 + .../out/dependency/Cargo.toml | 0 .../invalid_path_name/out/primary/Cargo.toml | 0 .../cargo_add}/invalid_path_name/stderr.log | 0 .../cargo_add}/invalid_path_name/stdout.log | 0 .../cargo_add}/invalid_path_self/in | 0 .../cargo_add/invalid_path_self/mod.rs | 25 + .../invalid_path_self/out/Cargo.toml | 0 .../cargo_add}/invalid_path_self/stderr.log | 0 .../cargo_add}/invalid_path_self/stdout.log | 0 .../cargo_add}/invalid_target_empty/in | 0 .../cargo_add/invalid_target_empty/mod.rs | 25 + .../invalid_target_empty/out/Cargo.toml | 0 .../invalid_target_empty/stderr.log | 0 .../invalid_target_empty/stdout.log | 0 .../cargo_add}/invalid_vers/in | 0 tests/testsuite/cargo_add/invalid_vers/mod.rs | 25 + .../cargo_add}/invalid_vers/out/Cargo.toml | 0 .../cargo_add}/invalid_vers/stderr.log | 0 .../cargo_add}/invalid_vers/stdout.log | 0 .../cargo_add}/list_features/in | 0 .../testsuite/cargo_add/list_features/mod.rs | 25 + .../cargo_add}/list_features/out/Cargo.toml | 0 .../cargo_add}/list_features/stderr.log | 0 .../cargo_add}/list_features/stdout.log | 0 .../list_features_path/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../list_features_path/in/optional/Cargo.toml | 0 .../list_features_path/in/optional/src/lib.rs | 0 .../list_features_path/in/primary/Cargo.toml | 0 .../list_features_path/in/primary/src/lib.rs | 0 .../cargo_add/list_features_path/mod.rs | 25 + .../list_features_path/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../list_features_path/out/primary/Cargo.toml | 0 .../cargo_add}/list_features_path/stderr.log | 0 .../cargo_add}/list_features_path/stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/optional/Cargo.toml | 0 .../in/optional/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../list_features_path_no_default/mod.rs | 30 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../list_features_path_no_default/stderr.log | 0 .../list_features_path_no_default/stdout.log | 0 .../manifest_path_package/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../cargo_add/manifest_path_package/mod.rs | 31 + .../manifest_path_package/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../manifest_path_package/stderr.log | 0 .../manifest_path_package/stdout.log | 0 .../merge_activated_features/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../cargo_add/merge_activated_features/mod.rs | 24 + .../merge_activated_features/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../merge_activated_features/stderr.log | 0 .../merge_activated_features/stdout.log | 0 tests/testsuite/cargo_add/mod.rs | 186 ++ .../multiple_conflicts_with_features/in | 0 .../multiple_conflicts_with_features/mod.rs | 25 + .../out/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../multiple_conflicts_with_rename/in | 0 .../multiple_conflicts_with_rename/mod.rs | 25 + .../out/Cargo.toml | 0 .../multiple_conflicts_with_rename/stderr.log | 0 .../multiple_conflicts_with_rename/stdout.log | 0 .../add => testsuite/cargo_add}/namever/in | 0 tests/testsuite/cargo_add/namever/mod.rs | 25 + .../cargo_add}/namever/out/Cargo.toml | 0 .../cargo_add}/namever/stderr.log | 0 .../cargo_add}/namever/stdout.log | 0 .../add => testsuite/cargo_add}/no_args/in | 0 tests/testsuite/cargo_add/no_args/mod.rs | 24 + .../cargo_add}/no_args/out/Cargo.toml | 0 .../cargo_add}/no_args/stderr.log | 0 .../cargo_add}/no_args/stdout.log | 0 .../cargo_add}/no_default_features/in | 0 .../cargo_add/no_default_features/mod.rs | 25 + .../no_default_features/out/Cargo.toml | 0 .../cargo_add}/no_default_features/stderr.log | 0 .../cargo_add}/no_default_features/stdout.log | 0 .../cargo_add}/no_optional/in | 0 tests/testsuite/cargo_add/no_optional/mod.rs | 25 + .../cargo_add}/no_optional/out/Cargo.toml | 0 .../cargo_add}/no_optional/stderr.log | 0 .../cargo_add}/no_optional/stdout.log | 0 .../add => testsuite/cargo_add}/optional/in | 0 tests/testsuite/cargo_add/optional/mod.rs | 25 + .../cargo_add}/optional/out/Cargo.toml | 0 .../cargo_add}/optional/stderr.log | 0 .../cargo_add}/optional/stdout.log | 0 .../overwrite_default_features/in/Cargo.toml | 0 .../overwrite_default_features/in/src/lib.rs | 0 .../overwrite_default_features/mod.rs | 25 + .../overwrite_default_features/out/Cargo.toml | 0 .../overwrite_default_features/stderr.log | 0 .../overwrite_default_features/stdout.log | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../mod.rs | 25 + .../out/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../overwrite_features/in/Cargo.toml | 0 .../overwrite_features/in/src/lib.rs | 0 .../cargo_add/overwrite_features/mod.rs | 25 + .../overwrite_features/out/Cargo.toml | 0 .../cargo_add}/overwrite_features/stderr.log | 0 .../cargo_add}/overwrite_features/stdout.log | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../cargo_add/overwrite_git_with_path/mod.rs | 25 + .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../overwrite_git_with_path/stderr.log | 0 .../overwrite_git_with_path/stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../overwrite_inherit_features_noop/mod.rs | 24 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../overwrite_inherit_noop/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../cargo_add/overwrite_inherit_noop/mod.rs | 26 + .../overwrite_inherit_noop/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../overwrite_inherit_noop/stderr.log | 0 .../overwrite_inherit_noop/stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../overwrite_inherit_optional_noop/mod.rs | 26 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../overwrite_inline_features/in/Cargo.toml | 0 .../overwrite_inline_features/in/src/lib.rs | 0 .../overwrite_inline_features/mod.rs | 27 + .../overwrite_inline_features/out/Cargo.toml | 0 .../overwrite_inline_features/stderr.log | 0 .../overwrite_inline_features/stdout.log | 0 .../overwrite_name_dev_noop/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../overwrite_name_dev_noop/in/src/lib.rs | 0 .../cargo_add/overwrite_name_dev_noop/mod.rs | 25 + .../overwrite_name_dev_noop/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../overwrite_name_dev_noop/stderr.log | 0 .../overwrite_name_dev_noop/stdout.log | 0 .../overwrite_name_noop/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../overwrite_name_noop/in/src/lib.rs | 0 .../cargo_add/overwrite_name_noop/mod.rs | 25 + .../overwrite_name_noop/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../cargo_add}/overwrite_name_noop/stderr.log | 0 .../cargo_add}/overwrite_name_noop/stdout.log | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../overwrite_no_default_features/mod.rs | 25 + .../out/Cargo.toml | 0 .../overwrite_no_default_features/stderr.log | 0 .../overwrite_no_default_features/stdout.log | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../mod.rs | 25 + .../out/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../overwrite_no_optional/in/Cargo.toml | 0 .../overwrite_no_optional/in/src/lib.rs | 0 .../cargo_add/overwrite_no_optional/mod.rs | 25 + .../overwrite_no_optional/out/Cargo.toml | 0 .../overwrite_no_optional/stderr.log | 0 .../overwrite_no_optional/stdout.log | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../mod.rs | 25 + .../out/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../overwrite_optional/in/Cargo.toml | 0 .../overwrite_optional/in/src/lib.rs | 0 .../cargo_add/overwrite_optional/mod.rs | 25 + .../overwrite_optional/out/Cargo.toml | 0 .../cargo_add}/overwrite_optional/stderr.log | 0 .../cargo_add}/overwrite_optional/stdout.log | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../mod.rs | 25 + .../out/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../overwrite_path_noop/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../overwrite_path_noop/in/src/lib.rs | 0 .../cargo_add/overwrite_path_noop/mod.rs | 25 + .../overwrite_path_noop/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../cargo_add}/overwrite_path_noop/stderr.log | 0 .../cargo_add}/overwrite_path_noop/stdout.log | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../overwrite_path_with_version/mod.rs | 25 + .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../overwrite_path_with_version/stderr.log | 0 .../overwrite_path_with_version/stdout.log | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../overwrite_rename_with_no_rename/mod.rs | 25 + .../out/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../overwrite_rename_with_rename/mod.rs | 25 + .../out/Cargo.toml | 0 .../overwrite_rename_with_rename/stderr.log | 0 .../overwrite_rename_with_rename/stdout.log | 0 .../in/Cargo.toml | 0 .../in/src/lib.rs | 0 .../overwrite_rename_with_rename_noop/mod.rs | 25 + .../out/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../overwrite_version_with_git/in/Cargo.toml | 0 .../overwrite_version_with_git/in/src/lib.rs | 0 .../overwrite_version_with_git/mod.rs | 34 + .../overwrite_version_with_git/out/Cargo.toml | 0 .../overwrite_version_with_git/stderr.log | 0 .../overwrite_version_with_git/stdout.log | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../overwrite_version_with_path/mod.rs | 25 + .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../overwrite_version_with_path/stderr.log | 0 .../overwrite_version_with_path/stdout.log | 0 .../overwrite_with_rename/in/Cargo.toml | 0 .../overwrite_with_rename/in/src/lib.rs | 0 .../cargo_add/overwrite_with_rename/mod.rs | 25 + .../overwrite_with_rename/out/Cargo.toml | 0 .../overwrite_with_rename/stderr.log | 0 .../overwrite_with_rename/stdout.log | 0 .../overwrite_workspace_dep/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../cargo_add/overwrite_workspace_dep/mod.rs | 26 + .../overwrite_workspace_dep/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../overwrite_workspace_dep/stderr.log | 0 .../overwrite_workspace_dep/stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../overwrite_workspace_dep_features/mod.rs | 26 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../cargo_add}/path/in/dependency/Cargo.toml | 0 .../cargo_add}/path/in/dependency/src/lib.rs | 0 .../cargo_add}/path/in/primary/Cargo.toml | 0 .../cargo_add}/path/in/primary/src/lib.rs | 0 tests/testsuite/cargo_add/path/mod.rs | 25 + .../cargo_add}/path/out/dependency/Cargo.toml | 0 .../cargo_add}/path/out/primary/Cargo.toml | 0 .../cargo_add}/path/stderr.log | 0 .../cargo_add}/path/stdout.log | 0 .../path_dev/in/dependency/Cargo.toml | 0 .../path_dev/in/dependency/src/lib.rs | 0 .../cargo_add}/path_dev/in/primary/Cargo.toml | 0 .../cargo_add}/path_dev/in/primary/src/lib.rs | 0 tests/testsuite/cargo_add/path_dev/mod.rs | 25 + .../path_dev/out/dependency/Cargo.toml | 0 .../path_dev/out/primary/Cargo.toml | 0 .../cargo_add}/path_dev/stderr.log | 0 .../cargo_add}/path_dev/stdout.log | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../path_inferred_name/in/primary/Cargo.toml | 0 .../path_inferred_name/in/primary/src/lib.rs | 0 .../cargo_add/path_inferred_name/mod.rs | 25 + .../out/dependency/Cargo.toml | 0 .../path_inferred_name/out/primary/Cargo.toml | 0 .../cargo_add}/path_inferred_name/stderr.log | 0 .../cargo_add}/path_inferred_name/stdout.log | 0 .../in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/optional/Cargo.toml | 0 .../in/optional/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../mod.rs | 25 + .../out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../cargo_add/path_normalized_name/mod.rs | 25 + .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../path_normalized_name/stderr.log | 0 .../path_normalized_name/stdout.log | 0 .../cargo_add}/preserve_sorted/in/Cargo.toml | 0 .../cargo_add}/preserve_sorted/in/src/lib.rs | 0 .../cargo_add/preserve_sorted/mod.rs | 25 + .../cargo_add}/preserve_sorted/out/Cargo.toml | 0 .../cargo_add}/preserve_sorted/stderr.log | 0 .../cargo_add}/preserve_sorted/stdout.log | 0 .../preserve_unsorted/in/Cargo.toml | 0 .../preserve_unsorted/in/src/lib.rs | 0 .../cargo_add/preserve_unsorted/mod.rs | 25 + .../preserve_unsorted/out/Cargo.toml | 0 .../cargo_add}/preserve_unsorted/stderr.log | 0 .../cargo_add}/preserve_unsorted/stdout.log | 0 .../add => testsuite/cargo_add}/quiet/in | 0 tests/testsuite/cargo_add/quiet/mod.rs | 25 + .../cargo_add}/quiet/out/Cargo.toml | 0 .../cargo_add}/quiet/stderr.log | 0 .../cargo_add}/quiet/stdout.log | 0 .../cargo_add}/registry/in/Cargo.toml | 0 .../cargo_add}/registry/in/src/lib.rs | 0 tests/testsuite/cargo_add/registry/mod.rs | 25 + .../cargo_add}/registry/out/Cargo.toml | 0 .../cargo_add}/registry/stderr.log | 0 .../cargo_add}/registry/stdout.log | 0 .../add => testsuite/cargo_add}/rename/in | 0 tests/testsuite/cargo_add/rename/mod.rs | 25 + .../cargo_add}/rename/out/Cargo.toml | 0 .../cargo_add}/rename/stderr.log | 0 .../cargo_add}/rename/stdout.log | 0 .../cargo_add}/require_weak/in/Cargo.toml | 0 .../cargo_add}/require_weak/in/src/lib.rs | 0 tests/testsuite/cargo_add/require_weak/mod.rs | 25 + .../cargo_add}/require_weak/out/Cargo.toml | 0 .../cargo_add}/require_weak/stderr.log | 0 .../cargo_add}/require_weak/stdout.log | 0 .../add => testsuite/cargo_add}/target/in | 0 tests/testsuite/cargo_add/target/mod.rs | 25 + .../cargo_add}/target/out/Cargo.toml | 0 .../cargo_add}/target/stderr.log | 0 .../cargo_add}/target/stdout.log | 0 .../add => testsuite/cargo_add}/target_cfg/in | 0 tests/testsuite/cargo_add/target_cfg/mod.rs | 25 + .../cargo_add}/target_cfg/out/Cargo.toml | 0 .../cargo_add}/target_cfg/stderr.log | 0 .../cargo_add}/target_cfg/stdout.log | 0 .../unknown_inherited_feature/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../in/primary/Cargo.toml | 0 .../in/primary/src/lib.rs | 0 .../unknown_inherited_feature/mod.rs | 24 + .../unknown_inherited_feature/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../out/primary/Cargo.toml | 0 .../unknown_inherited_feature/stderr.log | 0 .../unknown_inherited_feature/stdout.log | 0 .../add => testsuite/cargo_add}/vers/in | 0 tests/testsuite/cargo_add/vers/mod.rs | 25 + .../cargo_add}/vers/out/Cargo.toml | 0 .../cargo_add}/vers/stderr.log | 0 .../cargo_add}/vers/stdout.log | 0 .../cargo_add}/workspace_name/in/Cargo.toml | 0 .../workspace_name/in/dependency/Cargo.toml | 0 .../workspace_name/in/dependency/src/lib.rs | 0 .../workspace_name/in/primary/Cargo.toml | 0 .../workspace_name/in/primary/src/lib.rs | 0 .../testsuite/cargo_add/workspace_name/mod.rs | 25 + .../cargo_add}/workspace_name/out/Cargo.toml | 0 .../workspace_name/out/dependency/Cargo.toml | 0 .../workspace_name/out/primary/Cargo.toml | 0 .../cargo_add}/workspace_name/stderr.log | 0 .../cargo_add}/workspace_name/stdout.log | 0 .../cargo_add}/workspace_path/in/Cargo.toml | 0 .../workspace_path/in/dependency/Cargo.toml | 0 .../workspace_path/in/dependency/src/lib.rs | 0 .../workspace_path/in/primary/Cargo.toml | 0 .../workspace_path/in/primary/src/lib.rs | 0 .../testsuite/cargo_add/workspace_path/mod.rs | 25 + .../cargo_add}/workspace_path/out/Cargo.toml | 0 .../workspace_path/out/dependency/Cargo.toml | 0 .../workspace_path/out/primary/Cargo.toml | 0 .../cargo_add}/workspace_path/stderr.log | 0 .../cargo_add}/workspace_path/stdout.log | 0 .../workspace_path_dev/in/Cargo.toml | 0 .../in/dependency/Cargo.toml | 0 .../in/dependency/src/lib.rs | 0 .../workspace_path_dev/in/primary/Cargo.toml | 0 .../workspace_path_dev/in/primary/src/lib.rs | 0 .../cargo_add/workspace_path_dev/mod.rs | 25 + .../workspace_path_dev/out/Cargo.toml | 0 .../out/dependency/Cargo.toml | 0 .../workspace_path_dev/out/primary/Cargo.toml | 0 .../cargo_add}/workspace_path_dev/stderr.log | 0 .../cargo_add}/workspace_path_dev/stdout.log | 0 717 files changed, 2894 insertions(+), 2354 deletions(-) delete mode 100644 tests/testsuite/cargo_add.rs rename tests/{snapshots/add => testsuite/cargo_add}/add-basic.in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add-basic.in/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_basic/in (100%) create mode 100644 tests/testsuite/cargo_add/add_basic/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/add_basic/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_basic/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_basic/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_multiple/in (100%) create mode 100644 tests/testsuite/cargo_add/add_multiple/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/add_multiple/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_multiple/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_multiple/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_normalized_name_external/in (100%) create mode 100644 tests/testsuite/cargo_add/add_normalized_name_external/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/add_normalized_name_external/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_normalized_name_external/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/add_normalized_name_external/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/build/in (100%) create mode 100644 tests/testsuite/cargo_add/build/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/build/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/build/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/build/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/change_rename_target/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/change_rename_target/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/change_rename_target/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/change_rename_target/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/change_rename_target/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/change_rename_target/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/default_features/in (100%) create mode 100644 tests/testsuite/cargo_add/default_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/default_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/default_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/default_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_default_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_default_features/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/deprecated_default_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_default_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_default_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_default_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_section/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_section/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/deprecated_section/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_section/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_section/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/deprecated_section/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/detect_workspace_inherit/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/detect_workspace_inherit_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/detect_workspace_inherit_optional/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/detect_workspace_inherit_optional/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev/in (100%) create mode 100644 tests/testsuite/cargo_add/dev/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/dev/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_build_conflict/in (100%) create mode 100644 tests/testsuite/cargo_add/dev_build_conflict/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/dev_build_conflict/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_build_conflict/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_build_conflict/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_prefer_existing_version/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_prefer_existing_version/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_prefer_existing_version/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_prefer_existing_version/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/dev_prefer_existing_version/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/dev_prefer_existing_version/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_prefer_existing_version/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_prefer_existing_version/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dev_prefer_existing_version/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dry_run/in (100%) create mode 100644 tests/testsuite/cargo_add/dry_run/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/dry_run/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dry_run/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/dry_run/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features/in (100%) create mode 100644 tests/testsuite/cargo_add/features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_empty/in (100%) create mode 100644 tests/testsuite/cargo_add/features_empty/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/features_empty/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_empty/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_empty/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_multiple_occurrences/in (100%) create mode 100644 tests/testsuite/cargo_add/features_multiple_occurrences/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/features_multiple_occurrences/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_multiple_occurrences/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_multiple_occurrences/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_preserve/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_preserve/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/features_preserve/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/features_preserve/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_preserve/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_preserve/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_spaced_values/in (100%) create mode 100644 tests/testsuite/cargo_add/features_spaced_values/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/features_spaced_values/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_spaced_values/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_spaced_values/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_unknown/in (100%) create mode 100644 tests/testsuite/cargo_add/features_unknown/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/features_unknown/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_unknown/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/features_unknown/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git/in (100%) create mode 100644 tests/testsuite/cargo_add/git/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_branch/in (100%) create mode 100644 tests/testsuite/cargo_add/git_branch/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_branch/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_branch/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_branch/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_conflicts_namever/in (100%) create mode 100644 tests/testsuite/cargo_add/git_conflicts_namever/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_conflicts_namever/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_conflicts_namever/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_conflicts_namever/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_dev/in (100%) create mode 100644 tests/testsuite/cargo_add/git_dev/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_dev/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_dev/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_dev/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_inferred_name/in (100%) create mode 100644 tests/testsuite/cargo_add/git_inferred_name/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_inferred_name/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_inferred_name/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_inferred_name/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_inferred_name_multiple/in (100%) create mode 100644 tests/testsuite/cargo_add/git_inferred_name_multiple/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_inferred_name_multiple/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_inferred_name_multiple/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_inferred_name_multiple/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_multiple_names/in (100%) create mode 100644 tests/testsuite/cargo_add/git_multiple_names/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_multiple_names/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_multiple_names/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_multiple_names/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_normalized_name/in (100%) create mode 100644 tests/testsuite/cargo_add/git_normalized_name/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_normalized_name/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_normalized_name/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_normalized_name/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_registry/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_registry/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/git_registry/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_registry/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_registry/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_registry/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_rev/in (100%) create mode 100644 tests/testsuite/cargo_add/git_rev/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_rev/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_rev/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_rev/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_tag/in (100%) create mode 100644 tests/testsuite/cargo_add/git_tag/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/git_tag/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_tag/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/git_tag/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/infer_prerelease/in (100%) create mode 100644 tests/testsuite/cargo_add/infer_prerelease/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/infer_prerelease/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/infer_prerelease/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/infer_prerelease/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_arg/in (100%) create mode 100644 tests/testsuite/cargo_add/invalid_arg/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_arg/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_arg/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_arg/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_git_external/in (100%) create mode 100644 tests/testsuite/cargo_add/invalid_git_external/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_git_external/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_git_external/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_git_external/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_git_name/in (100%) create mode 100644 tests/testsuite/cargo_add/invalid_git_name/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_git_name/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_git_name/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_git_name/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/invalid_key_inherit_dependency/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_inherit_dependency/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_overwrite_inherit_dependency/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/in/dependency-alt/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/in/dependency-alt/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/out/dependency-alt/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_key_rename_inherit_dependency/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_manifest/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_manifest/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/invalid_manifest/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_manifest/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_manifest/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_manifest/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_name_external/in (100%) create mode 100644 tests/testsuite/cargo_add/invalid_name_external/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_name_external/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_name_external/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_name_external/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path/in (100%) create mode 100644 tests/testsuite/cargo_add/invalid_path/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_name/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_name/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_name/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_name/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/invalid_path_name/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_name/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_name/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_name/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_name/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_self/in (100%) create mode 100644 tests/testsuite/cargo_add/invalid_path_self/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_self/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_self/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_path_self/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_target_empty/in (100%) create mode 100644 tests/testsuite/cargo_add/invalid_target_empty/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_target_empty/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_target_empty/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_target_empty/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_vers/in (100%) create mode 100644 tests/testsuite/cargo_add/invalid_vers/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/invalid_vers/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_vers/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/invalid_vers/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features/in (100%) create mode 100644 tests/testsuite/cargo_add/list_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/list_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/in/optional/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/in/optional/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/list_features_path/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/in/optional/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/in/optional/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/list_features_path_no_default/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/list_features_path_no_default/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/manifest_path_package/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/manifest_path_package/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/merge_activated_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/merge_activated_features/stdout.log (100%) create mode 100644 tests/testsuite/cargo_add/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/multiple_conflicts_with_features/in (100%) create mode 100644 tests/testsuite/cargo_add/multiple_conflicts_with_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/multiple_conflicts_with_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/multiple_conflicts_with_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/multiple_conflicts_with_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/multiple_conflicts_with_rename/in (100%) create mode 100644 tests/testsuite/cargo_add/multiple_conflicts_with_rename/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/multiple_conflicts_with_rename/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/multiple_conflicts_with_rename/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/multiple_conflicts_with_rename/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/namever/in (100%) create mode 100644 tests/testsuite/cargo_add/namever/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/namever/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/namever/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/namever/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_args/in (100%) create mode 100644 tests/testsuite/cargo_add/no_args/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/no_args/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_args/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_args/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_default_features/in (100%) create mode 100644 tests/testsuite/cargo_add/no_default_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/no_default_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_default_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_default_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_optional/in (100%) create mode 100644 tests/testsuite/cargo_add/no_optional/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/no_optional/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_optional/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/no_optional/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/optional/in (100%) create mode 100644 tests/testsuite/cargo_add/optional/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/optional/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/optional/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/optional/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_default_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features_with_no_default_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features_with_no_default_features/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features_with_no_default_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features_with_no_default_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_default_features_with_no_default_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_features/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_git_with_path/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_git_with_path/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_git_with_path/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_git_with_path/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_git_with_path/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_git_with_path/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_git_with_path/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_git_with_path/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_git_with_path/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_inherit_features_noop/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_features_noop/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_inherit_noop/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_noop/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_inherit_optional_noop/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inherit_optional_noop/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inline_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inline_features/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_inline_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inline_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inline_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_inline_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_dev_noop/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_dev_noop/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_dev_noop/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_dev_noop/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_name_dev_noop/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_dev_noop/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_dev_noop/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_dev_noop/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_dev_noop/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_noop/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_noop/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_noop/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_noop/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_name_noop/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_noop/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_noop/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_noop/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_name_noop/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_no_default_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features_with_default_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features_with_default_features/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features_with_default_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features_with_default_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_default_features_with_default_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_no_optional/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional_with_optional/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional_with_optional/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_no_optional_with_optional/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional_with_optional/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional_with_optional/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_no_optional_with_optional/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_optional/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional_with_no_optional/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional_with_no_optional/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_optional_with_no_optional/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional_with_no_optional/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional_with_no_optional/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_optional_with_no_optional/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_noop/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_noop/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_noop/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_noop/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_path_noop/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_noop/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_noop/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_noop/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_noop/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_with_version/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_with_version/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_with_version/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_with_version/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_path_with_version/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_with_version/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_with_version/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_with_version/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_path_with_version/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_no_rename/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_no_rename/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_rename_with_no_rename/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_no_rename/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_no_rename/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_no_rename/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_rename_with_rename/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename_noop/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename_noop/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename_noop/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename_noop/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_rename_with_rename_noop/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_git/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_git/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_version_with_git/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_git/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_git/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_git/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_path/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_path/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_path/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_path/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_version_with_path/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_path/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_path/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_path/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_version_with_path/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_with_rename/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_with_rename/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_with_rename/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_with_rename/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_with_rename/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_with_rename/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_workspace_dep/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/overwrite_workspace_dep_features/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/overwrite_workspace_dep_features/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/path/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/path/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_dev/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_dev/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_dev/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_dev/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/path_dev/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/path_dev/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_dev/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_dev/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_dev/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/path_inferred_name/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/in/optional/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/in/optional/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_inferred_name_conflicts_full_feature/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_normalized_name/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_normalized_name/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_normalized_name/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_normalized_name/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/path_normalized_name/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/path_normalized_name/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_normalized_name/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_normalized_name/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/path_normalized_name/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/preserve_sorted/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/preserve_sorted/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/preserve_sorted/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/preserve_sorted/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/preserve_sorted/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/preserve_sorted/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/preserve_unsorted/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/preserve_unsorted/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/preserve_unsorted/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/preserve_unsorted/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/preserve_unsorted/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/preserve_unsorted/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/quiet/in (100%) create mode 100644 tests/testsuite/cargo_add/quiet/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/quiet/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/quiet/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/quiet/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/registry/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/registry/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/registry/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/registry/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/registry/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/registry/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/rename/in (100%) create mode 100644 tests/testsuite/cargo_add/rename/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/rename/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/rename/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/rename/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/require_weak/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/require_weak/in/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/require_weak/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/require_weak/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/require_weak/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/require_weak/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/target/in (100%) create mode 100644 tests/testsuite/cargo_add/target/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/target/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/target/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/target/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/target_cfg/in (100%) create mode 100644 tests/testsuite/cargo_add/target_cfg/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/target_cfg/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/target_cfg/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/target_cfg/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/unknown_inherited_feature/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/unknown_inherited_feature/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/vers/in (100%) create mode 100644 tests/testsuite/cargo_add/vers/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/vers/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/vers/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/vers/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/workspace_name/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_name/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/workspace_path/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path/stdout.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/in/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/in/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/in/dependency/src/lib.rs (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/in/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/in/primary/src/lib.rs (100%) create mode 100644 tests/testsuite/cargo_add/workspace_path_dev/mod.rs rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/out/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/out/dependency/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/out/primary/Cargo.toml (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/stderr.log (100%) rename tests/{snapshots/add => testsuite/cargo_add}/workspace_path_dev/stdout.log (100%) diff --git a/crates/cargo-test-support/src/lib.rs b/crates/cargo-test-support/src/lib.rs index 19b71b270ab..21d3e081d8f 100644 --- a/crates/cargo-test-support/src/lib.rs +++ b/crates/cargo-test-support/src/lib.rs @@ -32,6 +32,13 @@ macro_rules! t { }; } +#[macro_export] +macro_rules! curr_dir { + () => { + std::path::Path::new(file!()).parent().unwrap() + }; +} + #[track_caller] pub fn panic_error(what: &str, err: impl Into) -> ! { let err = err.into(); diff --git a/tests/testsuite/cargo_add.rs b/tests/testsuite/cargo_add.rs deleted file mode 100644 index e5fc379626c..00000000000 --- a/tests/testsuite/cargo_add.rs +++ /dev/null @@ -1,2354 +0,0 @@ -use cargo_test_support::compare::assert; -use cargo_test_support::prelude::*; -use cargo_test_support::Project; - -mod build_prefer_existing_version; - -fn init_registry() { - cargo_test_support::registry::init(); - add_registry_packages(false); -} - -fn init_alt_registry() { - cargo_test_support::registry::alt_init(); - add_registry_packages(true); -} - -fn add_registry_packages(alt: bool) { - for name in [ - "my-package", - "my-package1", - "my-package2", - "my-dev-package1", - "my-dev-package2", - "my-build-package1", - "my-build-package2", - "toml", - "versioned-package", - "cargo-list-test-fixture-dependency", - "unrelateed-crate", - ] { - cargo_test_support::registry::Package::new(name, "0.1.1+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "0.2.3+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "0.4.1+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "20.0.0+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "99999.0.0+my-package") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new(name, "99999.0.0-alpha.1+my-package") - .alternative(alt) - .publish(); - } - - cargo_test_support::registry::Package::new("prerelease_only", "0.2.0-alpha.1") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new("test_breaking", "0.2.0") - .alternative(alt) - .publish(); - cargo_test_support::registry::Package::new("test_nonbreaking", "0.1.1") - .alternative(alt) - .publish(); - - // Normalization - cargo_test_support::registry::Package::new("linked-hash-map", "0.5.4") - .alternative(alt) - .feature("clippy", &[]) - .feature("heapsize", &[]) - .feature("heapsize_impl", &[]) - .feature("nightly", &[]) - .feature("serde", &[]) - .feature("serde_impl", &[]) - .feature("serde_test", &[]) - .publish(); - cargo_test_support::registry::Package::new("inflector", "0.11.4") - .alternative(alt) - .feature("default", &["heavyweight", "lazy_static", "regex"]) - .feature("heavyweight", &[]) - .feature("lazy_static", &[]) - .feature("regex", &[]) - .feature("unstable", &[]) - .publish(); - - cargo_test_support::registry::Package::new("your-face", "99999.0.0+my-package") - .alternative(alt) - .feature("nose", &[]) - .feature("mouth", &[]) - .feature("eyes", &[]) - .feature("ears", &[]) - .publish(); -} - -#[cargo_test] -fn add_basic() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/add_basic/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/add_basic/stdout.log") - .stderr_matches_path("tests/snapshots/add/add_basic/stderr.log"); - - assert().subset_matches("tests/snapshots/add/add_basic/out", &project_root); -} - -#[cargo_test] -fn add_multiple() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/add_multiple/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/add_multiple/stdout.log") - .stderr_matches_path("tests/snapshots/add/add_multiple/stderr.log"); - - assert().subset_matches("tests/snapshots/add/add_multiple/out", &project_root); -} - -#[cargo_test] -fn quiet() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/quiet/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("--quiet your-face") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/quiet/stdout.log") - .stderr_matches_path("tests/snapshots/add/quiet/stderr.log"); - - assert().subset_matches("tests/snapshots/add/quiet/out", &project_root); -} - -#[cargo_test] -fn add_normalized_name_external() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/add_normalized_name_external/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("linked_hash_map Inflector") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/add_normalized_name_external/stdout.log") - .stderr_matches_path("tests/snapshots/add/add_normalized_name_external/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/add_normalized_name_external/out", - &project_root, - ); -} - -#[cargo_test] -fn infer_prerelease() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/infer_prerelease/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("prerelease_only") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/infer_prerelease/stdout.log") - .stderr_matches_path("tests/snapshots/add/infer_prerelease/stderr.log"); - - assert().subset_matches("tests/snapshots/add/infer_prerelease/out", &project_root); -} - -#[cargo_test] -fn build() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/build/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("--build my-build-package1 my-build-package2") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/build/stdout.log") - .stderr_matches_path("tests/snapshots/add/build/stderr.log"); - - assert().subset_matches("tests/snapshots/add/build/out", &project_root); -} - -#[cargo_test] -fn default_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/default_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --default-features") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/default_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/default_features/stderr.log"); - - assert().subset_matches("tests/snapshots/add/default_features/out", &project_root); -} - -#[cargo_test] -fn require_weak() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/require_weak/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --no-optional") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/require_weak/stdout.log") - .stderr_matches_path("tests/snapshots/add/require_weak/stderr.log"); - - assert().subset_matches("tests/snapshots/add/require_weak/out", &project_root); -} - -#[cargo_test] -fn detect_workspace_inherit() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/detect_workspace_inherit/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "-p", "bar"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/detect_workspace_inherit/stdout.log") - .stderr_matches_path("tests/snapshots/add/detect_workspace_inherit/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/detect_workspace_inherit/out", - &project_root, - ); -} - -#[cargo_test] -fn detect_workspace_inherit_features() { - init_registry(); - let project = - Project::from_template("tests/snapshots/add/detect_workspace_inherit_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "-p", "bar", "--features", "test"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/detect_workspace_inherit_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/detect_workspace_inherit_features/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/detect_workspace_inherit_features/out", - &project_root, - ); -} - -#[cargo_test] -fn detect_workspace_inherit_optional() { - init_registry(); - let project = - Project::from_template("tests/snapshots/add/detect_workspace_inherit_optional/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "-p", "bar", "--optional"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/detect_workspace_inherit_optional/stdout.log") - .stderr_matches_path("tests/snapshots/add/detect_workspace_inherit_optional/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/detect_workspace_inherit_optional/out", - &project_root, - ); -} - -#[cargo_test] -fn dev() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/dev/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("--dev my-dev-package1 my-dev-package2") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/dev/stdout.log") - .stderr_matches_path("tests/snapshots/add/dev/stderr.log"); - - assert().subset_matches("tests/snapshots/add/dev/out", &project_root); -} - -#[cargo_test] -fn dev_build_conflict() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/dev_build_conflict/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package --dev --build") - .current_dir(cwd) - .assert() - .code(1) - .stdout_matches_path("tests/snapshots/add/dev_build_conflict/stdout.log") - .stderr_matches_path("tests/snapshots/add/dev_build_conflict/stderr.log"); - - assert().subset_matches("tests/snapshots/add/dev_build_conflict/out", &project_root); -} - -#[cargo_test] -fn dev_prefer_existing_version() { - init_alt_registry(); - let project = Project::from_template("tests/snapshots/add/dev_prefer_existing_version/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --dev") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/dev_prefer_existing_version/stdout.log") - .stderr_matches_path("tests/snapshots/add/dev_prefer_existing_version/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/dev_prefer_existing_version/out", - &project_root, - ); -} - -#[cargo_test] -fn dry_run() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/dry_run/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package --dry-run") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/dry_run/stdout.log") - .stderr_matches_path("tests/snapshots/add/dry_run/stderr.log"); - - assert().subset_matches("tests/snapshots/add/dry_run/out", &project_root); -} - -#[cargo_test] -fn features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --features eyes") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/features/stdout.log") - .stderr_matches_path("tests/snapshots/add/features/stderr.log"); - - assert().subset_matches("tests/snapshots/add/features/out", &project_root); -} - -#[cargo_test] -fn features_empty() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/features_empty/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --features ''") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/features_empty/stdout.log") - .stderr_matches_path("tests/snapshots/add/features_empty/stderr.log"); - - assert().subset_matches("tests/snapshots/add/features_empty/out", &project_root); -} - -#[cargo_test] -fn features_multiple_occurrences() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/features_multiple_occurrences/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --features eyes --features nose") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/features_multiple_occurrences/stdout.log") - .stderr_matches_path("tests/snapshots/add/features_multiple_occurrences/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/features_multiple_occurrences/out", - &project_root, - ); -} - -#[cargo_test] -fn features_preserve() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/features_preserve/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/features_preserve/stdout.log") - .stderr_matches_path("tests/snapshots/add/features_preserve/stderr.log"); - - assert().subset_matches("tests/snapshots/add/features_preserve/out", &project_root); -} - -#[cargo_test] -fn features_spaced_values() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/features_spaced_values/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --features eyes,nose") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/features_spaced_values/stdout.log") - .stderr_matches_path("tests/snapshots/add/features_spaced_values/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/features_spaced_values/out", - &project_root, - ); -} - -#[cargo_test] -fn features_unknown() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/features_unknown/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --features noze") - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/features_unknown/stdout.log") - .stderr_matches_path("tests/snapshots/add/features_unknown/stderr.log"); - - assert().subset_matches("tests/snapshots/add/features_unknown/out", &project_root); -} - -#[cargo_test] -fn git() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("git-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), - ) - .file("src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["git-package", "--git", &git_url]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/git/stdout.log") - .stderr_matches_path("tests/snapshots/add/git/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git/out", &project_root); -} - -#[cargo_test] -fn git_inferred_name() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_inferred_name/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("git-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), - ) - .file("src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["--git", &git_url]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/git_inferred_name/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_inferred_name/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git_inferred_name/out", &project_root); -} - -#[cargo_test] -fn git_inferred_name_multiple() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_inferred_name_multiple/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("git-package", |project| { - project - .file( - "p1/Cargo.toml", - &cargo_test_support::basic_manifest("my-package1", "0.3.0+my-package1"), - ) - .file("p1/src/lib.rs", "") - .file( - "p2/Cargo.toml", - &cargo_test_support::basic_manifest("my-package2", "0.3.0+my-package2"), - ) - .file("p2/src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["--git", &git_url]) - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/git_inferred_name_multiple/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_inferred_name_multiple/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/git_inferred_name_multiple/out", - &project_root, - ); -} - -#[cargo_test] -fn git_normalized_name() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_normalized_name/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("git-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), - ) - .file("src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["git_package", "--git", &git_url]) - .current_dir(cwd) - .assert() - .failure() // Fuzzy searching for paths isn't supported at this time - .stdout_matches_path("tests/snapshots/add/git_normalized_name/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_normalized_name/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git_normalized_name/out", &project_root); -} - -#[cargo_test] -fn invalid_git_name() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_git_name/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("git-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), - ) - .file("src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["not-in-git", "--git", &git_url]) - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/invalid_git_name/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_git_name/stderr.log"); - - assert().subset_matches("tests/snapshots/add/invalid_git_name/out", &project_root); -} - -#[cargo_test] -fn git_branch() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_branch/in"); - let project_root = project.root(); - let cwd = &project_root; - let (git_dep, git_repo) = cargo_test_support::git::new_repo("git-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), - ) - .file("src/lib.rs", "") - }); - let branch = "dev"; - let find_head = || (git_repo.head().unwrap().peel_to_commit().unwrap()); - git_repo.branch(branch, &find_head(), false).unwrap(); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["git-package", "--git", &git_url, "--branch", branch]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/git_branch/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_branch/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git_branch/out", &project_root); -} - -#[cargo_test] -fn git_conflicts_namever() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_conflicts_namever/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .args([ - "my-package@0.4.3", - "--git", - "https://github.com/dcjanus/invalid", - ]) - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/git_conflicts_namever/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_conflicts_namever/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/git_conflicts_namever/out", - &project_root, - ); -} - -#[cargo_test] -fn git_registry() { - init_alt_registry(); - let project = Project::from_template("tests/snapshots/add/git_registry/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("versioned-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("versioned-package", "0.3.0+versioned-package"), - ) - .file("src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args([ - "versioned-package", - "--git", - &git_url, - "--registry", - "alternative", - ]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/git_registry/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_registry/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git_registry/out", &project_root); -} - -#[cargo_test] -fn git_dev() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_dev/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("git-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), - ) - .file("src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["git-package", "--git", &git_url, "--dev"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/git_dev/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_dev/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git_dev/out", &project_root); -} - -#[cargo_test] -fn git_rev() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_rev/in"); - let project_root = project.root(); - let cwd = &project_root; - let (git_dep, git_repo) = cargo_test_support::git::new_repo("git-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), - ) - .file("src/lib.rs", "") - }); - let find_head = || (git_repo.head().unwrap().peel_to_commit().unwrap()); - let head = find_head().id().to_string(); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["git-package", "--git", &git_url, "--rev", &head]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/git_rev/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_rev/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git_rev/out", &project_root); -} - -#[cargo_test] -fn git_tag() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_tag/in"); - let project_root = project.root(); - let cwd = &project_root; - let (git_dep, git_repo) = cargo_test_support::git::new_repo("git-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), - ) - .file("src/lib.rs", "") - }); - let tag = "v1.0.0"; - cargo_test_support::git::tag(&git_repo, tag); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["git-package", "--git", &git_url, "--tag", tag]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/git_tag/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_tag/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git_tag/out", &project_root); -} - -#[cargo_test] -fn path() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/path/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --path ../dependency") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/path/stdout.log") - .stderr_matches_path("tests/snapshots/add/path/stderr.log"); - - assert().subset_matches("tests/snapshots/add/path/out", &project_root); -} - -#[cargo_test] -fn path_inferred_name() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/path_inferred_name/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --path ../dependency") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/path_inferred_name/stdout.log") - .stderr_matches_path("tests/snapshots/add/path_inferred_name/stderr.log"); - - assert().subset_matches("tests/snapshots/add/path_inferred_name/out", &project_root); -} - -#[cargo_test] -fn path_inferred_name_conflicts_full_feature() { - init_registry(); - let project = - Project::from_template("tests/snapshots/add/path_inferred_name_conflicts_full_feature/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("--path ../dependency --features your-face/nose") - .current_dir(&cwd) - .assert() - .code(101) - .stdout_matches_path( - "tests/snapshots/add/path_inferred_name_conflicts_full_feature/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/add/path_inferred_name_conflicts_full_feature/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/add/path_inferred_name_conflicts_full_feature/out", - &project_root, - ); -} - -#[cargo_test] -fn path_normalized_name() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/path_normalized_name/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo_list_test_fixture_dependency --path ../dependency") - .current_dir(&cwd) - .assert() - .failure() // Fuzzy searching for paths isn't supported at this time - .stdout_matches_path("tests/snapshots/add/path_normalized_name/stdout.log") - .stderr_matches_path("tests/snapshots/add/path_normalized_name/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/path_normalized_name/out", - &project_root, - ); -} - -#[cargo_test] -fn invalid_path_name() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_path_name/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("not-at-path --path ../dependency") - .current_dir(&cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/invalid_path_name/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_path_name/stderr.log"); - - assert().subset_matches("tests/snapshots/add/invalid_path_name/out", &project_root); -} - -#[cargo_test] -fn path_dev() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/path_dev/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --path ../dependency --dev") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/path_dev/stdout.log") - .stderr_matches_path("tests/snapshots/add/path_dev/stderr.log"); - - assert().subset_matches("tests/snapshots/add/path_dev/out", &project_root); -} - -#[cargo_test] -fn invalid_arg() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_arg/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package --flag") - .current_dir(cwd) - .assert() - .code(1) - .stdout_matches_path("tests/snapshots/add/invalid_arg/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_arg/stderr.log"); - - assert().subset_matches("tests/snapshots/add/invalid_arg/out", &project_root); -} - -#[cargo_test] -fn invalid_git_external() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_git_external/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_url = url::Url::from_directory_path(cwd.join("does-not-exist")) - .unwrap() - .to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["fake-git", "--git", &git_url]) - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/invalid_git_external/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_git_external/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/invalid_git_external/out", - &project_root, - ); -} - -#[cargo_test] -fn invalid_key_inherit_dependency() { - let project = Project::from_template("tests/snapshots/add/invalid_key_inherit_dependency/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "--default-features", "-p", "bar"]) - .current_dir(cwd) - .assert() - .failure() - .stdout_matches_path("tests/snapshots/add/invalid_key_inherit_dependency/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_key_inherit_dependency/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/invalid_key_inherit_dependency/out", - &project_root, - ); -} - -#[cargo_test] -fn invalid_key_rename_inherit_dependency() { - let project = - Project::from_template("tests/snapshots/add/invalid_key_rename_inherit_dependency/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["--rename", "foo", "foo-alt", "-p", "bar"]) - .current_dir(cwd) - .assert() - .failure() - .stdout_matches_path("tests/snapshots/add/invalid_key_rename_inherit_dependency/stdout.log") - .stderr_matches_path( - "tests/snapshots/add/invalid_key_rename_inherit_dependency/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/add/invalid_key_rename_inherit_dependency/out", - &project_root, - ); -} - -#[cargo_test] -fn invalid_key_overwrite_inherit_dependency() { - let project = - Project::from_template("tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "--default-features", "-p", "bar"]) - .current_dir(cwd) - .assert() - .failure() - .stdout_matches_path( - "tests/snapshots/add/invalid_key_overwrite_inherit_dependency/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/add/invalid_key_overwrite_inherit_dependency/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/add/invalid_key_overwrite_inherit_dependency/out", - &project_root, - ); -} - -#[cargo_test] -fn invalid_path() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_path/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture --path ./tests/fixtures/local") - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/invalid_path/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_path/stderr.log"); - - assert().subset_matches("tests/snapshots/add/invalid_path/out", &project_root); -} - -#[cargo_test] -fn invalid_path_self() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_path_self/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture --path .") - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/invalid_path_self/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_path_self/stderr.log"); - - assert().subset_matches("tests/snapshots/add/invalid_path_self/out", &project_root); -} - -#[cargo_test] -fn invalid_manifest() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_manifest/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package") - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/invalid_manifest/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_manifest/stderr.log"); - - assert().subset_matches("tests/snapshots/add/invalid_manifest/out", &project_root); -} - -#[cargo_test] -fn invalid_name_external() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_name_external/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("lets_hope_nobody_ever_publishes_this_crate") - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/invalid_name_external/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_name_external/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/invalid_name_external/out", - &project_root, - ); -} - -#[cargo_test] -fn invalid_target_empty() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_target_empty/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package --target ''") - .current_dir(cwd) - .assert() - .code(1) - .stdout_matches_path("tests/snapshots/add/invalid_target_empty/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_target_empty/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/invalid_target_empty/out", - &project_root, - ); -} - -#[cargo_test] -fn invalid_vers() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/invalid_vers/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package@invalid-version-string") - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/invalid_vers/stdout.log") - .stderr_matches_path("tests/snapshots/add/invalid_vers/stderr.log"); - - assert().subset_matches("tests/snapshots/add/invalid_vers/out", &project_root); -} - -#[cargo_test] -fn list_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/list_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["your-face"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/list_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/list_features/stderr.log"); - - assert().subset_matches("tests/snapshots/add/list_features/out", &project_root); -} - -#[cargo_test] -fn list_features_path() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/list_features_path/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --path ../dependency") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/list_features_path/stdout.log") - .stderr_matches_path("tests/snapshots/add/list_features_path/stderr.log"); - - assert().subset_matches("tests/snapshots/add/list_features_path/out", &project_root); -} - -#[cargo_test] -fn list_features_path_no_default() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/list_features_path_no_default/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .args([ - "your-face", - "--path", - "../dependency", - "--no-default-features", - ]) - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/list_features_path_no_default/stdout.log") - .stderr_matches_path("tests/snapshots/add/list_features_path_no_default/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/list_features_path_no_default/out", - &project_root, - ); -} - -#[cargo_test] -fn manifest_path_package() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/manifest_path_package/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .args([ - "--manifest-path", - "Cargo.toml", - "--package", - "cargo-list-test-fixture", - "cargo-list-test-fixture-dependency", - ]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/manifest_path_package/stdout.log") - .stderr_matches_path("tests/snapshots/add/manifest_path_package/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/manifest_path_package/out", - &project_root, - ); -} - -#[cargo_test] -fn merge_activated_features() { - let project = Project::from_template("tests/snapshots/add/merge_activated_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "-p", "bar"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/merge_activated_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/merge_activated_features/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/merge_activated_features/out", - &project_root, - ); -} - -#[cargo_test] -fn multiple_conflicts_with_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/multiple_conflicts_with_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 your-face --features nose") - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/multiple_conflicts_with_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/multiple_conflicts_with_features/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/multiple_conflicts_with_features/out", - &project_root, - ); -} - -#[cargo_test] -fn git_multiple_names() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/git_multiple_names/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("git-package", |project| { - project - .file( - "p1/Cargo.toml", - &cargo_test_support::basic_manifest("my-package1", "0.3.0+my-package1"), - ) - .file("p1/src/lib.rs", "") - .file( - "p2/Cargo.toml", - &cargo_test_support::basic_manifest("my-package2", "0.3.0+my-package2"), - ) - .file("p2/src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["my-package1", "my-package2", "--git", &git_url]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/git_multiple_names/stdout.log") - .stderr_matches_path("tests/snapshots/add/git_multiple_names/stderr.log"); - - assert().subset_matches("tests/snapshots/add/git_multiple_names/out", &project_root); -} - -#[cargo_test] -fn multiple_conflicts_with_rename() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/multiple_conflicts_with_rename/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2 --rename renamed") - .current_dir(cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/add/multiple_conflicts_with_rename/stdout.log") - .stderr_matches_path("tests/snapshots/add/multiple_conflicts_with_rename/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/multiple_conflicts_with_rename/out", - &project_root, - ); -} - -#[cargo_test] -fn namever() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/namever/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1@>=0.1.1 my-package2@0.2.3 my-package") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/namever/stdout.log") - .stderr_matches_path("tests/snapshots/add/namever/stderr.log"); - - assert().subset_matches("tests/snapshots/add/namever/out", &project_root); -} - -#[cargo_test] -fn no_args() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/no_args/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .current_dir(cwd) - .assert() - .code(1) - .stdout_matches_path("tests/snapshots/add/no_args/stdout.log") - .stderr_matches_path("tests/snapshots/add/no_args/stderr.log"); - - assert().subset_matches("tests/snapshots/add/no_args/out", &project_root); -} - -#[cargo_test] -fn no_default_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/no_default_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --no-default-features") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/no_default_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/no_default_features/stderr.log"); - - assert().subset_matches("tests/snapshots/add/no_default_features/out", &project_root); -} - -#[cargo_test] -fn no_optional() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/no_optional/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --no-optional") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/no_optional/stdout.log") - .stderr_matches_path("tests/snapshots/add/no_optional/stderr.log"); - - assert().subset_matches("tests/snapshots/add/no_optional/out", &project_root); -} - -#[cargo_test] -fn optional() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/optional/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --optional") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/optional/stdout.log") - .stderr_matches_path("tests/snapshots/add/optional/stderr.log"); - - assert().subset_matches("tests/snapshots/add/optional/out", &project_root); -} - -#[cargo_test] -fn overwrite_default_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_default_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --default-features") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_default_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_default_features/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_default_features/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_default_features_with_no_default_features() { - init_registry(); - let project = Project::from_template( - "tests/snapshots/add/overwrite_default_features_with_no_default_features/in", - ); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --no-default-features") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path( - "tests/snapshots/add/overwrite_default_features_with_no_default_features/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/add/overwrite_default_features_with_no_default_features/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/add/overwrite_default_features_with_no_default_features/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --features nose") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_features/stderr.log"); - - assert().subset_matches("tests/snapshots/add/overwrite_features/out", &project_root); -} - -#[cargo_test] -fn overwrite_git_with_path() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_git_with_path/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --path ../dependency") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_git_with_path/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_git_with_path/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_git_with_path/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_inline_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_inline_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line( - "unrelateed-crate your-face --features your-face/nose,your-face/mouth -Fyour-face/ears", - ) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_inline_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_inline_features/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_inline_features/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_inherit_features_noop() { - let project = Project::from_template("tests/snapshots/add/overwrite_inherit_features_noop/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "-p", "bar"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_inherit_features_noop/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_inherit_features_noop/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_inherit_features_noop/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_inherit_noop() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_inherit_noop/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "-p", "bar"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_inherit_noop/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_inherit_noop/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_inherit_noop/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_inherit_optional_noop() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_inherit_optional_noop/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "-p", "bar"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_inherit_optional_noop/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_inherit_optional_noop/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_inherit_optional_noop/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_name_dev_noop() { - init_alt_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_name_dev_noop/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --dev") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_name_dev_noop/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_name_dev_noop/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_name_dev_noop/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_name_noop() { - init_alt_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_name_noop/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_name_noop/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_name_noop/stderr.log"); - - assert().subset_matches("tests/snapshots/add/overwrite_name_noop/out", &project_root); -} - -#[cargo_test] -fn overwrite_no_default_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_no_default_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --no-default-features") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_no_default_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_no_default_features/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_no_default_features/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_no_default_features_with_default_features() { - init_registry(); - let project = Project::from_template( - "tests/snapshots/add/overwrite_no_default_features_with_default_features/in", - ); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --default-features") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path( - "tests/snapshots/add/overwrite_no_default_features_with_default_features/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/add/overwrite_no_default_features_with_default_features/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/add/overwrite_no_default_features_with_default_features/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_no_optional() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_no_optional/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --no-optional") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_no_optional/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_no_optional/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_no_optional/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_no_optional_with_optional() { - init_registry(); - let project = - Project::from_template("tests/snapshots/add/overwrite_no_optional_with_optional/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --optional") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_no_optional_with_optional/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_no_optional_with_optional/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_no_optional_with_optional/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_optional() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_optional/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --optional") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_optional/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_optional/stderr.log"); - - assert().subset_matches("tests/snapshots/add/overwrite_optional/out", &project_root); -} - -#[cargo_test] -fn overwrite_optional_with_no_optional() { - init_registry(); - let project = - Project::from_template("tests/snapshots/add/overwrite_optional_with_no_optional/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2@0.4.1 --no-optional") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_optional_with_no_optional/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_optional_with_no_optional/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_optional_with_no_optional/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_path_noop() { - init_alt_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_path_noop/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("your-face --path ./dependency") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_path_noop/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_path_noop/stderr.log"); - - assert().subset_matches("tests/snapshots/add/overwrite_path_noop/out", &project_root); -} - -#[cargo_test] -fn overwrite_path_with_version() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_path_with_version/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency@20.0") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_path_with_version/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_path_with_version/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_path_with_version/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_rename_with_no_rename() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_rename_with_no_rename/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("versioned-package") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_rename_with_no_rename/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_rename_with_no_rename/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_rename_with_no_rename/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_rename_with_rename() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_rename_with_rename/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("versioned-package --rename a2") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_rename_with_rename/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_rename_with_rename/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_rename_with_rename/out", - &project_root, - ); -} - -#[cargo_test] -fn change_rename_target() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/change_rename_target/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package2 --rename some-package") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/change_rename_target/stdout.log") - .stderr_matches_path("tests/snapshots/add/change_rename_target/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/change_rename_target/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_rename_with_rename_noop() { - init_registry(); - let project = - Project::from_template("tests/snapshots/add/overwrite_rename_with_rename_noop/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("versioned-package --rename a1") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_rename_with_rename_noop/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_rename_with_rename_noop/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_rename_with_rename_noop/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_version_with_git() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_version_with_git/in"); - let project_root = project.root(); - let cwd = &project_root; - let git_dep = cargo_test_support::git::new("versioned-package", |project| { - project - .file( - "Cargo.toml", - &cargo_test_support::basic_manifest("versioned-package", "0.3.0+versioned-package"), - ) - .file("src/lib.rs", "") - }); - let git_url = git_dep.url().to_string(); - - snapbox::cmd::Command::cargo() - .arg("add") - .args(["versioned-package", "--git", &git_url]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_version_with_git/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_version_with_git/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_version_with_git/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_version_with_path() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_version_with_path/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --path ../dependency") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_version_with_path/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_version_with_path/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_version_with_path/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_with_rename() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_with_rename/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("versioned-package --rename renamed") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_with_rename/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_with_rename/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_with_rename/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_workspace_dep() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_workspace_dep/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "--path", "./dependency", "-p", "bar"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_workspace_dep/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_workspace_dep/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_workspace_dep/out", - &project_root, - ); -} - -#[cargo_test] -fn overwrite_workspace_dep_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/overwrite_workspace_dep_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "--path", "./dependency", "-p", "bar"]) - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/overwrite_workspace_dep_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/overwrite_workspace_dep_features/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/overwrite_workspace_dep_features/out", - &project_root, - ); -} - -#[cargo_test] -fn preserve_sorted() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/preserve_sorted/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("toml") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/preserve_sorted/stdout.log") - .stderr_matches_path("tests/snapshots/add/preserve_sorted/stderr.log"); - - assert().subset_matches("tests/snapshots/add/preserve_sorted/out", &project_root); -} - -#[cargo_test] -fn preserve_unsorted() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/preserve_unsorted/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("toml") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/preserve_unsorted/stdout.log") - .stderr_matches_path("tests/snapshots/add/preserve_unsorted/stderr.log"); - - assert().subset_matches("tests/snapshots/add/preserve_unsorted/out", &project_root); -} - -#[cargo_test] -fn registry() { - init_alt_registry(); - let project = Project::from_template("tests/snapshots/add/registry/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2 --registry alternative") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/registry/stdout.log") - .stderr_matches_path("tests/snapshots/add/registry/stderr.log"); - - assert().subset_matches("tests/snapshots/add/registry/out", &project_root); -} - -#[cargo_test] -fn rename() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/rename/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package --rename renamed") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/rename/stdout.log") - .stderr_matches_path("tests/snapshots/add/rename/stderr.log"); - - assert().subset_matches("tests/snapshots/add/rename/out", &project_root); -} - -#[cargo_test] -fn target() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/target/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2 --target i686-unknown-linux-gnu") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/target/stdout.log") - .stderr_matches_path("tests/snapshots/add/target/stderr.log"); - - assert().subset_matches("tests/snapshots/add/target/out", &project_root); -} - -#[cargo_test] -fn target_cfg() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/target_cfg/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package1 my-package2 --target cfg(unix)") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/target_cfg/stdout.log") - .stderr_matches_path("tests/snapshots/add/target_cfg/stderr.log"); - - assert().subset_matches("tests/snapshots/add/target_cfg/out", &project_root); -} - -#[cargo_test] -fn unknown_inherited_feature() { - let project = Project::from_template("tests/snapshots/add/unknown_inherited_feature/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .masquerade_as_nightly_cargo() - .arg("add") - .args(["foo", "-p", "bar"]) - .current_dir(cwd) - .assert() - .failure() - .stdout_matches_path("tests/snapshots/add/unknown_inherited_feature/stdout.log") - .stderr_matches_path("tests/snapshots/add/unknown_inherited_feature/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/unknown_inherited_feature/out", - &project_root, - ); -} - -#[cargo_test] -fn vers() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/vers/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package@>=0.1.1") - .current_dir(cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/vers/stdout.log") - .stderr_matches_path("tests/snapshots/add/vers/stderr.log"); - - assert().subset_matches("tests/snapshots/add/vers/out", &project_root); -} - -#[cargo_test] -fn workspace_path() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/workspace_path/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --path ../dependency") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/workspace_path/stdout.log") - .stderr_matches_path("tests/snapshots/add/workspace_path/stderr.log"); - - assert().subset_matches("tests/snapshots/add/workspace_path/out", &project_root); -} - -#[cargo_test] -fn workspace_path_dev() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/workspace_path_dev/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency --path ../dependency --dev") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/workspace_path_dev/stdout.log") - .stderr_matches_path("tests/snapshots/add/workspace_path_dev/stderr.log"); - - assert().subset_matches("tests/snapshots/add/workspace_path_dev/out", &project_root); -} - -#[cargo_test] -fn workspace_name() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/workspace_name/in"); - let project_root = project.root(); - let cwd = project_root.join("primary"); - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("cargo-list-test-fixture-dependency") - .current_dir(&cwd) - .assert() - .success() - .stdout_matches_path("tests/snapshots/add/workspace_name/stdout.log") - .stderr_matches_path("tests/snapshots/add/workspace_name/stderr.log"); - - assert().subset_matches("tests/snapshots/add/workspace_name/out", &project_root); -} - -#[cargo_test] -fn deprecated_default_features() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/deprecated_default_features/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package") - .current_dir(&cwd) - .assert() - .failure() - .stdout_matches_path("tests/snapshots/add/deprecated_default_features/stdout.log") - .stderr_matches_path("tests/snapshots/add/deprecated_default_features/stderr.log"); - - assert().subset_matches( - "tests/snapshots/add/deprecated_default_features/out", - &project_root, - ); -} - -#[cargo_test] -fn deprecated_section() { - init_registry(); - let project = Project::from_template("tests/snapshots/add/deprecated_section/in"); - let project_root = project.root(); - let cwd = &project_root; - - snapbox::cmd::Command::cargo() - .arg("add") - .arg_line("my-package") - .current_dir(&cwd) - .assert() - .failure() - .stdout_matches_path("tests/snapshots/add/deprecated_section/stdout.log") - .stderr_matches_path("tests/snapshots/add/deprecated_section/stderr.log"); - - assert().subset_matches("tests/snapshots/add/deprecated_section/out", &project_root); -} diff --git a/tests/snapshots/add/add-basic.in/Cargo.toml b/tests/testsuite/cargo_add/add-basic.in/Cargo.toml similarity index 100% rename from tests/snapshots/add/add-basic.in/Cargo.toml rename to tests/testsuite/cargo_add/add-basic.in/Cargo.toml diff --git a/tests/snapshots/add/add-basic.in/src/lib.rs b/tests/testsuite/cargo_add/add-basic.in/src/lib.rs similarity index 100% rename from tests/snapshots/add/add-basic.in/src/lib.rs rename to tests/testsuite/cargo_add/add-basic.in/src/lib.rs diff --git a/tests/snapshots/add/add_basic/in b/tests/testsuite/cargo_add/add_basic/in similarity index 100% rename from tests/snapshots/add/add_basic/in rename to tests/testsuite/cargo_add/add_basic/in diff --git a/tests/testsuite/cargo_add/add_basic/mod.rs b/tests/testsuite/cargo_add/add_basic/mod.rs new file mode 100644 index 00000000000..241e12c16de --- /dev/null +++ b/tests/testsuite/cargo_add/add_basic/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn add_basic() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/add_basic/out/Cargo.toml b/tests/testsuite/cargo_add/add_basic/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/add_basic/out/Cargo.toml rename to tests/testsuite/cargo_add/add_basic/out/Cargo.toml diff --git a/tests/snapshots/add/add_basic/stderr.log b/tests/testsuite/cargo_add/add_basic/stderr.log similarity index 100% rename from tests/snapshots/add/add_basic/stderr.log rename to tests/testsuite/cargo_add/add_basic/stderr.log diff --git a/tests/snapshots/add/add_basic/stdout.log b/tests/testsuite/cargo_add/add_basic/stdout.log similarity index 100% rename from tests/snapshots/add/add_basic/stdout.log rename to tests/testsuite/cargo_add/add_basic/stdout.log diff --git a/tests/snapshots/add/add_multiple/in b/tests/testsuite/cargo_add/add_multiple/in similarity index 100% rename from tests/snapshots/add/add_multiple/in rename to tests/testsuite/cargo_add/add_multiple/in diff --git a/tests/testsuite/cargo_add/add_multiple/mod.rs b/tests/testsuite/cargo_add/add_multiple/mod.rs new file mode 100644 index 00000000000..1099f65ee4e --- /dev/null +++ b/tests/testsuite/cargo_add/add_multiple/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn add_multiple() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/add_multiple/out/Cargo.toml b/tests/testsuite/cargo_add/add_multiple/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/add_multiple/out/Cargo.toml rename to tests/testsuite/cargo_add/add_multiple/out/Cargo.toml diff --git a/tests/snapshots/add/add_multiple/stderr.log b/tests/testsuite/cargo_add/add_multiple/stderr.log similarity index 100% rename from tests/snapshots/add/add_multiple/stderr.log rename to tests/testsuite/cargo_add/add_multiple/stderr.log diff --git a/tests/snapshots/add/add_multiple/stdout.log b/tests/testsuite/cargo_add/add_multiple/stdout.log similarity index 100% rename from tests/snapshots/add/add_multiple/stdout.log rename to tests/testsuite/cargo_add/add_multiple/stdout.log diff --git a/tests/snapshots/add/add_normalized_name_external/in b/tests/testsuite/cargo_add/add_normalized_name_external/in similarity index 100% rename from tests/snapshots/add/add_normalized_name_external/in rename to tests/testsuite/cargo_add/add_normalized_name_external/in diff --git a/tests/testsuite/cargo_add/add_normalized_name_external/mod.rs b/tests/testsuite/cargo_add/add_normalized_name_external/mod.rs new file mode 100644 index 00000000000..50b3559d6cc --- /dev/null +++ b/tests/testsuite/cargo_add/add_normalized_name_external/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn add_normalized_name_external() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("linked_hash_map Inflector") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/add_normalized_name_external/out/Cargo.toml b/tests/testsuite/cargo_add/add_normalized_name_external/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/add_normalized_name_external/out/Cargo.toml rename to tests/testsuite/cargo_add/add_normalized_name_external/out/Cargo.toml diff --git a/tests/snapshots/add/add_normalized_name_external/stderr.log b/tests/testsuite/cargo_add/add_normalized_name_external/stderr.log similarity index 100% rename from tests/snapshots/add/add_normalized_name_external/stderr.log rename to tests/testsuite/cargo_add/add_normalized_name_external/stderr.log diff --git a/tests/snapshots/add/add_normalized_name_external/stdout.log b/tests/testsuite/cargo_add/add_normalized_name_external/stdout.log similarity index 100% rename from tests/snapshots/add/add_normalized_name_external/stdout.log rename to tests/testsuite/cargo_add/add_normalized_name_external/stdout.log diff --git a/tests/snapshots/add/build/in b/tests/testsuite/cargo_add/build/in similarity index 100% rename from tests/snapshots/add/build/in rename to tests/testsuite/cargo_add/build/in diff --git a/tests/testsuite/cargo_add/build/mod.rs b/tests/testsuite/cargo_add/build/mod.rs new file mode 100644 index 00000000000..e791ed8e8f5 --- /dev/null +++ b/tests/testsuite/cargo_add/build/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn build() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("--build my-build-package1 my-build-package2") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/build/out/Cargo.toml b/tests/testsuite/cargo_add/build/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/build/out/Cargo.toml rename to tests/testsuite/cargo_add/build/out/Cargo.toml diff --git a/tests/snapshots/add/build/stderr.log b/tests/testsuite/cargo_add/build/stderr.log similarity index 100% rename from tests/snapshots/add/build/stderr.log rename to tests/testsuite/cargo_add/build/stderr.log diff --git a/tests/snapshots/add/build/stdout.log b/tests/testsuite/cargo_add/build/stdout.log similarity index 100% rename from tests/snapshots/add/build/stdout.log rename to tests/testsuite/cargo_add/build/stdout.log diff --git a/tests/snapshots/add/change_rename_target/in/Cargo.toml b/tests/testsuite/cargo_add/change_rename_target/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/change_rename_target/in/Cargo.toml rename to tests/testsuite/cargo_add/change_rename_target/in/Cargo.toml diff --git a/tests/snapshots/add/change_rename_target/in/src/lib.rs b/tests/testsuite/cargo_add/change_rename_target/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/change_rename_target/in/src/lib.rs rename to tests/testsuite/cargo_add/change_rename_target/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/change_rename_target/mod.rs b/tests/testsuite/cargo_add/change_rename_target/mod.rs new file mode 100644 index 00000000000..6237bd030ce --- /dev/null +++ b/tests/testsuite/cargo_add/change_rename_target/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn change_rename_target() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package2 --rename some-package") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/change_rename_target/out/Cargo.toml b/tests/testsuite/cargo_add/change_rename_target/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/change_rename_target/out/Cargo.toml rename to tests/testsuite/cargo_add/change_rename_target/out/Cargo.toml diff --git a/tests/snapshots/add/change_rename_target/stderr.log b/tests/testsuite/cargo_add/change_rename_target/stderr.log similarity index 100% rename from tests/snapshots/add/change_rename_target/stderr.log rename to tests/testsuite/cargo_add/change_rename_target/stderr.log diff --git a/tests/snapshots/add/change_rename_target/stdout.log b/tests/testsuite/cargo_add/change_rename_target/stdout.log similarity index 100% rename from tests/snapshots/add/change_rename_target/stdout.log rename to tests/testsuite/cargo_add/change_rename_target/stdout.log diff --git a/tests/snapshots/add/default_features/in b/tests/testsuite/cargo_add/default_features/in similarity index 100% rename from tests/snapshots/add/default_features/in rename to tests/testsuite/cargo_add/default_features/in diff --git a/tests/testsuite/cargo_add/default_features/mod.rs b/tests/testsuite/cargo_add/default_features/mod.rs new file mode 100644 index 00000000000..c431a42e8ae --- /dev/null +++ b/tests/testsuite/cargo_add/default_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn default_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --default-features") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/default_features/out/Cargo.toml b/tests/testsuite/cargo_add/default_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/default_features/out/Cargo.toml rename to tests/testsuite/cargo_add/default_features/out/Cargo.toml diff --git a/tests/snapshots/add/default_features/stderr.log b/tests/testsuite/cargo_add/default_features/stderr.log similarity index 100% rename from tests/snapshots/add/default_features/stderr.log rename to tests/testsuite/cargo_add/default_features/stderr.log diff --git a/tests/snapshots/add/default_features/stdout.log b/tests/testsuite/cargo_add/default_features/stdout.log similarity index 100% rename from tests/snapshots/add/default_features/stdout.log rename to tests/testsuite/cargo_add/default_features/stdout.log diff --git a/tests/snapshots/add/deprecated_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/deprecated_default_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/deprecated_default_features/in/Cargo.toml rename to tests/testsuite/cargo_add/deprecated_default_features/in/Cargo.toml diff --git a/tests/snapshots/add/deprecated_default_features/in/src/lib.rs b/tests/testsuite/cargo_add/deprecated_default_features/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/deprecated_default_features/in/src/lib.rs rename to tests/testsuite/cargo_add/deprecated_default_features/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/deprecated_default_features/mod.rs b/tests/testsuite/cargo_add/deprecated_default_features/mod.rs new file mode 100644 index 00000000000..3aa4667192e --- /dev/null +++ b/tests/testsuite/cargo_add/deprecated_default_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn deprecated_default_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package") + .current_dir(&cwd) + .assert() + .failure() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/deprecated_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/deprecated_default_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/deprecated_default_features/out/Cargo.toml rename to tests/testsuite/cargo_add/deprecated_default_features/out/Cargo.toml diff --git a/tests/snapshots/add/deprecated_default_features/stderr.log b/tests/testsuite/cargo_add/deprecated_default_features/stderr.log similarity index 100% rename from tests/snapshots/add/deprecated_default_features/stderr.log rename to tests/testsuite/cargo_add/deprecated_default_features/stderr.log diff --git a/tests/snapshots/add/deprecated_default_features/stdout.log b/tests/testsuite/cargo_add/deprecated_default_features/stdout.log similarity index 100% rename from tests/snapshots/add/deprecated_default_features/stdout.log rename to tests/testsuite/cargo_add/deprecated_default_features/stdout.log diff --git a/tests/snapshots/add/deprecated_section/in/Cargo.toml b/tests/testsuite/cargo_add/deprecated_section/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/deprecated_section/in/Cargo.toml rename to tests/testsuite/cargo_add/deprecated_section/in/Cargo.toml diff --git a/tests/snapshots/add/deprecated_section/in/src/lib.rs b/tests/testsuite/cargo_add/deprecated_section/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/deprecated_section/in/src/lib.rs rename to tests/testsuite/cargo_add/deprecated_section/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/deprecated_section/mod.rs b/tests/testsuite/cargo_add/deprecated_section/mod.rs new file mode 100644 index 00000000000..c4efa889db8 --- /dev/null +++ b/tests/testsuite/cargo_add/deprecated_section/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn deprecated_section() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package") + .current_dir(&cwd) + .assert() + .failure() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/deprecated_section/out/Cargo.toml b/tests/testsuite/cargo_add/deprecated_section/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/deprecated_section/out/Cargo.toml rename to tests/testsuite/cargo_add/deprecated_section/out/Cargo.toml diff --git a/tests/snapshots/add/deprecated_section/stderr.log b/tests/testsuite/cargo_add/deprecated_section/stderr.log similarity index 100% rename from tests/snapshots/add/deprecated_section/stderr.log rename to tests/testsuite/cargo_add/deprecated_section/stderr.log diff --git a/tests/snapshots/add/deprecated_section/stdout.log b/tests/testsuite/cargo_add/deprecated_section/stdout.log similarity index 100% rename from tests/snapshots/add/deprecated_section/stdout.log rename to tests/testsuite/cargo_add/deprecated_section/stdout.log diff --git a/tests/snapshots/add/detect_workspace_inherit/in/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/in/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit/in/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/detect_workspace_inherit/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/detect_workspace_inherit/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/detect_workspace_inherit/in/primary/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit/in/primary/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit/in/primary/src/lib.rs b/tests/testsuite/cargo_add/detect_workspace_inherit/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/detect_workspace_inherit/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit/mod.rs b/tests/testsuite/cargo_add/detect_workspace_inherit/mod.rs new file mode 100644 index 00000000000..5000ff19cdb --- /dev/null +++ b/tests/testsuite/cargo_add/detect_workspace_inherit/mod.rs @@ -0,0 +1,26 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn detect_workspace_inherit() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "-p", "bar"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/detect_workspace_inherit/out/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/out/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit/out/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit/out/primary/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit/out/primary/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit/stderr.log b/tests/testsuite/cargo_add/detect_workspace_inherit/stderr.log similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/stderr.log rename to tests/testsuite/cargo_add/detect_workspace_inherit/stderr.log diff --git a/tests/snapshots/add/detect_workspace_inherit/stdout.log b/tests/testsuite/cargo_add/detect_workspace_inherit/stdout.log similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit/stdout.log rename to tests/testsuite/cargo_add/detect_workspace_inherit/stdout.log diff --git a/tests/snapshots/add/detect_workspace_inherit_features/in/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/in/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/in/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_features/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_features/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_features/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/detect_workspace_inherit_features/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/detect_workspace_inherit_features/in/primary/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_features/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/in/primary/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_features/in/primary/src/lib.rs b/tests/testsuite/cargo_add/detect_workspace_inherit_features/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_features/mod.rs b/tests/testsuite/cargo_add/detect_workspace_inherit_features/mod.rs new file mode 100644 index 00000000000..cda596cd69d --- /dev/null +++ b/tests/testsuite/cargo_add/detect_workspace_inherit_features/mod.rs @@ -0,0 +1,26 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn detect_workspace_inherit_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "-p", "bar", "--features", "test"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/detect_workspace_inherit_features/out/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/out/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/out/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_features/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_features/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_features/out/primary/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_features/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/out/primary/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_features/stderr.log b/tests/testsuite/cargo_add/detect_workspace_inherit_features/stderr.log similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/stderr.log rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/stderr.log diff --git a/tests/snapshots/add/detect_workspace_inherit_features/stdout.log b/tests/testsuite/cargo_add/detect_workspace_inherit_features/stdout.log similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_features/stdout.log rename to tests/testsuite/cargo_add/detect_workspace_inherit_features/stdout.log diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/in/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/in/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/in/primary/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/primary/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/in/primary/src/lib.rs b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/detect_workspace_inherit_optional/mod.rs b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/mod.rs new file mode 100644 index 00000000000..8e9ccb9c2fa --- /dev/null +++ b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/mod.rs @@ -0,0 +1,26 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn detect_workspace_inherit_optional() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "-p", "bar", "--optional"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/out/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/out/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/out/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/out/primary/Cargo.toml b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/out/primary/Cargo.toml diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/stderr.log b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/stderr.log similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/stderr.log rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/stderr.log diff --git a/tests/snapshots/add/detect_workspace_inherit_optional/stdout.log b/tests/testsuite/cargo_add/detect_workspace_inherit_optional/stdout.log similarity index 100% rename from tests/snapshots/add/detect_workspace_inherit_optional/stdout.log rename to tests/testsuite/cargo_add/detect_workspace_inherit_optional/stdout.log diff --git a/tests/snapshots/add/dev/in b/tests/testsuite/cargo_add/dev/in similarity index 100% rename from tests/snapshots/add/dev/in rename to tests/testsuite/cargo_add/dev/in diff --git a/tests/testsuite/cargo_add/dev/mod.rs b/tests/testsuite/cargo_add/dev/mod.rs new file mode 100644 index 00000000000..ad5982b211b --- /dev/null +++ b/tests/testsuite/cargo_add/dev/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn dev() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("--dev my-dev-package1 my-dev-package2") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/dev/out/Cargo.toml b/tests/testsuite/cargo_add/dev/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/dev/out/Cargo.toml rename to tests/testsuite/cargo_add/dev/out/Cargo.toml diff --git a/tests/snapshots/add/dev/stderr.log b/tests/testsuite/cargo_add/dev/stderr.log similarity index 100% rename from tests/snapshots/add/dev/stderr.log rename to tests/testsuite/cargo_add/dev/stderr.log diff --git a/tests/snapshots/add/dev/stdout.log b/tests/testsuite/cargo_add/dev/stdout.log similarity index 100% rename from tests/snapshots/add/dev/stdout.log rename to tests/testsuite/cargo_add/dev/stdout.log diff --git a/tests/snapshots/add/dev_build_conflict/in b/tests/testsuite/cargo_add/dev_build_conflict/in similarity index 100% rename from tests/snapshots/add/dev_build_conflict/in rename to tests/testsuite/cargo_add/dev_build_conflict/in diff --git a/tests/testsuite/cargo_add/dev_build_conflict/mod.rs b/tests/testsuite/cargo_add/dev_build_conflict/mod.rs new file mode 100644 index 00000000000..4ae373c5dde --- /dev/null +++ b/tests/testsuite/cargo_add/dev_build_conflict/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn dev_build_conflict() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package --dev --build") + .current_dir(cwd) + .assert() + .code(1) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/dev_build_conflict/out/Cargo.toml b/tests/testsuite/cargo_add/dev_build_conflict/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/dev_build_conflict/out/Cargo.toml rename to tests/testsuite/cargo_add/dev_build_conflict/out/Cargo.toml diff --git a/tests/snapshots/add/dev_build_conflict/stderr.log b/tests/testsuite/cargo_add/dev_build_conflict/stderr.log similarity index 100% rename from tests/snapshots/add/dev_build_conflict/stderr.log rename to tests/testsuite/cargo_add/dev_build_conflict/stderr.log diff --git a/tests/snapshots/add/dev_build_conflict/stdout.log b/tests/testsuite/cargo_add/dev_build_conflict/stdout.log similarity index 100% rename from tests/snapshots/add/dev_build_conflict/stdout.log rename to tests/testsuite/cargo_add/dev_build_conflict/stdout.log diff --git a/tests/snapshots/add/dev_prefer_existing_version/in/Cargo.toml b/tests/testsuite/cargo_add/dev_prefer_existing_version/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/dev_prefer_existing_version/in/Cargo.toml rename to tests/testsuite/cargo_add/dev_prefer_existing_version/in/Cargo.toml diff --git a/tests/snapshots/add/dev_prefer_existing_version/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/dev_prefer_existing_version/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/dev_prefer_existing_version/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/dev_prefer_existing_version/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/dev_prefer_existing_version/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/dev_prefer_existing_version/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/dev_prefer_existing_version/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/dev_prefer_existing_version/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/dev_prefer_existing_version/in/src/lib.rs b/tests/testsuite/cargo_add/dev_prefer_existing_version/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/dev_prefer_existing_version/in/src/lib.rs rename to tests/testsuite/cargo_add/dev_prefer_existing_version/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/dev_prefer_existing_version/mod.rs b/tests/testsuite/cargo_add/dev_prefer_existing_version/mod.rs new file mode 100644 index 00000000000..74602a0a2c4 --- /dev/null +++ b/tests/testsuite/cargo_add/dev_prefer_existing_version/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_alt_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn dev_prefer_existing_version() { + init_alt_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --dev") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/dev_prefer_existing_version/out/Cargo.toml b/tests/testsuite/cargo_add/dev_prefer_existing_version/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/dev_prefer_existing_version/out/Cargo.toml rename to tests/testsuite/cargo_add/dev_prefer_existing_version/out/Cargo.toml diff --git a/tests/snapshots/add/dev_prefer_existing_version/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/dev_prefer_existing_version/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/dev_prefer_existing_version/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/dev_prefer_existing_version/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/dev_prefer_existing_version/stderr.log b/tests/testsuite/cargo_add/dev_prefer_existing_version/stderr.log similarity index 100% rename from tests/snapshots/add/dev_prefer_existing_version/stderr.log rename to tests/testsuite/cargo_add/dev_prefer_existing_version/stderr.log diff --git a/tests/snapshots/add/dev_prefer_existing_version/stdout.log b/tests/testsuite/cargo_add/dev_prefer_existing_version/stdout.log similarity index 100% rename from tests/snapshots/add/dev_prefer_existing_version/stdout.log rename to tests/testsuite/cargo_add/dev_prefer_existing_version/stdout.log diff --git a/tests/snapshots/add/dry_run/in b/tests/testsuite/cargo_add/dry_run/in similarity index 100% rename from tests/snapshots/add/dry_run/in rename to tests/testsuite/cargo_add/dry_run/in diff --git a/tests/testsuite/cargo_add/dry_run/mod.rs b/tests/testsuite/cargo_add/dry_run/mod.rs new file mode 100644 index 00000000000..73c09258980 --- /dev/null +++ b/tests/testsuite/cargo_add/dry_run/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn dry_run() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package --dry-run") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/dry_run/out/Cargo.toml b/tests/testsuite/cargo_add/dry_run/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/dry_run/out/Cargo.toml rename to tests/testsuite/cargo_add/dry_run/out/Cargo.toml diff --git a/tests/snapshots/add/dry_run/stderr.log b/tests/testsuite/cargo_add/dry_run/stderr.log similarity index 100% rename from tests/snapshots/add/dry_run/stderr.log rename to tests/testsuite/cargo_add/dry_run/stderr.log diff --git a/tests/snapshots/add/dry_run/stdout.log b/tests/testsuite/cargo_add/dry_run/stdout.log similarity index 100% rename from tests/snapshots/add/dry_run/stdout.log rename to tests/testsuite/cargo_add/dry_run/stdout.log diff --git a/tests/snapshots/add/features/in b/tests/testsuite/cargo_add/features/in similarity index 100% rename from tests/snapshots/add/features/in rename to tests/testsuite/cargo_add/features/in diff --git a/tests/testsuite/cargo_add/features/mod.rs b/tests/testsuite/cargo_add/features/mod.rs new file mode 100644 index 00000000000..281111786a3 --- /dev/null +++ b/tests/testsuite/cargo_add/features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --features eyes") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/features/out/Cargo.toml b/tests/testsuite/cargo_add/features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/features/out/Cargo.toml rename to tests/testsuite/cargo_add/features/out/Cargo.toml diff --git a/tests/snapshots/add/features/stderr.log b/tests/testsuite/cargo_add/features/stderr.log similarity index 100% rename from tests/snapshots/add/features/stderr.log rename to tests/testsuite/cargo_add/features/stderr.log diff --git a/tests/snapshots/add/features/stdout.log b/tests/testsuite/cargo_add/features/stdout.log similarity index 100% rename from tests/snapshots/add/features/stdout.log rename to tests/testsuite/cargo_add/features/stdout.log diff --git a/tests/snapshots/add/features_empty/in b/tests/testsuite/cargo_add/features_empty/in similarity index 100% rename from tests/snapshots/add/features_empty/in rename to tests/testsuite/cargo_add/features_empty/in diff --git a/tests/testsuite/cargo_add/features_empty/mod.rs b/tests/testsuite/cargo_add/features_empty/mod.rs new file mode 100644 index 00000000000..21813e5627d --- /dev/null +++ b/tests/testsuite/cargo_add/features_empty/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn features_empty() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --features ''") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/features_empty/out/Cargo.toml b/tests/testsuite/cargo_add/features_empty/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/features_empty/out/Cargo.toml rename to tests/testsuite/cargo_add/features_empty/out/Cargo.toml diff --git a/tests/snapshots/add/features_empty/stderr.log b/tests/testsuite/cargo_add/features_empty/stderr.log similarity index 100% rename from tests/snapshots/add/features_empty/stderr.log rename to tests/testsuite/cargo_add/features_empty/stderr.log diff --git a/tests/snapshots/add/features_empty/stdout.log b/tests/testsuite/cargo_add/features_empty/stdout.log similarity index 100% rename from tests/snapshots/add/features_empty/stdout.log rename to tests/testsuite/cargo_add/features_empty/stdout.log diff --git a/tests/snapshots/add/features_multiple_occurrences/in b/tests/testsuite/cargo_add/features_multiple_occurrences/in similarity index 100% rename from tests/snapshots/add/features_multiple_occurrences/in rename to tests/testsuite/cargo_add/features_multiple_occurrences/in diff --git a/tests/testsuite/cargo_add/features_multiple_occurrences/mod.rs b/tests/testsuite/cargo_add/features_multiple_occurrences/mod.rs new file mode 100644 index 00000000000..3ad87739697 --- /dev/null +++ b/tests/testsuite/cargo_add/features_multiple_occurrences/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn features_multiple_occurrences() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --features eyes --features nose") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/features_multiple_occurrences/out/Cargo.toml b/tests/testsuite/cargo_add/features_multiple_occurrences/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/features_multiple_occurrences/out/Cargo.toml rename to tests/testsuite/cargo_add/features_multiple_occurrences/out/Cargo.toml diff --git a/tests/snapshots/add/features_multiple_occurrences/stderr.log b/tests/testsuite/cargo_add/features_multiple_occurrences/stderr.log similarity index 100% rename from tests/snapshots/add/features_multiple_occurrences/stderr.log rename to tests/testsuite/cargo_add/features_multiple_occurrences/stderr.log diff --git a/tests/snapshots/add/features_multiple_occurrences/stdout.log b/tests/testsuite/cargo_add/features_multiple_occurrences/stdout.log similarity index 100% rename from tests/snapshots/add/features_multiple_occurrences/stdout.log rename to tests/testsuite/cargo_add/features_multiple_occurrences/stdout.log diff --git a/tests/snapshots/add/features_preserve/in/Cargo.toml b/tests/testsuite/cargo_add/features_preserve/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/features_preserve/in/Cargo.toml rename to tests/testsuite/cargo_add/features_preserve/in/Cargo.toml diff --git a/tests/snapshots/add/features_preserve/in/src/lib.rs b/tests/testsuite/cargo_add/features_preserve/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/features_preserve/in/src/lib.rs rename to tests/testsuite/cargo_add/features_preserve/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/features_preserve/mod.rs b/tests/testsuite/cargo_add/features_preserve/mod.rs new file mode 100644 index 00000000000..8880009b413 --- /dev/null +++ b/tests/testsuite/cargo_add/features_preserve/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn features_preserve() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/features_preserve/out/Cargo.toml b/tests/testsuite/cargo_add/features_preserve/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/features_preserve/out/Cargo.toml rename to tests/testsuite/cargo_add/features_preserve/out/Cargo.toml diff --git a/tests/snapshots/add/features_preserve/stderr.log b/tests/testsuite/cargo_add/features_preserve/stderr.log similarity index 100% rename from tests/snapshots/add/features_preserve/stderr.log rename to tests/testsuite/cargo_add/features_preserve/stderr.log diff --git a/tests/snapshots/add/features_preserve/stdout.log b/tests/testsuite/cargo_add/features_preserve/stdout.log similarity index 100% rename from tests/snapshots/add/features_preserve/stdout.log rename to tests/testsuite/cargo_add/features_preserve/stdout.log diff --git a/tests/snapshots/add/features_spaced_values/in b/tests/testsuite/cargo_add/features_spaced_values/in similarity index 100% rename from tests/snapshots/add/features_spaced_values/in rename to tests/testsuite/cargo_add/features_spaced_values/in diff --git a/tests/testsuite/cargo_add/features_spaced_values/mod.rs b/tests/testsuite/cargo_add/features_spaced_values/mod.rs new file mode 100644 index 00000000000..1c53706db3d --- /dev/null +++ b/tests/testsuite/cargo_add/features_spaced_values/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn features_spaced_values() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --features eyes,nose") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/features_spaced_values/out/Cargo.toml b/tests/testsuite/cargo_add/features_spaced_values/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/features_spaced_values/out/Cargo.toml rename to tests/testsuite/cargo_add/features_spaced_values/out/Cargo.toml diff --git a/tests/snapshots/add/features_spaced_values/stderr.log b/tests/testsuite/cargo_add/features_spaced_values/stderr.log similarity index 100% rename from tests/snapshots/add/features_spaced_values/stderr.log rename to tests/testsuite/cargo_add/features_spaced_values/stderr.log diff --git a/tests/snapshots/add/features_spaced_values/stdout.log b/tests/testsuite/cargo_add/features_spaced_values/stdout.log similarity index 100% rename from tests/snapshots/add/features_spaced_values/stdout.log rename to tests/testsuite/cargo_add/features_spaced_values/stdout.log diff --git a/tests/snapshots/add/features_unknown/in b/tests/testsuite/cargo_add/features_unknown/in similarity index 100% rename from tests/snapshots/add/features_unknown/in rename to tests/testsuite/cargo_add/features_unknown/in diff --git a/tests/testsuite/cargo_add/features_unknown/mod.rs b/tests/testsuite/cargo_add/features_unknown/mod.rs new file mode 100644 index 00000000000..7f7939cd7fb --- /dev/null +++ b/tests/testsuite/cargo_add/features_unknown/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn features_unknown() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --features noze") + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/features_unknown/out/Cargo.toml b/tests/testsuite/cargo_add/features_unknown/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/features_unknown/out/Cargo.toml rename to tests/testsuite/cargo_add/features_unknown/out/Cargo.toml diff --git a/tests/snapshots/add/features_unknown/stderr.log b/tests/testsuite/cargo_add/features_unknown/stderr.log similarity index 100% rename from tests/snapshots/add/features_unknown/stderr.log rename to tests/testsuite/cargo_add/features_unknown/stderr.log diff --git a/tests/snapshots/add/features_unknown/stdout.log b/tests/testsuite/cargo_add/features_unknown/stdout.log similarity index 100% rename from tests/snapshots/add/features_unknown/stdout.log rename to tests/testsuite/cargo_add/features_unknown/stdout.log diff --git a/tests/snapshots/add/git/in b/tests/testsuite/cargo_add/git/in similarity index 100% rename from tests/snapshots/add/git/in rename to tests/testsuite/cargo_add/git/in diff --git a/tests/testsuite/cargo_add/git/mod.rs b/tests/testsuite/cargo_add/git/mod.rs new file mode 100644 index 00000000000..85af09ad27b --- /dev/null +++ b/tests/testsuite/cargo_add/git/mod.rs @@ -0,0 +1,34 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["git-package", "--git", &git_url]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git/out/Cargo.toml b/tests/testsuite/cargo_add/git/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git/out/Cargo.toml rename to tests/testsuite/cargo_add/git/out/Cargo.toml diff --git a/tests/snapshots/add/git/stderr.log b/tests/testsuite/cargo_add/git/stderr.log similarity index 100% rename from tests/snapshots/add/git/stderr.log rename to tests/testsuite/cargo_add/git/stderr.log diff --git a/tests/snapshots/add/git/stdout.log b/tests/testsuite/cargo_add/git/stdout.log similarity index 100% rename from tests/snapshots/add/git/stdout.log rename to tests/testsuite/cargo_add/git/stdout.log diff --git a/tests/snapshots/add/git_branch/in b/tests/testsuite/cargo_add/git_branch/in similarity index 100% rename from tests/snapshots/add/git_branch/in rename to tests/testsuite/cargo_add/git_branch/in diff --git a/tests/testsuite/cargo_add/git_branch/mod.rs b/tests/testsuite/cargo_add/git_branch/mod.rs new file mode 100644 index 00000000000..bb4b551cddc --- /dev/null +++ b/tests/testsuite/cargo_add/git_branch/mod.rs @@ -0,0 +1,37 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_branch() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let (git_dep, git_repo) = cargo_test_support::git::new_repo("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let branch = "dev"; + let find_head = || (git_repo.head().unwrap().peel_to_commit().unwrap()); + git_repo.branch(branch, &find_head(), false).unwrap(); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["git-package", "--git", &git_url, "--branch", branch]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_branch/out/Cargo.toml b/tests/testsuite/cargo_add/git_branch/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_branch/out/Cargo.toml rename to tests/testsuite/cargo_add/git_branch/out/Cargo.toml diff --git a/tests/snapshots/add/git_branch/stderr.log b/tests/testsuite/cargo_add/git_branch/stderr.log similarity index 100% rename from tests/snapshots/add/git_branch/stderr.log rename to tests/testsuite/cargo_add/git_branch/stderr.log diff --git a/tests/snapshots/add/git_branch/stdout.log b/tests/testsuite/cargo_add/git_branch/stdout.log similarity index 100% rename from tests/snapshots/add/git_branch/stdout.log rename to tests/testsuite/cargo_add/git_branch/stdout.log diff --git a/tests/snapshots/add/git_conflicts_namever/in b/tests/testsuite/cargo_add/git_conflicts_namever/in similarity index 100% rename from tests/snapshots/add/git_conflicts_namever/in rename to tests/testsuite/cargo_add/git_conflicts_namever/in diff --git a/tests/testsuite/cargo_add/git_conflicts_namever/mod.rs b/tests/testsuite/cargo_add/git_conflicts_namever/mod.rs new file mode 100644 index 00000000000..02d5f6e149c --- /dev/null +++ b/tests/testsuite/cargo_add/git_conflicts_namever/mod.rs @@ -0,0 +1,29 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_conflicts_namever() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .args([ + "my-package@0.4.3", + "--git", + "https://github.com/dcjanus/invalid", + ]) + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_conflicts_namever/out/Cargo.toml b/tests/testsuite/cargo_add/git_conflicts_namever/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_conflicts_namever/out/Cargo.toml rename to tests/testsuite/cargo_add/git_conflicts_namever/out/Cargo.toml diff --git a/tests/snapshots/add/git_conflicts_namever/stderr.log b/tests/testsuite/cargo_add/git_conflicts_namever/stderr.log similarity index 100% rename from tests/snapshots/add/git_conflicts_namever/stderr.log rename to tests/testsuite/cargo_add/git_conflicts_namever/stderr.log diff --git a/tests/snapshots/add/git_conflicts_namever/stdout.log b/tests/testsuite/cargo_add/git_conflicts_namever/stdout.log similarity index 100% rename from tests/snapshots/add/git_conflicts_namever/stdout.log rename to tests/testsuite/cargo_add/git_conflicts_namever/stdout.log diff --git a/tests/snapshots/add/git_dev/in b/tests/testsuite/cargo_add/git_dev/in similarity index 100% rename from tests/snapshots/add/git_dev/in rename to tests/testsuite/cargo_add/git_dev/in diff --git a/tests/testsuite/cargo_add/git_dev/mod.rs b/tests/testsuite/cargo_add/git_dev/mod.rs new file mode 100644 index 00000000000..fb26ddd2292 --- /dev/null +++ b/tests/testsuite/cargo_add/git_dev/mod.rs @@ -0,0 +1,34 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_dev() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["git-package", "--git", &git_url, "--dev"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_dev/out/Cargo.toml b/tests/testsuite/cargo_add/git_dev/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_dev/out/Cargo.toml rename to tests/testsuite/cargo_add/git_dev/out/Cargo.toml diff --git a/tests/snapshots/add/git_dev/stderr.log b/tests/testsuite/cargo_add/git_dev/stderr.log similarity index 100% rename from tests/snapshots/add/git_dev/stderr.log rename to tests/testsuite/cargo_add/git_dev/stderr.log diff --git a/tests/snapshots/add/git_dev/stdout.log b/tests/testsuite/cargo_add/git_dev/stdout.log similarity index 100% rename from tests/snapshots/add/git_dev/stdout.log rename to tests/testsuite/cargo_add/git_dev/stdout.log diff --git a/tests/snapshots/add/git_inferred_name/in b/tests/testsuite/cargo_add/git_inferred_name/in similarity index 100% rename from tests/snapshots/add/git_inferred_name/in rename to tests/testsuite/cargo_add/git_inferred_name/in diff --git a/tests/testsuite/cargo_add/git_inferred_name/mod.rs b/tests/testsuite/cargo_add/git_inferred_name/mod.rs new file mode 100644 index 00000000000..cb3abd58d55 --- /dev/null +++ b/tests/testsuite/cargo_add/git_inferred_name/mod.rs @@ -0,0 +1,34 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_inferred_name() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["--git", &git_url]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_inferred_name/out/Cargo.toml b/tests/testsuite/cargo_add/git_inferred_name/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_inferred_name/out/Cargo.toml rename to tests/testsuite/cargo_add/git_inferred_name/out/Cargo.toml diff --git a/tests/snapshots/add/git_inferred_name/stderr.log b/tests/testsuite/cargo_add/git_inferred_name/stderr.log similarity index 100% rename from tests/snapshots/add/git_inferred_name/stderr.log rename to tests/testsuite/cargo_add/git_inferred_name/stderr.log diff --git a/tests/snapshots/add/git_inferred_name/stdout.log b/tests/testsuite/cargo_add/git_inferred_name/stdout.log similarity index 100% rename from tests/snapshots/add/git_inferred_name/stdout.log rename to tests/testsuite/cargo_add/git_inferred_name/stdout.log diff --git a/tests/snapshots/add/git_inferred_name_multiple/in b/tests/testsuite/cargo_add/git_inferred_name_multiple/in similarity index 100% rename from tests/snapshots/add/git_inferred_name_multiple/in rename to tests/testsuite/cargo_add/git_inferred_name_multiple/in diff --git a/tests/testsuite/cargo_add/git_inferred_name_multiple/mod.rs b/tests/testsuite/cargo_add/git_inferred_name_multiple/mod.rs new file mode 100644 index 00000000000..7b11367199e --- /dev/null +++ b/tests/testsuite/cargo_add/git_inferred_name_multiple/mod.rs @@ -0,0 +1,39 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_inferred_name_multiple() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("git-package", |project| { + project + .file( + "p1/Cargo.toml", + &cargo_test_support::basic_manifest("my-package1", "0.3.0+my-package1"), + ) + .file("p1/src/lib.rs", "") + .file( + "p2/Cargo.toml", + &cargo_test_support::basic_manifest("my-package2", "0.3.0+my-package2"), + ) + .file("p2/src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["--git", &git_url]) + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_inferred_name_multiple/out/Cargo.toml b/tests/testsuite/cargo_add/git_inferred_name_multiple/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_inferred_name_multiple/out/Cargo.toml rename to tests/testsuite/cargo_add/git_inferred_name_multiple/out/Cargo.toml diff --git a/tests/snapshots/add/git_inferred_name_multiple/stderr.log b/tests/testsuite/cargo_add/git_inferred_name_multiple/stderr.log similarity index 100% rename from tests/snapshots/add/git_inferred_name_multiple/stderr.log rename to tests/testsuite/cargo_add/git_inferred_name_multiple/stderr.log diff --git a/tests/snapshots/add/git_inferred_name_multiple/stdout.log b/tests/testsuite/cargo_add/git_inferred_name_multiple/stdout.log similarity index 100% rename from tests/snapshots/add/git_inferred_name_multiple/stdout.log rename to tests/testsuite/cargo_add/git_inferred_name_multiple/stdout.log diff --git a/tests/snapshots/add/git_multiple_names/in b/tests/testsuite/cargo_add/git_multiple_names/in similarity index 100% rename from tests/snapshots/add/git_multiple_names/in rename to tests/testsuite/cargo_add/git_multiple_names/in diff --git a/tests/testsuite/cargo_add/git_multiple_names/mod.rs b/tests/testsuite/cargo_add/git_multiple_names/mod.rs new file mode 100644 index 00000000000..5875920d4d2 --- /dev/null +++ b/tests/testsuite/cargo_add/git_multiple_names/mod.rs @@ -0,0 +1,39 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_multiple_names() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("git-package", |project| { + project + .file( + "p1/Cargo.toml", + &cargo_test_support::basic_manifest("my-package1", "0.3.0+my-package1"), + ) + .file("p1/src/lib.rs", "") + .file( + "p2/Cargo.toml", + &cargo_test_support::basic_manifest("my-package2", "0.3.0+my-package2"), + ) + .file("p2/src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["my-package1", "my-package2", "--git", &git_url]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_multiple_names/out/Cargo.toml b/tests/testsuite/cargo_add/git_multiple_names/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_multiple_names/out/Cargo.toml rename to tests/testsuite/cargo_add/git_multiple_names/out/Cargo.toml diff --git a/tests/snapshots/add/git_multiple_names/stderr.log b/tests/testsuite/cargo_add/git_multiple_names/stderr.log similarity index 100% rename from tests/snapshots/add/git_multiple_names/stderr.log rename to tests/testsuite/cargo_add/git_multiple_names/stderr.log diff --git a/tests/snapshots/add/git_multiple_names/stdout.log b/tests/testsuite/cargo_add/git_multiple_names/stdout.log similarity index 100% rename from tests/snapshots/add/git_multiple_names/stdout.log rename to tests/testsuite/cargo_add/git_multiple_names/stdout.log diff --git a/tests/snapshots/add/git_normalized_name/in b/tests/testsuite/cargo_add/git_normalized_name/in similarity index 100% rename from tests/snapshots/add/git_normalized_name/in rename to tests/testsuite/cargo_add/git_normalized_name/in diff --git a/tests/testsuite/cargo_add/git_normalized_name/mod.rs b/tests/testsuite/cargo_add/git_normalized_name/mod.rs new file mode 100644 index 00000000000..406d9dbf682 --- /dev/null +++ b/tests/testsuite/cargo_add/git_normalized_name/mod.rs @@ -0,0 +1,34 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_normalized_name() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["git_package", "--git", &git_url]) + .current_dir(cwd) + .assert() + .failure() // Fuzzy searching for paths isn't supported at this time + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_normalized_name/out/Cargo.toml b/tests/testsuite/cargo_add/git_normalized_name/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_normalized_name/out/Cargo.toml rename to tests/testsuite/cargo_add/git_normalized_name/out/Cargo.toml diff --git a/tests/snapshots/add/git_normalized_name/stderr.log b/tests/testsuite/cargo_add/git_normalized_name/stderr.log similarity index 100% rename from tests/snapshots/add/git_normalized_name/stderr.log rename to tests/testsuite/cargo_add/git_normalized_name/stderr.log diff --git a/tests/snapshots/add/git_normalized_name/stdout.log b/tests/testsuite/cargo_add/git_normalized_name/stdout.log similarity index 100% rename from tests/snapshots/add/git_normalized_name/stdout.log rename to tests/testsuite/cargo_add/git_normalized_name/stdout.log diff --git a/tests/snapshots/add/git_registry/in/Cargo.toml b/tests/testsuite/cargo_add/git_registry/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_registry/in/Cargo.toml rename to tests/testsuite/cargo_add/git_registry/in/Cargo.toml diff --git a/tests/snapshots/add/git_registry/in/src/lib.rs b/tests/testsuite/cargo_add/git_registry/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/git_registry/in/src/lib.rs rename to tests/testsuite/cargo_add/git_registry/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/git_registry/mod.rs b/tests/testsuite/cargo_add/git_registry/mod.rs new file mode 100644 index 00000000000..1772deef0bb --- /dev/null +++ b/tests/testsuite/cargo_add/git_registry/mod.rs @@ -0,0 +1,40 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_alt_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_registry() { + init_alt_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("versioned-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("versioned-package", "0.3.0+versioned-package"), + ) + .file("src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args([ + "versioned-package", + "--git", + &git_url, + "--registry", + "alternative", + ]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_registry/out/Cargo.toml b/tests/testsuite/cargo_add/git_registry/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_registry/out/Cargo.toml rename to tests/testsuite/cargo_add/git_registry/out/Cargo.toml diff --git a/tests/snapshots/add/git_registry/stderr.log b/tests/testsuite/cargo_add/git_registry/stderr.log similarity index 100% rename from tests/snapshots/add/git_registry/stderr.log rename to tests/testsuite/cargo_add/git_registry/stderr.log diff --git a/tests/snapshots/add/git_registry/stdout.log b/tests/testsuite/cargo_add/git_registry/stdout.log similarity index 100% rename from tests/snapshots/add/git_registry/stdout.log rename to tests/testsuite/cargo_add/git_registry/stdout.log diff --git a/tests/snapshots/add/git_rev/in b/tests/testsuite/cargo_add/git_rev/in similarity index 100% rename from tests/snapshots/add/git_rev/in rename to tests/testsuite/cargo_add/git_rev/in diff --git a/tests/testsuite/cargo_add/git_rev/mod.rs b/tests/testsuite/cargo_add/git_rev/mod.rs new file mode 100644 index 00000000000..c6b14270848 --- /dev/null +++ b/tests/testsuite/cargo_add/git_rev/mod.rs @@ -0,0 +1,36 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_rev() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let (git_dep, git_repo) = cargo_test_support::git::new_repo("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let find_head = || (git_repo.head().unwrap().peel_to_commit().unwrap()); + let head = find_head().id().to_string(); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["git-package", "--git", &git_url, "--rev", &head]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_rev/out/Cargo.toml b/tests/testsuite/cargo_add/git_rev/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_rev/out/Cargo.toml rename to tests/testsuite/cargo_add/git_rev/out/Cargo.toml diff --git a/tests/snapshots/add/git_rev/stderr.log b/tests/testsuite/cargo_add/git_rev/stderr.log similarity index 100% rename from tests/snapshots/add/git_rev/stderr.log rename to tests/testsuite/cargo_add/git_rev/stderr.log diff --git a/tests/snapshots/add/git_rev/stdout.log b/tests/testsuite/cargo_add/git_rev/stdout.log similarity index 100% rename from tests/snapshots/add/git_rev/stdout.log rename to tests/testsuite/cargo_add/git_rev/stdout.log diff --git a/tests/snapshots/add/git_tag/in b/tests/testsuite/cargo_add/git_tag/in similarity index 100% rename from tests/snapshots/add/git_tag/in rename to tests/testsuite/cargo_add/git_tag/in diff --git a/tests/testsuite/cargo_add/git_tag/mod.rs b/tests/testsuite/cargo_add/git_tag/mod.rs new file mode 100644 index 00000000000..80b7da50c0a --- /dev/null +++ b/tests/testsuite/cargo_add/git_tag/mod.rs @@ -0,0 +1,36 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_tag() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let (git_dep, git_repo) = cargo_test_support::git::new_repo("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let tag = "v1.0.0"; + cargo_test_support::git::tag(&git_repo, tag); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["git-package", "--git", &git_url, "--tag", tag]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/git_tag/out/Cargo.toml b/tests/testsuite/cargo_add/git_tag/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/git_tag/out/Cargo.toml rename to tests/testsuite/cargo_add/git_tag/out/Cargo.toml diff --git a/tests/snapshots/add/git_tag/stderr.log b/tests/testsuite/cargo_add/git_tag/stderr.log similarity index 100% rename from tests/snapshots/add/git_tag/stderr.log rename to tests/testsuite/cargo_add/git_tag/stderr.log diff --git a/tests/snapshots/add/git_tag/stdout.log b/tests/testsuite/cargo_add/git_tag/stdout.log similarity index 100% rename from tests/snapshots/add/git_tag/stdout.log rename to tests/testsuite/cargo_add/git_tag/stdout.log diff --git a/tests/snapshots/add/infer_prerelease/in b/tests/testsuite/cargo_add/infer_prerelease/in similarity index 100% rename from tests/snapshots/add/infer_prerelease/in rename to tests/testsuite/cargo_add/infer_prerelease/in diff --git a/tests/testsuite/cargo_add/infer_prerelease/mod.rs b/tests/testsuite/cargo_add/infer_prerelease/mod.rs new file mode 100644 index 00000000000..b160fa9106d --- /dev/null +++ b/tests/testsuite/cargo_add/infer_prerelease/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn infer_prerelease() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("prerelease_only") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/infer_prerelease/out/Cargo.toml b/tests/testsuite/cargo_add/infer_prerelease/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/infer_prerelease/out/Cargo.toml rename to tests/testsuite/cargo_add/infer_prerelease/out/Cargo.toml diff --git a/tests/snapshots/add/infer_prerelease/stderr.log b/tests/testsuite/cargo_add/infer_prerelease/stderr.log similarity index 100% rename from tests/snapshots/add/infer_prerelease/stderr.log rename to tests/testsuite/cargo_add/infer_prerelease/stderr.log diff --git a/tests/snapshots/add/infer_prerelease/stdout.log b/tests/testsuite/cargo_add/infer_prerelease/stdout.log similarity index 100% rename from tests/snapshots/add/infer_prerelease/stdout.log rename to tests/testsuite/cargo_add/infer_prerelease/stdout.log diff --git a/tests/snapshots/add/invalid_arg/in b/tests/testsuite/cargo_add/invalid_arg/in similarity index 100% rename from tests/snapshots/add/invalid_arg/in rename to tests/testsuite/cargo_add/invalid_arg/in diff --git a/tests/testsuite/cargo_add/invalid_arg/mod.rs b/tests/testsuite/cargo_add/invalid_arg/mod.rs new file mode 100644 index 00000000000..ef68ea43267 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_arg/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_arg() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package --flag") + .current_dir(cwd) + .assert() + .code(1) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_arg/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_arg/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_arg/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_arg/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_arg/stderr.log b/tests/testsuite/cargo_add/invalid_arg/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_arg/stderr.log rename to tests/testsuite/cargo_add/invalid_arg/stderr.log diff --git a/tests/snapshots/add/invalid_arg/stdout.log b/tests/testsuite/cargo_add/invalid_arg/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_arg/stdout.log rename to tests/testsuite/cargo_add/invalid_arg/stdout.log diff --git a/tests/snapshots/add/invalid_git_external/in b/tests/testsuite/cargo_add/invalid_git_external/in similarity index 100% rename from tests/snapshots/add/invalid_git_external/in rename to tests/testsuite/cargo_add/invalid_git_external/in diff --git a/tests/testsuite/cargo_add/invalid_git_external/mod.rs b/tests/testsuite/cargo_add/invalid_git_external/mod.rs new file mode 100644 index 00000000000..ad532becfca --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_git_external/mod.rs @@ -0,0 +1,28 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_git_external() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_url = url::Url::from_directory_path(cwd.join("does-not-exist")) + .unwrap() + .to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["fake-git", "--git", &git_url]) + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_git_external/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_git_external/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_git_external/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_git_external/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_git_external/stderr.log b/tests/testsuite/cargo_add/invalid_git_external/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_git_external/stderr.log rename to tests/testsuite/cargo_add/invalid_git_external/stderr.log diff --git a/tests/snapshots/add/invalid_git_external/stdout.log b/tests/testsuite/cargo_add/invalid_git_external/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_git_external/stdout.log rename to tests/testsuite/cargo_add/invalid_git_external/stdout.log diff --git a/tests/snapshots/add/invalid_git_name/in b/tests/testsuite/cargo_add/invalid_git_name/in similarity index 100% rename from tests/snapshots/add/invalid_git_name/in rename to tests/testsuite/cargo_add/invalid_git_name/in diff --git a/tests/testsuite/cargo_add/invalid_git_name/mod.rs b/tests/testsuite/cargo_add/invalid_git_name/mod.rs new file mode 100644 index 00000000000..077cfc8a0cc --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_git_name/mod.rs @@ -0,0 +1,34 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_git_name() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("git-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("git-package", "0.3.0+git-package"), + ) + .file("src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["not-in-git", "--git", &git_url]) + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_git_name/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_git_name/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_git_name/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_git_name/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_git_name/stderr.log b/tests/testsuite/cargo_add/invalid_git_name/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_git_name/stderr.log rename to tests/testsuite/cargo_add/invalid_git_name/stderr.log diff --git a/tests/snapshots/add/invalid_git_name/stdout.log b/tests/testsuite/cargo_add/invalid_git_name/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_git_name/stdout.log rename to tests/testsuite/cargo_add/invalid_git_name/stdout.log diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/in/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/in/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/in/primary/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/primary/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/in/primary/src/lib.rs b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/invalid_key_inherit_dependency/mod.rs b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/mod.rs new file mode 100644 index 00000000000..e8397873fc1 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_key_inherit_dependency() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "--default-features", "-p", "bar"]) + .current_dir(cwd) + .assert() + .failure() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/out/primary/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/out/primary/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/stderr.log b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/stderr.log rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/stderr.log diff --git a/tests/snapshots/add/invalid_key_inherit_dependency/stdout.log b/tests/testsuite/cargo_add/invalid_key_inherit_dependency/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_key_inherit_dependency/stdout.log rename to tests/testsuite/cargo_add/invalid_key_inherit_dependency/stdout.log diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/primary/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/primary/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/primary/src/lib.rs b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/mod.rs b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/mod.rs new file mode 100644 index 00000000000..e7c36dbb224 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_key_overwrite_inherit_dependency() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "--default-features", "-p", "bar"]) + .current_dir(cwd) + .assert() + .failure() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/out/primary/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/out/primary/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/stderr.log b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/stderr.log rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/stderr.log diff --git a/tests/snapshots/add/invalid_key_overwrite_inherit_dependency/stdout.log b/tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_key_overwrite_inherit_dependency/stdout.log rename to tests/testsuite/cargo_add/invalid_key_overwrite_inherit_dependency/stdout.log diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/in/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/in/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/in/dependency-alt/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/dependency-alt/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/in/dependency-alt/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/dependency-alt/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/in/dependency-alt/src/lib.rs b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/dependency-alt/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/in/dependency-alt/src/lib.rs rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/dependency-alt/src/lib.rs diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/in/primary/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/primary/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/in/primary/src/lib.rs b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/mod.rs b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/mod.rs new file mode 100644 index 00000000000..363b35b8a3e --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_key_rename_inherit_dependency() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["--rename", "foo", "foo-alt", "-p", "bar"]) + .current_dir(cwd) + .assert() + .failure() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/out/dependency-alt/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/out/dependency-alt/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/out/dependency-alt/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/out/dependency-alt/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/out/primary/Cargo.toml b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/out/primary/Cargo.toml diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/stderr.log b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/stderr.log rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/stderr.log diff --git a/tests/snapshots/add/invalid_key_rename_inherit_dependency/stdout.log b/tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_key_rename_inherit_dependency/stdout.log rename to tests/testsuite/cargo_add/invalid_key_rename_inherit_dependency/stdout.log diff --git a/tests/snapshots/add/invalid_manifest/in/Cargo.toml b/tests/testsuite/cargo_add/invalid_manifest/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_manifest/in/Cargo.toml rename to tests/testsuite/cargo_add/invalid_manifest/in/Cargo.toml diff --git a/tests/snapshots/add/invalid_manifest/in/src/lib.rs b/tests/testsuite/cargo_add/invalid_manifest/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_manifest/in/src/lib.rs rename to tests/testsuite/cargo_add/invalid_manifest/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/invalid_manifest/mod.rs b/tests/testsuite/cargo_add/invalid_manifest/mod.rs new file mode 100644 index 00000000000..e55b6d8eed8 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_manifest/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_manifest() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package") + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_manifest/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_manifest/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_manifest/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_manifest/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_manifest/stderr.log b/tests/testsuite/cargo_add/invalid_manifest/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_manifest/stderr.log rename to tests/testsuite/cargo_add/invalid_manifest/stderr.log diff --git a/tests/snapshots/add/invalid_manifest/stdout.log b/tests/testsuite/cargo_add/invalid_manifest/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_manifest/stdout.log rename to tests/testsuite/cargo_add/invalid_manifest/stdout.log diff --git a/tests/snapshots/add/invalid_name_external/in b/tests/testsuite/cargo_add/invalid_name_external/in similarity index 100% rename from tests/snapshots/add/invalid_name_external/in rename to tests/testsuite/cargo_add/invalid_name_external/in diff --git a/tests/testsuite/cargo_add/invalid_name_external/mod.rs b/tests/testsuite/cargo_add/invalid_name_external/mod.rs new file mode 100644 index 00000000000..954307be9c8 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_name_external/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_name_external() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("lets_hope_nobody_ever_publishes_this_crate") + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_name_external/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_name_external/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_name_external/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_name_external/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_name_external/stderr.log b/tests/testsuite/cargo_add/invalid_name_external/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_name_external/stderr.log rename to tests/testsuite/cargo_add/invalid_name_external/stderr.log diff --git a/tests/snapshots/add/invalid_name_external/stdout.log b/tests/testsuite/cargo_add/invalid_name_external/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_name_external/stdout.log rename to tests/testsuite/cargo_add/invalid_name_external/stdout.log diff --git a/tests/snapshots/add/invalid_path/in b/tests/testsuite/cargo_add/invalid_path/in similarity index 100% rename from tests/snapshots/add/invalid_path/in rename to tests/testsuite/cargo_add/invalid_path/in diff --git a/tests/testsuite/cargo_add/invalid_path/mod.rs b/tests/testsuite/cargo_add/invalid_path/mod.rs new file mode 100644 index 00000000000..7eabf20d484 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_path/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_path() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture --path ./tests/fixtures/local") + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_path/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_path/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_path/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_path/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_path/stderr.log b/tests/testsuite/cargo_add/invalid_path/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_path/stderr.log rename to tests/testsuite/cargo_add/invalid_path/stderr.log diff --git a/tests/snapshots/add/invalid_path/stdout.log b/tests/testsuite/cargo_add/invalid_path/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_path/stdout.log rename to tests/testsuite/cargo_add/invalid_path/stdout.log diff --git a/tests/snapshots/add/invalid_path_name/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/invalid_path_name/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_path_name/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/invalid_path_name/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/invalid_path_name/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/invalid_path_name/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_path_name/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/invalid_path_name/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/invalid_path_name/in/primary/Cargo.toml b/tests/testsuite/cargo_add/invalid_path_name/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_path_name/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/invalid_path_name/in/primary/Cargo.toml diff --git a/tests/snapshots/add/invalid_path_name/in/primary/src/lib.rs b/tests/testsuite/cargo_add/invalid_path_name/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/invalid_path_name/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/invalid_path_name/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/invalid_path_name/mod.rs b/tests/testsuite/cargo_add/invalid_path_name/mod.rs new file mode 100644 index 00000000000..63a716b44cd --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_path_name/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_path_name() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("not-at-path --path ../dependency") + .current_dir(&cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_path_name/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/invalid_path_name/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_path_name/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/invalid_path_name/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/invalid_path_name/out/primary/Cargo.toml b/tests/testsuite/cargo_add/invalid_path_name/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_path_name/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/invalid_path_name/out/primary/Cargo.toml diff --git a/tests/snapshots/add/invalid_path_name/stderr.log b/tests/testsuite/cargo_add/invalid_path_name/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_path_name/stderr.log rename to tests/testsuite/cargo_add/invalid_path_name/stderr.log diff --git a/tests/snapshots/add/invalid_path_name/stdout.log b/tests/testsuite/cargo_add/invalid_path_name/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_path_name/stdout.log rename to tests/testsuite/cargo_add/invalid_path_name/stdout.log diff --git a/tests/snapshots/add/invalid_path_self/in b/tests/testsuite/cargo_add/invalid_path_self/in similarity index 100% rename from tests/snapshots/add/invalid_path_self/in rename to tests/testsuite/cargo_add/invalid_path_self/in diff --git a/tests/testsuite/cargo_add/invalid_path_self/mod.rs b/tests/testsuite/cargo_add/invalid_path_self/mod.rs new file mode 100644 index 00000000000..205f6967846 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_path_self/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_path_self() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture --path .") + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_path_self/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_path_self/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_path_self/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_path_self/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_path_self/stderr.log b/tests/testsuite/cargo_add/invalid_path_self/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_path_self/stderr.log rename to tests/testsuite/cargo_add/invalid_path_self/stderr.log diff --git a/tests/snapshots/add/invalid_path_self/stdout.log b/tests/testsuite/cargo_add/invalid_path_self/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_path_self/stdout.log rename to tests/testsuite/cargo_add/invalid_path_self/stdout.log diff --git a/tests/snapshots/add/invalid_target_empty/in b/tests/testsuite/cargo_add/invalid_target_empty/in similarity index 100% rename from tests/snapshots/add/invalid_target_empty/in rename to tests/testsuite/cargo_add/invalid_target_empty/in diff --git a/tests/testsuite/cargo_add/invalid_target_empty/mod.rs b/tests/testsuite/cargo_add/invalid_target_empty/mod.rs new file mode 100644 index 00000000000..0815c7831f3 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_target_empty/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_target_empty() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package --target ''") + .current_dir(cwd) + .assert() + .code(1) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_target_empty/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_target_empty/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_target_empty/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_target_empty/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_target_empty/stderr.log b/tests/testsuite/cargo_add/invalid_target_empty/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_target_empty/stderr.log rename to tests/testsuite/cargo_add/invalid_target_empty/stderr.log diff --git a/tests/snapshots/add/invalid_target_empty/stdout.log b/tests/testsuite/cargo_add/invalid_target_empty/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_target_empty/stdout.log rename to tests/testsuite/cargo_add/invalid_target_empty/stdout.log diff --git a/tests/snapshots/add/invalid_vers/in b/tests/testsuite/cargo_add/invalid_vers/in similarity index 100% rename from tests/snapshots/add/invalid_vers/in rename to tests/testsuite/cargo_add/invalid_vers/in diff --git a/tests/testsuite/cargo_add/invalid_vers/mod.rs b/tests/testsuite/cargo_add/invalid_vers/mod.rs new file mode 100644 index 00000000000..c5231c650b7 --- /dev/null +++ b/tests/testsuite/cargo_add/invalid_vers/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn invalid_vers() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package@invalid-version-string") + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/invalid_vers/out/Cargo.toml b/tests/testsuite/cargo_add/invalid_vers/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/invalid_vers/out/Cargo.toml rename to tests/testsuite/cargo_add/invalid_vers/out/Cargo.toml diff --git a/tests/snapshots/add/invalid_vers/stderr.log b/tests/testsuite/cargo_add/invalid_vers/stderr.log similarity index 100% rename from tests/snapshots/add/invalid_vers/stderr.log rename to tests/testsuite/cargo_add/invalid_vers/stderr.log diff --git a/tests/snapshots/add/invalid_vers/stdout.log b/tests/testsuite/cargo_add/invalid_vers/stdout.log similarity index 100% rename from tests/snapshots/add/invalid_vers/stdout.log rename to tests/testsuite/cargo_add/invalid_vers/stdout.log diff --git a/tests/snapshots/add/list_features/in b/tests/testsuite/cargo_add/list_features/in similarity index 100% rename from tests/snapshots/add/list_features/in rename to tests/testsuite/cargo_add/list_features/in diff --git a/tests/testsuite/cargo_add/list_features/mod.rs b/tests/testsuite/cargo_add/list_features/mod.rs new file mode 100644 index 00000000000..ffa797840c4 --- /dev/null +++ b/tests/testsuite/cargo_add/list_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn list_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["your-face"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/list_features/out/Cargo.toml b/tests/testsuite/cargo_add/list_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features/out/Cargo.toml rename to tests/testsuite/cargo_add/list_features/out/Cargo.toml diff --git a/tests/snapshots/add/list_features/stderr.log b/tests/testsuite/cargo_add/list_features/stderr.log similarity index 100% rename from tests/snapshots/add/list_features/stderr.log rename to tests/testsuite/cargo_add/list_features/stderr.log diff --git a/tests/snapshots/add/list_features/stdout.log b/tests/testsuite/cargo_add/list_features/stdout.log similarity index 100% rename from tests/snapshots/add/list_features/stdout.log rename to tests/testsuite/cargo_add/list_features/stdout.log diff --git a/tests/snapshots/add/list_features_path/in/Cargo.toml b/tests/testsuite/cargo_add/list_features_path/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path/in/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path/in/Cargo.toml diff --git a/tests/snapshots/add/list_features_path/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/list_features_path/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/list_features_path/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/list_features_path/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/list_features_path/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/list_features_path/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/list_features_path/in/optional/Cargo.toml b/tests/testsuite/cargo_add/list_features_path/in/optional/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path/in/optional/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path/in/optional/Cargo.toml diff --git a/tests/snapshots/add/list_features_path/in/optional/src/lib.rs b/tests/testsuite/cargo_add/list_features_path/in/optional/src/lib.rs similarity index 100% rename from tests/snapshots/add/list_features_path/in/optional/src/lib.rs rename to tests/testsuite/cargo_add/list_features_path/in/optional/src/lib.rs diff --git a/tests/snapshots/add/list_features_path/in/primary/Cargo.toml b/tests/testsuite/cargo_add/list_features_path/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path/in/primary/Cargo.toml diff --git a/tests/snapshots/add/list_features_path/in/primary/src/lib.rs b/tests/testsuite/cargo_add/list_features_path/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/list_features_path/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/list_features_path/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/list_features_path/mod.rs b/tests/testsuite/cargo_add/list_features_path/mod.rs new file mode 100644 index 00000000000..82b597fea15 --- /dev/null +++ b/tests/testsuite/cargo_add/list_features_path/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn list_features_path() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --path ../dependency") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/list_features_path/out/Cargo.toml b/tests/testsuite/cargo_add/list_features_path/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path/out/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path/out/Cargo.toml diff --git a/tests/snapshots/add/list_features_path/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/list_features_path/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/list_features_path/out/primary/Cargo.toml b/tests/testsuite/cargo_add/list_features_path/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path/out/primary/Cargo.toml diff --git a/tests/snapshots/add/list_features_path/stderr.log b/tests/testsuite/cargo_add/list_features_path/stderr.log similarity index 100% rename from tests/snapshots/add/list_features_path/stderr.log rename to tests/testsuite/cargo_add/list_features_path/stderr.log diff --git a/tests/snapshots/add/list_features_path/stdout.log b/tests/testsuite/cargo_add/list_features_path/stdout.log similarity index 100% rename from tests/snapshots/add/list_features_path/stdout.log rename to tests/testsuite/cargo_add/list_features_path/stdout.log diff --git a/tests/snapshots/add/list_features_path_no_default/in/Cargo.toml b/tests/testsuite/cargo_add/list_features_path_no_default/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/in/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path_no_default/in/Cargo.toml diff --git a/tests/snapshots/add/list_features_path_no_default/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/list_features_path_no_default/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path_no_default/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/list_features_path_no_default/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/list_features_path_no_default/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/list_features_path_no_default/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/list_features_path_no_default/in/optional/Cargo.toml b/tests/testsuite/cargo_add/list_features_path_no_default/in/optional/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/in/optional/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path_no_default/in/optional/Cargo.toml diff --git a/tests/snapshots/add/list_features_path_no_default/in/optional/src/lib.rs b/tests/testsuite/cargo_add/list_features_path_no_default/in/optional/src/lib.rs similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/in/optional/src/lib.rs rename to tests/testsuite/cargo_add/list_features_path_no_default/in/optional/src/lib.rs diff --git a/tests/snapshots/add/list_features_path_no_default/in/primary/Cargo.toml b/tests/testsuite/cargo_add/list_features_path_no_default/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path_no_default/in/primary/Cargo.toml diff --git a/tests/snapshots/add/list_features_path_no_default/in/primary/src/lib.rs b/tests/testsuite/cargo_add/list_features_path_no_default/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/list_features_path_no_default/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/list_features_path_no_default/mod.rs b/tests/testsuite/cargo_add/list_features_path_no_default/mod.rs new file mode 100644 index 00000000000..4353a20e015 --- /dev/null +++ b/tests/testsuite/cargo_add/list_features_path_no_default/mod.rs @@ -0,0 +1,30 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn list_features_path_no_default() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .args([ + "your-face", + "--path", + "../dependency", + "--no-default-features", + ]) + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/list_features_path_no_default/out/Cargo.toml b/tests/testsuite/cargo_add/list_features_path_no_default/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/out/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path_no_default/out/Cargo.toml diff --git a/tests/snapshots/add/list_features_path_no_default/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/list_features_path_no_default/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path_no_default/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/list_features_path_no_default/out/primary/Cargo.toml b/tests/testsuite/cargo_add/list_features_path_no_default/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/list_features_path_no_default/out/primary/Cargo.toml diff --git a/tests/snapshots/add/list_features_path_no_default/stderr.log b/tests/testsuite/cargo_add/list_features_path_no_default/stderr.log similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/stderr.log rename to tests/testsuite/cargo_add/list_features_path_no_default/stderr.log diff --git a/tests/snapshots/add/list_features_path_no_default/stdout.log b/tests/testsuite/cargo_add/list_features_path_no_default/stdout.log similarity index 100% rename from tests/snapshots/add/list_features_path_no_default/stdout.log rename to tests/testsuite/cargo_add/list_features_path_no_default/stdout.log diff --git a/tests/snapshots/add/manifest_path_package/in/Cargo.toml b/tests/testsuite/cargo_add/manifest_path_package/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/manifest_path_package/in/Cargo.toml rename to tests/testsuite/cargo_add/manifest_path_package/in/Cargo.toml diff --git a/tests/snapshots/add/manifest_path_package/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/manifest_path_package/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/manifest_path_package/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/manifest_path_package/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/manifest_path_package/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/manifest_path_package/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/manifest_path_package/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/manifest_path_package/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/manifest_path_package/in/primary/Cargo.toml b/tests/testsuite/cargo_add/manifest_path_package/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/manifest_path_package/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/manifest_path_package/in/primary/Cargo.toml diff --git a/tests/snapshots/add/manifest_path_package/in/primary/src/lib.rs b/tests/testsuite/cargo_add/manifest_path_package/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/manifest_path_package/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/manifest_path_package/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/manifest_path_package/mod.rs b/tests/testsuite/cargo_add/manifest_path_package/mod.rs new file mode 100644 index 00000000000..2d3f70d2654 --- /dev/null +++ b/tests/testsuite/cargo_add/manifest_path_package/mod.rs @@ -0,0 +1,31 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn manifest_path_package() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .args([ + "--manifest-path", + "Cargo.toml", + "--package", + "cargo-list-test-fixture", + "cargo-list-test-fixture-dependency", + ]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/manifest_path_package/out/Cargo.toml b/tests/testsuite/cargo_add/manifest_path_package/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/manifest_path_package/out/Cargo.toml rename to tests/testsuite/cargo_add/manifest_path_package/out/Cargo.toml diff --git a/tests/snapshots/add/manifest_path_package/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/manifest_path_package/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/manifest_path_package/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/manifest_path_package/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/manifest_path_package/out/primary/Cargo.toml b/tests/testsuite/cargo_add/manifest_path_package/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/manifest_path_package/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/manifest_path_package/out/primary/Cargo.toml diff --git a/tests/snapshots/add/manifest_path_package/stderr.log b/tests/testsuite/cargo_add/manifest_path_package/stderr.log similarity index 100% rename from tests/snapshots/add/manifest_path_package/stderr.log rename to tests/testsuite/cargo_add/manifest_path_package/stderr.log diff --git a/tests/snapshots/add/manifest_path_package/stdout.log b/tests/testsuite/cargo_add/manifest_path_package/stdout.log similarity index 100% rename from tests/snapshots/add/manifest_path_package/stdout.log rename to tests/testsuite/cargo_add/manifest_path_package/stdout.log diff --git a/tests/snapshots/add/merge_activated_features/in/Cargo.toml b/tests/testsuite/cargo_add/merge_activated_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/merge_activated_features/in/Cargo.toml rename to tests/testsuite/cargo_add/merge_activated_features/in/Cargo.toml diff --git a/tests/snapshots/add/merge_activated_features/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/merge_activated_features/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/merge_activated_features/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/merge_activated_features/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/merge_activated_features/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/merge_activated_features/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/merge_activated_features/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/merge_activated_features/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/merge_activated_features/in/primary/Cargo.toml b/tests/testsuite/cargo_add/merge_activated_features/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/merge_activated_features/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/merge_activated_features/in/primary/Cargo.toml diff --git a/tests/snapshots/add/merge_activated_features/in/primary/src/lib.rs b/tests/testsuite/cargo_add/merge_activated_features/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/merge_activated_features/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/merge_activated_features/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/merge_activated_features/mod.rs b/tests/testsuite/cargo_add/merge_activated_features/mod.rs new file mode 100644 index 00000000000..feced4cebd9 --- /dev/null +++ b/tests/testsuite/cargo_add/merge_activated_features/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn merge_activated_features() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "-p", "bar"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/merge_activated_features/out/Cargo.toml b/tests/testsuite/cargo_add/merge_activated_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/merge_activated_features/out/Cargo.toml rename to tests/testsuite/cargo_add/merge_activated_features/out/Cargo.toml diff --git a/tests/snapshots/add/merge_activated_features/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/merge_activated_features/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/merge_activated_features/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/merge_activated_features/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/merge_activated_features/out/primary/Cargo.toml b/tests/testsuite/cargo_add/merge_activated_features/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/merge_activated_features/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/merge_activated_features/out/primary/Cargo.toml diff --git a/tests/snapshots/add/merge_activated_features/stderr.log b/tests/testsuite/cargo_add/merge_activated_features/stderr.log similarity index 100% rename from tests/snapshots/add/merge_activated_features/stderr.log rename to tests/testsuite/cargo_add/merge_activated_features/stderr.log diff --git a/tests/snapshots/add/merge_activated_features/stdout.log b/tests/testsuite/cargo_add/merge_activated_features/stdout.log similarity index 100% rename from tests/snapshots/add/merge_activated_features/stdout.log rename to tests/testsuite/cargo_add/merge_activated_features/stdout.log diff --git a/tests/testsuite/cargo_add/mod.rs b/tests/testsuite/cargo_add/mod.rs new file mode 100644 index 00000000000..0ae817dd4be --- /dev/null +++ b/tests/testsuite/cargo_add/mod.rs @@ -0,0 +1,186 @@ +mod add_basic; +mod add_multiple; +mod add_normalized_name_external; +mod build; +mod build_prefer_existing_version; +mod change_rename_target; +mod default_features; +mod deprecated_default_features; +mod deprecated_section; +mod detect_workspace_inherit; +mod detect_workspace_inherit_features; +mod detect_workspace_inherit_optional; +mod dev; +mod dev_build_conflict; +mod dev_prefer_existing_version; +mod dry_run; +mod features; +mod features_empty; +mod features_multiple_occurrences; +mod features_preserve; +mod features_spaced_values; +mod features_unknown; +mod git; +mod git_branch; +mod git_conflicts_namever; +mod git_dev; +mod git_inferred_name; +mod git_inferred_name_multiple; +mod git_multiple_names; +mod git_normalized_name; +mod git_registry; +mod git_rev; +mod git_tag; +mod infer_prerelease; +mod invalid_arg; +mod invalid_git_external; +mod invalid_git_name; +mod invalid_key_inherit_dependency; +mod invalid_key_overwrite_inherit_dependency; +mod invalid_key_rename_inherit_dependency; +mod invalid_manifest; +mod invalid_name_external; +mod invalid_path; +mod invalid_path_name; +mod invalid_path_self; +mod invalid_target_empty; +mod invalid_vers; +mod list_features; +mod list_features_path; +mod list_features_path_no_default; +mod manifest_path_package; +mod merge_activated_features; +mod multiple_conflicts_with_features; +mod multiple_conflicts_with_rename; +mod namever; +mod no_args; +mod no_default_features; +mod no_optional; +mod optional; +mod overwrite_default_features; +mod overwrite_default_features_with_no_default_features; +mod overwrite_features; +mod overwrite_git_with_path; +mod overwrite_inherit_features_noop; +mod overwrite_inherit_noop; +mod overwrite_inherit_optional_noop; +mod overwrite_inline_features; +mod overwrite_name_dev_noop; +mod overwrite_name_noop; +mod overwrite_no_default_features; +mod overwrite_no_default_features_with_default_features; +mod overwrite_no_optional; +mod overwrite_no_optional_with_optional; +mod overwrite_optional; +mod overwrite_optional_with_no_optional; +mod overwrite_path_noop; +mod overwrite_path_with_version; +mod overwrite_rename_with_no_rename; +mod overwrite_rename_with_rename; +mod overwrite_rename_with_rename_noop; +mod overwrite_version_with_git; +mod overwrite_version_with_path; +mod overwrite_with_rename; +mod overwrite_workspace_dep; +mod overwrite_workspace_dep_features; +mod path; +mod path_dev; +mod path_inferred_name; +mod path_inferred_name_conflicts_full_feature; +mod path_normalized_name; +mod preserve_sorted; +mod preserve_unsorted; +mod quiet; +mod registry; +mod rename; +mod require_weak; +mod target; +mod target_cfg; +mod unknown_inherited_feature; +mod vers; +mod workspace_name; +mod workspace_path; +mod workspace_path_dev; + +fn init_registry() { + cargo_test_support::registry::init(); + add_registry_packages(false); +} + +fn init_alt_registry() { + cargo_test_support::registry::alt_init(); + add_registry_packages(true); +} + +fn add_registry_packages(alt: bool) { + for name in [ + "my-package", + "my-package1", + "my-package2", + "my-dev-package1", + "my-dev-package2", + "my-build-package1", + "my-build-package2", + "toml", + "versioned-package", + "cargo-list-test-fixture-dependency", + "unrelateed-crate", + ] { + cargo_test_support::registry::Package::new(name, "0.1.1+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "0.2.3+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "0.4.1+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "20.0.0+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "99999.0.0+my-package") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new(name, "99999.0.0-alpha.1+my-package") + .alternative(alt) + .publish(); + } + + cargo_test_support::registry::Package::new("prerelease_only", "0.2.0-alpha.1") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new("test_breaking", "0.2.0") + .alternative(alt) + .publish(); + cargo_test_support::registry::Package::new("test_nonbreaking", "0.1.1") + .alternative(alt) + .publish(); + + // Normalization + cargo_test_support::registry::Package::new("linked-hash-map", "0.5.4") + .alternative(alt) + .feature("clippy", &[]) + .feature("heapsize", &[]) + .feature("heapsize_impl", &[]) + .feature("nightly", &[]) + .feature("serde", &[]) + .feature("serde_impl", &[]) + .feature("serde_test", &[]) + .publish(); + cargo_test_support::registry::Package::new("inflector", "0.11.4") + .alternative(alt) + .feature("default", &["heavyweight", "lazy_static", "regex"]) + .feature("heavyweight", &[]) + .feature("lazy_static", &[]) + .feature("regex", &[]) + .feature("unstable", &[]) + .publish(); + + cargo_test_support::registry::Package::new("your-face", "99999.0.0+my-package") + .alternative(alt) + .feature("nose", &[]) + .feature("mouth", &[]) + .feature("eyes", &[]) + .feature("ears", &[]) + .publish(); +} diff --git a/tests/snapshots/add/multiple_conflicts_with_features/in b/tests/testsuite/cargo_add/multiple_conflicts_with_features/in similarity index 100% rename from tests/snapshots/add/multiple_conflicts_with_features/in rename to tests/testsuite/cargo_add/multiple_conflicts_with_features/in diff --git a/tests/testsuite/cargo_add/multiple_conflicts_with_features/mod.rs b/tests/testsuite/cargo_add/multiple_conflicts_with_features/mod.rs new file mode 100644 index 00000000000..acc27025844 --- /dev/null +++ b/tests/testsuite/cargo_add/multiple_conflicts_with_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn multiple_conflicts_with_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 your-face --features nose") + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/multiple_conflicts_with_features/out/Cargo.toml b/tests/testsuite/cargo_add/multiple_conflicts_with_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/multiple_conflicts_with_features/out/Cargo.toml rename to tests/testsuite/cargo_add/multiple_conflicts_with_features/out/Cargo.toml diff --git a/tests/snapshots/add/multiple_conflicts_with_features/stderr.log b/tests/testsuite/cargo_add/multiple_conflicts_with_features/stderr.log similarity index 100% rename from tests/snapshots/add/multiple_conflicts_with_features/stderr.log rename to tests/testsuite/cargo_add/multiple_conflicts_with_features/stderr.log diff --git a/tests/snapshots/add/multiple_conflicts_with_features/stdout.log b/tests/testsuite/cargo_add/multiple_conflicts_with_features/stdout.log similarity index 100% rename from tests/snapshots/add/multiple_conflicts_with_features/stdout.log rename to tests/testsuite/cargo_add/multiple_conflicts_with_features/stdout.log diff --git a/tests/snapshots/add/multiple_conflicts_with_rename/in b/tests/testsuite/cargo_add/multiple_conflicts_with_rename/in similarity index 100% rename from tests/snapshots/add/multiple_conflicts_with_rename/in rename to tests/testsuite/cargo_add/multiple_conflicts_with_rename/in diff --git a/tests/testsuite/cargo_add/multiple_conflicts_with_rename/mod.rs b/tests/testsuite/cargo_add/multiple_conflicts_with_rename/mod.rs new file mode 100644 index 00000000000..009b397f2a5 --- /dev/null +++ b/tests/testsuite/cargo_add/multiple_conflicts_with_rename/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn multiple_conflicts_with_rename() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2 --rename renamed") + .current_dir(cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/multiple_conflicts_with_rename/out/Cargo.toml b/tests/testsuite/cargo_add/multiple_conflicts_with_rename/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/multiple_conflicts_with_rename/out/Cargo.toml rename to tests/testsuite/cargo_add/multiple_conflicts_with_rename/out/Cargo.toml diff --git a/tests/snapshots/add/multiple_conflicts_with_rename/stderr.log b/tests/testsuite/cargo_add/multiple_conflicts_with_rename/stderr.log similarity index 100% rename from tests/snapshots/add/multiple_conflicts_with_rename/stderr.log rename to tests/testsuite/cargo_add/multiple_conflicts_with_rename/stderr.log diff --git a/tests/snapshots/add/multiple_conflicts_with_rename/stdout.log b/tests/testsuite/cargo_add/multiple_conflicts_with_rename/stdout.log similarity index 100% rename from tests/snapshots/add/multiple_conflicts_with_rename/stdout.log rename to tests/testsuite/cargo_add/multiple_conflicts_with_rename/stdout.log diff --git a/tests/snapshots/add/namever/in b/tests/testsuite/cargo_add/namever/in similarity index 100% rename from tests/snapshots/add/namever/in rename to tests/testsuite/cargo_add/namever/in diff --git a/tests/testsuite/cargo_add/namever/mod.rs b/tests/testsuite/cargo_add/namever/mod.rs new file mode 100644 index 00000000000..2c50fcf12c9 --- /dev/null +++ b/tests/testsuite/cargo_add/namever/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn namever() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1@>=0.1.1 my-package2@0.2.3 my-package") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/namever/out/Cargo.toml b/tests/testsuite/cargo_add/namever/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/namever/out/Cargo.toml rename to tests/testsuite/cargo_add/namever/out/Cargo.toml diff --git a/tests/snapshots/add/namever/stderr.log b/tests/testsuite/cargo_add/namever/stderr.log similarity index 100% rename from tests/snapshots/add/namever/stderr.log rename to tests/testsuite/cargo_add/namever/stderr.log diff --git a/tests/snapshots/add/namever/stdout.log b/tests/testsuite/cargo_add/namever/stdout.log similarity index 100% rename from tests/snapshots/add/namever/stdout.log rename to tests/testsuite/cargo_add/namever/stdout.log diff --git a/tests/snapshots/add/no_args/in b/tests/testsuite/cargo_add/no_args/in similarity index 100% rename from tests/snapshots/add/no_args/in rename to tests/testsuite/cargo_add/no_args/in diff --git a/tests/testsuite/cargo_add/no_args/mod.rs b/tests/testsuite/cargo_add/no_args/mod.rs new file mode 100644 index 00000000000..646cb1686dc --- /dev/null +++ b/tests/testsuite/cargo_add/no_args/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn no_args() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .current_dir(cwd) + .assert() + .code(1) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/no_args/out/Cargo.toml b/tests/testsuite/cargo_add/no_args/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/no_args/out/Cargo.toml rename to tests/testsuite/cargo_add/no_args/out/Cargo.toml diff --git a/tests/snapshots/add/no_args/stderr.log b/tests/testsuite/cargo_add/no_args/stderr.log similarity index 100% rename from tests/snapshots/add/no_args/stderr.log rename to tests/testsuite/cargo_add/no_args/stderr.log diff --git a/tests/snapshots/add/no_args/stdout.log b/tests/testsuite/cargo_add/no_args/stdout.log similarity index 100% rename from tests/snapshots/add/no_args/stdout.log rename to tests/testsuite/cargo_add/no_args/stdout.log diff --git a/tests/snapshots/add/no_default_features/in b/tests/testsuite/cargo_add/no_default_features/in similarity index 100% rename from tests/snapshots/add/no_default_features/in rename to tests/testsuite/cargo_add/no_default_features/in diff --git a/tests/testsuite/cargo_add/no_default_features/mod.rs b/tests/testsuite/cargo_add/no_default_features/mod.rs new file mode 100644 index 00000000000..2734d7eebb5 --- /dev/null +++ b/tests/testsuite/cargo_add/no_default_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn no_default_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --no-default-features") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/no_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/no_default_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/no_default_features/out/Cargo.toml rename to tests/testsuite/cargo_add/no_default_features/out/Cargo.toml diff --git a/tests/snapshots/add/no_default_features/stderr.log b/tests/testsuite/cargo_add/no_default_features/stderr.log similarity index 100% rename from tests/snapshots/add/no_default_features/stderr.log rename to tests/testsuite/cargo_add/no_default_features/stderr.log diff --git a/tests/snapshots/add/no_default_features/stdout.log b/tests/testsuite/cargo_add/no_default_features/stdout.log similarity index 100% rename from tests/snapshots/add/no_default_features/stdout.log rename to tests/testsuite/cargo_add/no_default_features/stdout.log diff --git a/tests/snapshots/add/no_optional/in b/tests/testsuite/cargo_add/no_optional/in similarity index 100% rename from tests/snapshots/add/no_optional/in rename to tests/testsuite/cargo_add/no_optional/in diff --git a/tests/testsuite/cargo_add/no_optional/mod.rs b/tests/testsuite/cargo_add/no_optional/mod.rs new file mode 100644 index 00000000000..772f4a35d70 --- /dev/null +++ b/tests/testsuite/cargo_add/no_optional/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn no_optional() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --no-optional") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/no_optional/out/Cargo.toml b/tests/testsuite/cargo_add/no_optional/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/no_optional/out/Cargo.toml rename to tests/testsuite/cargo_add/no_optional/out/Cargo.toml diff --git a/tests/snapshots/add/no_optional/stderr.log b/tests/testsuite/cargo_add/no_optional/stderr.log similarity index 100% rename from tests/snapshots/add/no_optional/stderr.log rename to tests/testsuite/cargo_add/no_optional/stderr.log diff --git a/tests/snapshots/add/no_optional/stdout.log b/tests/testsuite/cargo_add/no_optional/stdout.log similarity index 100% rename from tests/snapshots/add/no_optional/stdout.log rename to tests/testsuite/cargo_add/no_optional/stdout.log diff --git a/tests/snapshots/add/optional/in b/tests/testsuite/cargo_add/optional/in similarity index 100% rename from tests/snapshots/add/optional/in rename to tests/testsuite/cargo_add/optional/in diff --git a/tests/testsuite/cargo_add/optional/mod.rs b/tests/testsuite/cargo_add/optional/mod.rs new file mode 100644 index 00000000000..27d5761f3ea --- /dev/null +++ b/tests/testsuite/cargo_add/optional/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn optional() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --optional") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/optional/out/Cargo.toml b/tests/testsuite/cargo_add/optional/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/optional/out/Cargo.toml rename to tests/testsuite/cargo_add/optional/out/Cargo.toml diff --git a/tests/snapshots/add/optional/stderr.log b/tests/testsuite/cargo_add/optional/stderr.log similarity index 100% rename from tests/snapshots/add/optional/stderr.log rename to tests/testsuite/cargo_add/optional/stderr.log diff --git a/tests/snapshots/add/optional/stdout.log b/tests/testsuite/cargo_add/optional/stdout.log similarity index 100% rename from tests/snapshots/add/optional/stdout.log rename to tests/testsuite/cargo_add/optional/stdout.log diff --git a/tests/snapshots/add/overwrite_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_default_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_default_features/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_default_features/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_default_features/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_default_features/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_default_features/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_default_features/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_default_features/mod.rs b/tests/testsuite/cargo_add/overwrite_default_features/mod.rs new file mode 100644 index 00000000000..c69fef6f795 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_default_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_default_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --default-features") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_default_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_default_features/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_default_features/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_default_features/stderr.log b/tests/testsuite/cargo_add/overwrite_default_features/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_default_features/stderr.log rename to tests/testsuite/cargo_add/overwrite_default_features/stderr.log diff --git a/tests/snapshots/add/overwrite_default_features/stdout.log b/tests/testsuite/cargo_add/overwrite_default_features/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_default_features/stdout.log rename to tests/testsuite/cargo_add/overwrite_default_features/stdout.log diff --git a/tests/snapshots/add/overwrite_default_features_with_no_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_default_features_with_no_default_features/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_default_features_with_no_default_features/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_default_features_with_no_default_features/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/mod.rs b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/mod.rs new file mode 100644 index 00000000000..fc376dc8b26 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_default_features_with_no_default_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --no-default-features") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_default_features_with_no_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_default_features_with_no_default_features/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_default_features_with_no_default_features/stderr.log b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_default_features_with_no_default_features/stderr.log rename to tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/stderr.log diff --git a/tests/snapshots/add/overwrite_default_features_with_no_default_features/stdout.log b/tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_default_features_with_no_default_features/stdout.log rename to tests/testsuite/cargo_add/overwrite_default_features_with_no_default_features/stdout.log diff --git a/tests/snapshots/add/overwrite_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_features/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_features/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_features/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_features/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_features/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_features/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_features/mod.rs b/tests/testsuite/cargo_add/overwrite_features/mod.rs new file mode 100644 index 00000000000..876cf55a6c8 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --features nose") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_features/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_features/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_features/stderr.log b/tests/testsuite/cargo_add/overwrite_features/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_features/stderr.log rename to tests/testsuite/cargo_add/overwrite_features/stderr.log diff --git a/tests/snapshots/add/overwrite_features/stdout.log b/tests/testsuite/cargo_add/overwrite_features/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_features/stdout.log rename to tests/testsuite/cargo_add/overwrite_features/stdout.log diff --git a/tests/snapshots/add/overwrite_git_with_path/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_git_with_path/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_git_with_path/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_git_with_path/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_git_with_path/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_git_with_path/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_git_with_path/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_git_with_path/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_git_with_path/in/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_git_with_path/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_git_with_path/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_git_with_path/in/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_git_with_path/in/primary/src/lib.rs b/tests/testsuite/cargo_add/overwrite_git_with_path/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_git_with_path/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_git_with_path/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_git_with_path/mod.rs b/tests/testsuite/cargo_add/overwrite_git_with_path/mod.rs new file mode 100644 index 00000000000..8a035eb09d7 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_git_with_path/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_git_with_path() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --path ../dependency") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_git_with_path/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_git_with_path/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_git_with_path/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_git_with_path/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_git_with_path/out/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_git_with_path/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_git_with_path/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_git_with_path/out/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_git_with_path/stderr.log b/tests/testsuite/cargo_add/overwrite_git_with_path/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_git_with_path/stderr.log rename to tests/testsuite/cargo_add/overwrite_git_with_path/stderr.log diff --git a/tests/snapshots/add/overwrite_git_with_path/stdout.log b/tests/testsuite/cargo_add/overwrite_git_with_path/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_git_with_path/stdout.log rename to tests/testsuite/cargo_add/overwrite_git_with_path/stdout.log diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/in/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/in/primary/src/lib.rs b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_inherit_features_noop/mod.rs b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/mod.rs new file mode 100644 index 00000000000..ce0b0b6671d --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_inherit_features_noop() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "-p", "bar"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/out/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/out/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/stderr.log b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/stderr.log rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/stderr.log diff --git a/tests/snapshots/add/overwrite_inherit_features_noop/stdout.log b/tests/testsuite/cargo_add/overwrite_inherit_features_noop/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_inherit_features_noop/stdout.log rename to tests/testsuite/cargo_add/overwrite_inherit_features_noop/stdout.log diff --git a/tests/snapshots/add/overwrite_inherit_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_noop/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_noop/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_noop/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_noop/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_noop/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_noop/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_inherit_noop/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_inherit_noop/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_inherit_noop/in/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_noop/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_noop/in/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_noop/in/primary/src/lib.rs b/tests/testsuite/cargo_add/overwrite_inherit_noop/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_inherit_noop/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_inherit_noop/mod.rs b/tests/testsuite/cargo_add/overwrite_inherit_noop/mod.rs new file mode 100644 index 00000000000..88dde1751e3 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_inherit_noop/mod.rs @@ -0,0 +1,26 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_inherit_noop() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "-p", "bar"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_inherit_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_noop/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_noop/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_noop/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_noop/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_noop/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_noop/out/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_noop/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_noop/out/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_noop/stderr.log b/tests/testsuite/cargo_add/overwrite_inherit_noop/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/stderr.log rename to tests/testsuite/cargo_add/overwrite_inherit_noop/stderr.log diff --git a/tests/snapshots/add/overwrite_inherit_noop/stdout.log b/tests/testsuite/cargo_add/overwrite_inherit_noop/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_inherit_noop/stdout.log rename to tests/testsuite/cargo_add/overwrite_inherit_noop/stdout.log diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/in/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/in/primary/src/lib.rs b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/mod.rs b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/mod.rs new file mode 100644 index 00000000000..bac09dc350f --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/mod.rs @@ -0,0 +1,26 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_inherit_optional_noop() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "-p", "bar"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/out/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/out/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/stderr.log b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/stderr.log rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/stderr.log diff --git a/tests/snapshots/add/overwrite_inherit_optional_noop/stdout.log b/tests/testsuite/cargo_add/overwrite_inherit_optional_noop/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_inherit_optional_noop/stdout.log rename to tests/testsuite/cargo_add/overwrite_inherit_optional_noop/stdout.log diff --git a/tests/snapshots/add/overwrite_inline_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inline_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inline_features/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inline_features/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inline_features/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_inline_features/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_inline_features/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_inline_features/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_inline_features/mod.rs b/tests/testsuite/cargo_add/overwrite_inline_features/mod.rs new file mode 100644 index 00000000000..3f7658588b9 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_inline_features/mod.rs @@ -0,0 +1,27 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_inline_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line( + "unrelateed-crate your-face --features your-face/nose,your-face/mouth -Fyour-face/ears", + ) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_inline_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_inline_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_inline_features/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_inline_features/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_inline_features/stderr.log b/tests/testsuite/cargo_add/overwrite_inline_features/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_inline_features/stderr.log rename to tests/testsuite/cargo_add/overwrite_inline_features/stderr.log diff --git a/tests/snapshots/add/overwrite_inline_features/stdout.log b/tests/testsuite/cargo_add/overwrite_inline_features/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_inline_features/stdout.log rename to tests/testsuite/cargo_add/overwrite_inline_features/stdout.log diff --git a/tests/snapshots/add/overwrite_name_dev_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_dev_noop/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_name_dev_noop/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_name_dev_noop/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_name_dev_noop/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_dev_noop/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_name_dev_noop/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_name_dev_noop/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_name_dev_noop/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_name_dev_noop/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_name_dev_noop/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_name_dev_noop/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_name_dev_noop/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_name_dev_noop/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_name_dev_noop/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_name_dev_noop/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_name_dev_noop/mod.rs b/tests/testsuite/cargo_add/overwrite_name_dev_noop/mod.rs new file mode 100644 index 00000000000..4cb5ec8d1bc --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_name_dev_noop/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_alt_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_name_dev_noop() { + init_alt_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --dev") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_name_dev_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_dev_noop/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_name_dev_noop/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_name_dev_noop/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_name_dev_noop/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_dev_noop/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_name_dev_noop/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_name_dev_noop/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_name_dev_noop/stderr.log b/tests/testsuite/cargo_add/overwrite_name_dev_noop/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_name_dev_noop/stderr.log rename to tests/testsuite/cargo_add/overwrite_name_dev_noop/stderr.log diff --git a/tests/snapshots/add/overwrite_name_dev_noop/stdout.log b/tests/testsuite/cargo_add/overwrite_name_dev_noop/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_name_dev_noop/stdout.log rename to tests/testsuite/cargo_add/overwrite_name_dev_noop/stdout.log diff --git a/tests/snapshots/add/overwrite_name_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_noop/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_name_noop/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_name_noop/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_name_noop/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_noop/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_name_noop/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_name_noop/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_name_noop/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_name_noop/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_name_noop/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_name_noop/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_name_noop/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_name_noop/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_name_noop/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_name_noop/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_name_noop/mod.rs b/tests/testsuite/cargo_add/overwrite_name_noop/mod.rs new file mode 100644 index 00000000000..15f2ff75dc8 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_name_noop/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_alt_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_name_noop() { + init_alt_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_name_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_noop/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_name_noop/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_name_noop/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_name_noop/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_name_noop/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_name_noop/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_name_noop/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_name_noop/stderr.log b/tests/testsuite/cargo_add/overwrite_name_noop/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_name_noop/stderr.log rename to tests/testsuite/cargo_add/overwrite_name_noop/stderr.log diff --git a/tests/snapshots/add/overwrite_name_noop/stdout.log b/tests/testsuite/cargo_add/overwrite_name_noop/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_name_noop/stdout.log rename to tests/testsuite/cargo_add/overwrite_name_noop/stdout.log diff --git a/tests/snapshots/add/overwrite_no_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_default_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_no_default_features/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_no_default_features/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_no_default_features/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_no_default_features/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_no_default_features/mod.rs b/tests/testsuite/cargo_add/overwrite_no_default_features/mod.rs new file mode 100644 index 00000000000..c193f74517d --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_no_default_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_no_default_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --no-default-features") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_no_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_default_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_no_default_features/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_no_default_features/stderr.log b/tests/testsuite/cargo_add/overwrite_no_default_features/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features/stderr.log rename to tests/testsuite/cargo_add/overwrite_no_default_features/stderr.log diff --git a/tests/snapshots/add/overwrite_no_default_features/stdout.log b/tests/testsuite/cargo_add/overwrite_no_default_features/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features/stdout.log rename to tests/testsuite/cargo_add/overwrite_no_default_features/stdout.log diff --git a/tests/snapshots/add/overwrite_no_default_features_with_default_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features_with_default_features/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_no_default_features_with_default_features/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features_with_default_features/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/mod.rs b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/mod.rs new file mode 100644 index 00000000000..53ac233c64d --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_no_default_features_with_default_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --default-features") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_no_default_features_with_default_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features_with_default_features/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_no_default_features_with_default_features/stderr.log b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features_with_default_features/stderr.log rename to tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/stderr.log diff --git a/tests/snapshots/add/overwrite_no_default_features_with_default_features/stdout.log b/tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_no_default_features_with_default_features/stdout.log rename to tests/testsuite/cargo_add/overwrite_no_default_features_with_default_features/stdout.log diff --git a/tests/snapshots/add/overwrite_no_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_optional/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_no_optional/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_no_optional/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_no_optional/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_no_optional/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_no_optional/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_no_optional/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_no_optional/mod.rs b/tests/testsuite/cargo_add/overwrite_no_optional/mod.rs new file mode 100644 index 00000000000..38f9dbf031e --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_no_optional/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_no_optional() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --no-optional") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_no_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_optional/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_no_optional/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_no_optional/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_no_optional/stderr.log b/tests/testsuite/cargo_add/overwrite_no_optional/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_no_optional/stderr.log rename to tests/testsuite/cargo_add/overwrite_no_optional/stderr.log diff --git a/tests/snapshots/add/overwrite_no_optional/stdout.log b/tests/testsuite/cargo_add/overwrite_no_optional/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_no_optional/stdout.log rename to tests/testsuite/cargo_add/overwrite_no_optional/stdout.log diff --git a/tests/snapshots/add/overwrite_no_optional_with_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_no_optional_with_optional/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_no_optional_with_optional/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_no_optional_with_optional/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_no_optional_with_optional/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_no_optional_with_optional/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/mod.rs b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/mod.rs new file mode 100644 index 00000000000..68cbe018a1c --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_no_optional_with_optional() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --optional") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_no_optional_with_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_no_optional_with_optional/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_no_optional_with_optional/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_no_optional_with_optional/stderr.log b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_no_optional_with_optional/stderr.log rename to tests/testsuite/cargo_add/overwrite_no_optional_with_optional/stderr.log diff --git a/tests/snapshots/add/overwrite_no_optional_with_optional/stdout.log b/tests/testsuite/cargo_add/overwrite_no_optional_with_optional/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_no_optional_with_optional/stdout.log rename to tests/testsuite/cargo_add/overwrite_no_optional_with_optional/stdout.log diff --git a/tests/snapshots/add/overwrite_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_optional/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_optional/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_optional/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_optional/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_optional/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_optional/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_optional/mod.rs b/tests/testsuite/cargo_add/overwrite_optional/mod.rs new file mode 100644 index 00000000000..fc2e766eb1c --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_optional/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_optional() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --optional") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_optional/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_optional/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_optional/stderr.log b/tests/testsuite/cargo_add/overwrite_optional/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_optional/stderr.log rename to tests/testsuite/cargo_add/overwrite_optional/stderr.log diff --git a/tests/snapshots/add/overwrite_optional/stdout.log b/tests/testsuite/cargo_add/overwrite_optional/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_optional/stdout.log rename to tests/testsuite/cargo_add/overwrite_optional/stdout.log diff --git a/tests/snapshots/add/overwrite_optional_with_no_optional/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_optional_with_no_optional/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_optional_with_no_optional/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_optional_with_no_optional/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_optional_with_no_optional/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_optional_with_no_optional/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/mod.rs b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/mod.rs new file mode 100644 index 00000000000..88a949887d4 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_optional_with_no_optional() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2@0.4.1 --no-optional") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_optional_with_no_optional/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_optional_with_no_optional/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_optional_with_no_optional/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_optional_with_no_optional/stderr.log b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_optional_with_no_optional/stderr.log rename to tests/testsuite/cargo_add/overwrite_optional_with_no_optional/stderr.log diff --git a/tests/snapshots/add/overwrite_optional_with_no_optional/stdout.log b/tests/testsuite/cargo_add/overwrite_optional_with_no_optional/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_optional_with_no_optional/stdout.log rename to tests/testsuite/cargo_add/overwrite_optional_with_no_optional/stdout.log diff --git a/tests/snapshots/add/overwrite_path_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_noop/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_path_noop/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_path_noop/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_path_noop/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_noop/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_path_noop/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_path_noop/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_path_noop/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_path_noop/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_path_noop/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_path_noop/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_path_noop/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_path_noop/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_path_noop/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_path_noop/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_path_noop/mod.rs b/tests/testsuite/cargo_add/overwrite_path_noop/mod.rs new file mode 100644 index 00000000000..838a234ecd2 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_path_noop/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_alt_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_path_noop() { + init_alt_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --path ./dependency") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_path_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_noop/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_path_noop/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_path_noop/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_path_noop/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_noop/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_path_noop/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_path_noop/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_path_noop/stderr.log b/tests/testsuite/cargo_add/overwrite_path_noop/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_path_noop/stderr.log rename to tests/testsuite/cargo_add/overwrite_path_noop/stderr.log diff --git a/tests/snapshots/add/overwrite_path_noop/stdout.log b/tests/testsuite/cargo_add/overwrite_path_noop/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_path_noop/stdout.log rename to tests/testsuite/cargo_add/overwrite_path_noop/stdout.log diff --git a/tests/snapshots/add/overwrite_path_with_version/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_with_version/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_path_with_version/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_path_with_version/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_path_with_version/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_path_with_version/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_path_with_version/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_path_with_version/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_path_with_version/in/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_with_version/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_path_with_version/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_path_with_version/in/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_path_with_version/in/primary/src/lib.rs b/tests/testsuite/cargo_add/overwrite_path_with_version/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_path_with_version/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_path_with_version/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_path_with_version/mod.rs b/tests/testsuite/cargo_add/overwrite_path_with_version/mod.rs new file mode 100644 index 00000000000..adb1e249826 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_path_with_version/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_path_with_version() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency@20.0") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_path_with_version/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_with_version/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_path_with_version/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_path_with_version/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_path_with_version/out/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_path_with_version/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_path_with_version/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_path_with_version/out/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_path_with_version/stderr.log b/tests/testsuite/cargo_add/overwrite_path_with_version/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_path_with_version/stderr.log rename to tests/testsuite/cargo_add/overwrite_path_with_version/stderr.log diff --git a/tests/snapshots/add/overwrite_path_with_version/stdout.log b/tests/testsuite/cargo_add/overwrite_path_with_version/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_path_with_version/stdout.log rename to tests/testsuite/cargo_add/overwrite_path_with_version/stdout.log diff --git a/tests/snapshots/add/overwrite_rename_with_no_rename/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_no_rename/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_rename_with_no_rename/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_rename_with_no_rename/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_no_rename/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_rename_with_no_rename/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/mod.rs b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/mod.rs new file mode 100644 index 00000000000..01fe1571f69 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_rename_with_no_rename() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("versioned-package") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_rename_with_no_rename/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_no_rename/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_rename_with_no_rename/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_rename_with_no_rename/stderr.log b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_no_rename/stderr.log rename to tests/testsuite/cargo_add/overwrite_rename_with_no_rename/stderr.log diff --git a/tests/snapshots/add/overwrite_rename_with_no_rename/stdout.log b/tests/testsuite/cargo_add/overwrite_rename_with_no_rename/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_no_rename/stdout.log rename to tests/testsuite/cargo_add/overwrite_rename_with_no_rename/stdout.log diff --git a/tests/snapshots/add/overwrite_rename_with_rename/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_rename/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_rename_with_rename/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_rename_with_rename/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_rename_with_rename/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_rename_with_rename/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_rename/mod.rs b/tests/testsuite/cargo_add/overwrite_rename_with_rename/mod.rs new file mode 100644 index 00000000000..9a43006ba24 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_rename_with_rename/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_rename_with_rename() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("versioned-package --rename a2") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_rename_with_rename/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_rename/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_rename_with_rename/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_rename_with_rename/stderr.log b/tests/testsuite/cargo_add/overwrite_rename_with_rename/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename/stderr.log rename to tests/testsuite/cargo_add/overwrite_rename_with_rename/stderr.log diff --git a/tests/snapshots/add/overwrite_rename_with_rename/stdout.log b/tests/testsuite/cargo_add/overwrite_rename_with_rename/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename/stdout.log rename to tests/testsuite/cargo_add/overwrite_rename_with_rename/stdout.log diff --git a/tests/snapshots/add/overwrite_rename_with_rename_noop/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename_noop/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_rename_with_rename_noop/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename_noop/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/mod.rs b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/mod.rs new file mode 100644 index 00000000000..47f4724358c --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_rename_with_rename_noop() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("versioned-package --rename a1") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_rename_with_rename_noop/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename_noop/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_rename_with_rename_noop/stderr.log b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename_noop/stderr.log rename to tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/stderr.log diff --git a/tests/snapshots/add/overwrite_rename_with_rename_noop/stdout.log b/tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_rename_with_rename_noop/stdout.log rename to tests/testsuite/cargo_add/overwrite_rename_with_rename_noop/stdout.log diff --git a/tests/snapshots/add/overwrite_version_with_git/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_version_with_git/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_version_with_git/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_version_with_git/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_version_with_git/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_version_with_git/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_version_with_git/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_version_with_git/mod.rs b/tests/testsuite/cargo_add/overwrite_version_with_git/mod.rs new file mode 100644 index 00000000000..8ce161a6b86 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_version_with_git/mod.rs @@ -0,0 +1,34 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_version_with_git() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + let git_dep = cargo_test_support::git::new("versioned-package", |project| { + project + .file( + "Cargo.toml", + &cargo_test_support::basic_manifest("versioned-package", "0.3.0+versioned-package"), + ) + .file("src/lib.rs", "") + }); + let git_url = git_dep.url().to_string(); + + snapbox::cmd::Command::cargo() + .arg("add") + .args(["versioned-package", "--git", &git_url]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_version_with_git/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_version_with_git/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_version_with_git/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_version_with_git/stderr.log b/tests/testsuite/cargo_add/overwrite_version_with_git/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_version_with_git/stderr.log rename to tests/testsuite/cargo_add/overwrite_version_with_git/stderr.log diff --git a/tests/snapshots/add/overwrite_version_with_git/stdout.log b/tests/testsuite/cargo_add/overwrite_version_with_git/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_version_with_git/stdout.log rename to tests/testsuite/cargo_add/overwrite_version_with_git/stdout.log diff --git a/tests/snapshots/add/overwrite_version_with_path/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_version_with_path/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_version_with_path/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_version_with_path/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_version_with_path/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_version_with_path/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_version_with_path/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_version_with_path/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_version_with_path/in/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_version_with_path/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_version_with_path/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_version_with_path/in/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_version_with_path/in/primary/src/lib.rs b/tests/testsuite/cargo_add/overwrite_version_with_path/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_version_with_path/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_version_with_path/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_version_with_path/mod.rs b/tests/testsuite/cargo_add/overwrite_version_with_path/mod.rs new file mode 100644 index 00000000000..d2ec8f9b8f8 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_version_with_path/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_version_with_path() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --path ../dependency") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_version_with_path/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_version_with_path/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_version_with_path/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_version_with_path/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_version_with_path/out/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_version_with_path/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_version_with_path/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_version_with_path/out/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_version_with_path/stderr.log b/tests/testsuite/cargo_add/overwrite_version_with_path/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_version_with_path/stderr.log rename to tests/testsuite/cargo_add/overwrite_version_with_path/stderr.log diff --git a/tests/snapshots/add/overwrite_version_with_path/stdout.log b/tests/testsuite/cargo_add/overwrite_version_with_path/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_version_with_path/stdout.log rename to tests/testsuite/cargo_add/overwrite_version_with_path/stdout.log diff --git a/tests/snapshots/add/overwrite_with_rename/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_with_rename/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_with_rename/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_with_rename/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_with_rename/in/src/lib.rs b/tests/testsuite/cargo_add/overwrite_with_rename/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_with_rename/in/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_with_rename/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_with_rename/mod.rs b/tests/testsuite/cargo_add/overwrite_with_rename/mod.rs new file mode 100644 index 00000000000..27f53c0eac8 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_with_rename/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_with_rename() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("versioned-package --rename renamed") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_with_rename/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_with_rename/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_with_rename/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_with_rename/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_with_rename/stderr.log b/tests/testsuite/cargo_add/overwrite_with_rename/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_with_rename/stderr.log rename to tests/testsuite/cargo_add/overwrite_with_rename/stderr.log diff --git a/tests/snapshots/add/overwrite_with_rename/stdout.log b/tests/testsuite/cargo_add/overwrite_with_rename/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_with_rename/stdout.log rename to tests/testsuite/cargo_add/overwrite_with_rename/stdout.log diff --git a/tests/snapshots/add/overwrite_workspace_dep/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_workspace_dep/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_workspace_dep/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_workspace_dep/in/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep/in/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep/in/primary/src/lib.rs b/tests/testsuite/cargo_add/overwrite_workspace_dep/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_workspace_dep/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_workspace_dep/mod.rs b/tests/testsuite/cargo_add/overwrite_workspace_dep/mod.rs new file mode 100644 index 00000000000..600de8d8fe5 --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_workspace_dep/mod.rs @@ -0,0 +1,26 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_workspace_dep() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "--path", "./dependency", "-p", "bar"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_workspace_dep/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep/out/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep/out/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep/stderr.log b/tests/testsuite/cargo_add/overwrite_workspace_dep/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/stderr.log rename to tests/testsuite/cargo_add/overwrite_workspace_dep/stderr.log diff --git a/tests/snapshots/add/overwrite_workspace_dep/stdout.log b/tests/testsuite/cargo_add/overwrite_workspace_dep/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep/stdout.log rename to tests/testsuite/cargo_add/overwrite_workspace_dep/stdout.log diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/in/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/in/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/in/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/in/primary/src/lib.rs b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/overwrite_workspace_dep_features/mod.rs b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/mod.rs new file mode 100644 index 00000000000..be8394d90cc --- /dev/null +++ b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/mod.rs @@ -0,0 +1,26 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn overwrite_workspace_dep_features() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "--path", "./dependency", "-p", "bar"]) + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/out/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/out/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/out/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/out/primary/Cargo.toml b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/out/primary/Cargo.toml diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/stderr.log b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/stderr.log similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/stderr.log rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/stderr.log diff --git a/tests/snapshots/add/overwrite_workspace_dep_features/stdout.log b/tests/testsuite/cargo_add/overwrite_workspace_dep_features/stdout.log similarity index 100% rename from tests/snapshots/add/overwrite_workspace_dep_features/stdout.log rename to tests/testsuite/cargo_add/overwrite_workspace_dep_features/stdout.log diff --git a/tests/snapshots/add/path/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/path/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/path/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/path/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/path/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/path/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/path/in/primary/Cargo.toml b/tests/testsuite/cargo_add/path/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/path/in/primary/Cargo.toml diff --git a/tests/snapshots/add/path/in/primary/src/lib.rs b/tests/testsuite/cargo_add/path/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/path/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/path/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/path/mod.rs b/tests/testsuite/cargo_add/path/mod.rs new file mode 100644 index 00000000000..860ee99ddfe --- /dev/null +++ b/tests/testsuite/cargo_add/path/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn path() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --path ../dependency") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/path/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/path/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/path/out/primary/Cargo.toml b/tests/testsuite/cargo_add/path/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/path/out/primary/Cargo.toml diff --git a/tests/snapshots/add/path/stderr.log b/tests/testsuite/cargo_add/path/stderr.log similarity index 100% rename from tests/snapshots/add/path/stderr.log rename to tests/testsuite/cargo_add/path/stderr.log diff --git a/tests/snapshots/add/path/stdout.log b/tests/testsuite/cargo_add/path/stdout.log similarity index 100% rename from tests/snapshots/add/path/stdout.log rename to tests/testsuite/cargo_add/path/stdout.log diff --git a/tests/snapshots/add/path_dev/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/path_dev/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_dev/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path_dev/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/path_dev/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/path_dev/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_dev/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/path_dev/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/path_dev/in/primary/Cargo.toml b/tests/testsuite/cargo_add/path_dev/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_dev/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/path_dev/in/primary/Cargo.toml diff --git a/tests/snapshots/add/path_dev/in/primary/src/lib.rs b/tests/testsuite/cargo_add/path_dev/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_dev/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/path_dev/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/path_dev/mod.rs b/tests/testsuite/cargo_add/path_dev/mod.rs new file mode 100644 index 00000000000..d66614517d7 --- /dev/null +++ b/tests/testsuite/cargo_add/path_dev/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn path_dev() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --path ../dependency --dev") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/path_dev/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/path_dev/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_dev/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path_dev/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/path_dev/out/primary/Cargo.toml b/tests/testsuite/cargo_add/path_dev/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_dev/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/path_dev/out/primary/Cargo.toml diff --git a/tests/snapshots/add/path_dev/stderr.log b/tests/testsuite/cargo_add/path_dev/stderr.log similarity index 100% rename from tests/snapshots/add/path_dev/stderr.log rename to tests/testsuite/cargo_add/path_dev/stderr.log diff --git a/tests/snapshots/add/path_dev/stdout.log b/tests/testsuite/cargo_add/path_dev/stdout.log similarity index 100% rename from tests/snapshots/add/path_dev/stdout.log rename to tests/testsuite/cargo_add/path_dev/stdout.log diff --git a/tests/snapshots/add/path_inferred_name/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/path_inferred_name/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_inferred_name/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/path_inferred_name/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/path_inferred_name/in/primary/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name/in/primary/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name/in/primary/src/lib.rs b/tests/testsuite/cargo_add/path_inferred_name/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_inferred_name/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/path_inferred_name/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/path_inferred_name/mod.rs b/tests/testsuite/cargo_add/path_inferred_name/mod.rs new file mode 100644 index 00000000000..ba90cf9d640 --- /dev/null +++ b/tests/testsuite/cargo_add/path_inferred_name/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn path_inferred_name() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --path ../dependency") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/path_inferred_name/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name/out/primary/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name/out/primary/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name/stderr.log b/tests/testsuite/cargo_add/path_inferred_name/stderr.log similarity index 100% rename from tests/snapshots/add/path_inferred_name/stderr.log rename to tests/testsuite/cargo_add/path_inferred_name/stderr.log diff --git a/tests/snapshots/add/path_inferred_name/stdout.log b/tests/testsuite/cargo_add/path_inferred_name/stdout.log similarity index 100% rename from tests/snapshots/add/path_inferred_name/stdout.log rename to tests/testsuite/cargo_add/path_inferred_name/stdout.log diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/optional/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/optional/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/optional/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/optional/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/optional/src/lib.rs b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/optional/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/optional/src/lib.rs rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/optional/src/lib.rs diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/primary/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/primary/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/primary/src/lib.rs b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/mod.rs b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/mod.rs new file mode 100644 index 00000000000..d34387c2009 --- /dev/null +++ b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn path_inferred_name_conflicts_full_feature() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("--path ../dependency --features your-face/nose") + .current_dir(&cwd) + .assert() + .code(101) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/out/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/out/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/out/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/out/primary/Cargo.toml b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/out/primary/Cargo.toml diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/stderr.log b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/stderr.log similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/stderr.log rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/stderr.log diff --git a/tests/snapshots/add/path_inferred_name_conflicts_full_feature/stdout.log b/tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/stdout.log similarity index 100% rename from tests/snapshots/add/path_inferred_name_conflicts_full_feature/stdout.log rename to tests/testsuite/cargo_add/path_inferred_name_conflicts_full_feature/stdout.log diff --git a/tests/snapshots/add/path_normalized_name/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/path_normalized_name/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_normalized_name/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path_normalized_name/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/path_normalized_name/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/path_normalized_name/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_normalized_name/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/path_normalized_name/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/path_normalized_name/in/primary/Cargo.toml b/tests/testsuite/cargo_add/path_normalized_name/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_normalized_name/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/path_normalized_name/in/primary/Cargo.toml diff --git a/tests/snapshots/add/path_normalized_name/in/primary/src/lib.rs b/tests/testsuite/cargo_add/path_normalized_name/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/path_normalized_name/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/path_normalized_name/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/path_normalized_name/mod.rs b/tests/testsuite/cargo_add/path_normalized_name/mod.rs new file mode 100644 index 00000000000..6e4972d198e --- /dev/null +++ b/tests/testsuite/cargo_add/path_normalized_name/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn path_normalized_name() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo_list_test_fixture_dependency --path ../dependency") + .current_dir(&cwd) + .assert() + .failure() // Fuzzy searching for paths isn't supported at this time + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/path_normalized_name/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/path_normalized_name/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_normalized_name/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/path_normalized_name/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/path_normalized_name/out/primary/Cargo.toml b/tests/testsuite/cargo_add/path_normalized_name/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/path_normalized_name/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/path_normalized_name/out/primary/Cargo.toml diff --git a/tests/snapshots/add/path_normalized_name/stderr.log b/tests/testsuite/cargo_add/path_normalized_name/stderr.log similarity index 100% rename from tests/snapshots/add/path_normalized_name/stderr.log rename to tests/testsuite/cargo_add/path_normalized_name/stderr.log diff --git a/tests/snapshots/add/path_normalized_name/stdout.log b/tests/testsuite/cargo_add/path_normalized_name/stdout.log similarity index 100% rename from tests/snapshots/add/path_normalized_name/stdout.log rename to tests/testsuite/cargo_add/path_normalized_name/stdout.log diff --git a/tests/snapshots/add/preserve_sorted/in/Cargo.toml b/tests/testsuite/cargo_add/preserve_sorted/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/preserve_sorted/in/Cargo.toml rename to tests/testsuite/cargo_add/preserve_sorted/in/Cargo.toml diff --git a/tests/snapshots/add/preserve_sorted/in/src/lib.rs b/tests/testsuite/cargo_add/preserve_sorted/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/preserve_sorted/in/src/lib.rs rename to tests/testsuite/cargo_add/preserve_sorted/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/preserve_sorted/mod.rs b/tests/testsuite/cargo_add/preserve_sorted/mod.rs new file mode 100644 index 00000000000..0d5e38bf4c9 --- /dev/null +++ b/tests/testsuite/cargo_add/preserve_sorted/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn preserve_sorted() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("toml") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/preserve_sorted/out/Cargo.toml b/tests/testsuite/cargo_add/preserve_sorted/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/preserve_sorted/out/Cargo.toml rename to tests/testsuite/cargo_add/preserve_sorted/out/Cargo.toml diff --git a/tests/snapshots/add/preserve_sorted/stderr.log b/tests/testsuite/cargo_add/preserve_sorted/stderr.log similarity index 100% rename from tests/snapshots/add/preserve_sorted/stderr.log rename to tests/testsuite/cargo_add/preserve_sorted/stderr.log diff --git a/tests/snapshots/add/preserve_sorted/stdout.log b/tests/testsuite/cargo_add/preserve_sorted/stdout.log similarity index 100% rename from tests/snapshots/add/preserve_sorted/stdout.log rename to tests/testsuite/cargo_add/preserve_sorted/stdout.log diff --git a/tests/snapshots/add/preserve_unsorted/in/Cargo.toml b/tests/testsuite/cargo_add/preserve_unsorted/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/preserve_unsorted/in/Cargo.toml rename to tests/testsuite/cargo_add/preserve_unsorted/in/Cargo.toml diff --git a/tests/snapshots/add/preserve_unsorted/in/src/lib.rs b/tests/testsuite/cargo_add/preserve_unsorted/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/preserve_unsorted/in/src/lib.rs rename to tests/testsuite/cargo_add/preserve_unsorted/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/preserve_unsorted/mod.rs b/tests/testsuite/cargo_add/preserve_unsorted/mod.rs new file mode 100644 index 00000000000..d414c0f2455 --- /dev/null +++ b/tests/testsuite/cargo_add/preserve_unsorted/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn preserve_unsorted() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("toml") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/preserve_unsorted/out/Cargo.toml b/tests/testsuite/cargo_add/preserve_unsorted/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/preserve_unsorted/out/Cargo.toml rename to tests/testsuite/cargo_add/preserve_unsorted/out/Cargo.toml diff --git a/tests/snapshots/add/preserve_unsorted/stderr.log b/tests/testsuite/cargo_add/preserve_unsorted/stderr.log similarity index 100% rename from tests/snapshots/add/preserve_unsorted/stderr.log rename to tests/testsuite/cargo_add/preserve_unsorted/stderr.log diff --git a/tests/snapshots/add/preserve_unsorted/stdout.log b/tests/testsuite/cargo_add/preserve_unsorted/stdout.log similarity index 100% rename from tests/snapshots/add/preserve_unsorted/stdout.log rename to tests/testsuite/cargo_add/preserve_unsorted/stdout.log diff --git a/tests/snapshots/add/quiet/in b/tests/testsuite/cargo_add/quiet/in similarity index 100% rename from tests/snapshots/add/quiet/in rename to tests/testsuite/cargo_add/quiet/in diff --git a/tests/testsuite/cargo_add/quiet/mod.rs b/tests/testsuite/cargo_add/quiet/mod.rs new file mode 100644 index 00000000000..e528f450694 --- /dev/null +++ b/tests/testsuite/cargo_add/quiet/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn quiet() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("--quiet your-face") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/quiet/out/Cargo.toml b/tests/testsuite/cargo_add/quiet/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/quiet/out/Cargo.toml rename to tests/testsuite/cargo_add/quiet/out/Cargo.toml diff --git a/tests/snapshots/add/quiet/stderr.log b/tests/testsuite/cargo_add/quiet/stderr.log similarity index 100% rename from tests/snapshots/add/quiet/stderr.log rename to tests/testsuite/cargo_add/quiet/stderr.log diff --git a/tests/snapshots/add/quiet/stdout.log b/tests/testsuite/cargo_add/quiet/stdout.log similarity index 100% rename from tests/snapshots/add/quiet/stdout.log rename to tests/testsuite/cargo_add/quiet/stdout.log diff --git a/tests/snapshots/add/registry/in/Cargo.toml b/tests/testsuite/cargo_add/registry/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/registry/in/Cargo.toml rename to tests/testsuite/cargo_add/registry/in/Cargo.toml diff --git a/tests/snapshots/add/registry/in/src/lib.rs b/tests/testsuite/cargo_add/registry/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/registry/in/src/lib.rs rename to tests/testsuite/cargo_add/registry/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/registry/mod.rs b/tests/testsuite/cargo_add/registry/mod.rs new file mode 100644 index 00000000000..5f71beca826 --- /dev/null +++ b/tests/testsuite/cargo_add/registry/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_alt_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn registry() { + init_alt_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2 --registry alternative") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/registry/out/Cargo.toml b/tests/testsuite/cargo_add/registry/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/registry/out/Cargo.toml rename to tests/testsuite/cargo_add/registry/out/Cargo.toml diff --git a/tests/snapshots/add/registry/stderr.log b/tests/testsuite/cargo_add/registry/stderr.log similarity index 100% rename from tests/snapshots/add/registry/stderr.log rename to tests/testsuite/cargo_add/registry/stderr.log diff --git a/tests/snapshots/add/registry/stdout.log b/tests/testsuite/cargo_add/registry/stdout.log similarity index 100% rename from tests/snapshots/add/registry/stdout.log rename to tests/testsuite/cargo_add/registry/stdout.log diff --git a/tests/snapshots/add/rename/in b/tests/testsuite/cargo_add/rename/in similarity index 100% rename from tests/snapshots/add/rename/in rename to tests/testsuite/cargo_add/rename/in diff --git a/tests/testsuite/cargo_add/rename/mod.rs b/tests/testsuite/cargo_add/rename/mod.rs new file mode 100644 index 00000000000..89bf4f5aac0 --- /dev/null +++ b/tests/testsuite/cargo_add/rename/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn rename() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package --rename renamed") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/rename/out/Cargo.toml b/tests/testsuite/cargo_add/rename/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/rename/out/Cargo.toml rename to tests/testsuite/cargo_add/rename/out/Cargo.toml diff --git a/tests/snapshots/add/rename/stderr.log b/tests/testsuite/cargo_add/rename/stderr.log similarity index 100% rename from tests/snapshots/add/rename/stderr.log rename to tests/testsuite/cargo_add/rename/stderr.log diff --git a/tests/snapshots/add/rename/stdout.log b/tests/testsuite/cargo_add/rename/stdout.log similarity index 100% rename from tests/snapshots/add/rename/stdout.log rename to tests/testsuite/cargo_add/rename/stdout.log diff --git a/tests/snapshots/add/require_weak/in/Cargo.toml b/tests/testsuite/cargo_add/require_weak/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/require_weak/in/Cargo.toml rename to tests/testsuite/cargo_add/require_weak/in/Cargo.toml diff --git a/tests/snapshots/add/require_weak/in/src/lib.rs b/tests/testsuite/cargo_add/require_weak/in/src/lib.rs similarity index 100% rename from tests/snapshots/add/require_weak/in/src/lib.rs rename to tests/testsuite/cargo_add/require_weak/in/src/lib.rs diff --git a/tests/testsuite/cargo_add/require_weak/mod.rs b/tests/testsuite/cargo_add/require_weak/mod.rs new file mode 100644 index 00000000000..cecb3be700e --- /dev/null +++ b/tests/testsuite/cargo_add/require_weak/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn require_weak() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("your-face --no-optional") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/require_weak/out/Cargo.toml b/tests/testsuite/cargo_add/require_weak/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/require_weak/out/Cargo.toml rename to tests/testsuite/cargo_add/require_weak/out/Cargo.toml diff --git a/tests/snapshots/add/require_weak/stderr.log b/tests/testsuite/cargo_add/require_weak/stderr.log similarity index 100% rename from tests/snapshots/add/require_weak/stderr.log rename to tests/testsuite/cargo_add/require_weak/stderr.log diff --git a/tests/snapshots/add/require_weak/stdout.log b/tests/testsuite/cargo_add/require_weak/stdout.log similarity index 100% rename from tests/snapshots/add/require_weak/stdout.log rename to tests/testsuite/cargo_add/require_weak/stdout.log diff --git a/tests/snapshots/add/target/in b/tests/testsuite/cargo_add/target/in similarity index 100% rename from tests/snapshots/add/target/in rename to tests/testsuite/cargo_add/target/in diff --git a/tests/testsuite/cargo_add/target/mod.rs b/tests/testsuite/cargo_add/target/mod.rs new file mode 100644 index 00000000000..93429d0719c --- /dev/null +++ b/tests/testsuite/cargo_add/target/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn target() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2 --target i686-unknown-linux-gnu") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/target/out/Cargo.toml b/tests/testsuite/cargo_add/target/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/target/out/Cargo.toml rename to tests/testsuite/cargo_add/target/out/Cargo.toml diff --git a/tests/snapshots/add/target/stderr.log b/tests/testsuite/cargo_add/target/stderr.log similarity index 100% rename from tests/snapshots/add/target/stderr.log rename to tests/testsuite/cargo_add/target/stderr.log diff --git a/tests/snapshots/add/target/stdout.log b/tests/testsuite/cargo_add/target/stdout.log similarity index 100% rename from tests/snapshots/add/target/stdout.log rename to tests/testsuite/cargo_add/target/stdout.log diff --git a/tests/snapshots/add/target_cfg/in b/tests/testsuite/cargo_add/target_cfg/in similarity index 100% rename from tests/snapshots/add/target_cfg/in rename to tests/testsuite/cargo_add/target_cfg/in diff --git a/tests/testsuite/cargo_add/target_cfg/mod.rs b/tests/testsuite/cargo_add/target_cfg/mod.rs new file mode 100644 index 00000000000..0502dc3ebe4 --- /dev/null +++ b/tests/testsuite/cargo_add/target_cfg/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn target_cfg() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package1 my-package2 --target cfg(unix)") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/target_cfg/out/Cargo.toml b/tests/testsuite/cargo_add/target_cfg/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/target_cfg/out/Cargo.toml rename to tests/testsuite/cargo_add/target_cfg/out/Cargo.toml diff --git a/tests/snapshots/add/target_cfg/stderr.log b/tests/testsuite/cargo_add/target_cfg/stderr.log similarity index 100% rename from tests/snapshots/add/target_cfg/stderr.log rename to tests/testsuite/cargo_add/target_cfg/stderr.log diff --git a/tests/snapshots/add/target_cfg/stdout.log b/tests/testsuite/cargo_add/target_cfg/stdout.log similarity index 100% rename from tests/snapshots/add/target_cfg/stdout.log rename to tests/testsuite/cargo_add/target_cfg/stdout.log diff --git a/tests/snapshots/add/unknown_inherited_feature/in/Cargo.toml b/tests/testsuite/cargo_add/unknown_inherited_feature/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/in/Cargo.toml rename to tests/testsuite/cargo_add/unknown_inherited_feature/in/Cargo.toml diff --git a/tests/snapshots/add/unknown_inherited_feature/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/unknown_inherited_feature/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/unknown_inherited_feature/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/unknown_inherited_feature/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/unknown_inherited_feature/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/unknown_inherited_feature/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/unknown_inherited_feature/in/primary/Cargo.toml b/tests/testsuite/cargo_add/unknown_inherited_feature/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/unknown_inherited_feature/in/primary/Cargo.toml diff --git a/tests/snapshots/add/unknown_inherited_feature/in/primary/src/lib.rs b/tests/testsuite/cargo_add/unknown_inherited_feature/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/unknown_inherited_feature/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/unknown_inherited_feature/mod.rs b/tests/testsuite/cargo_add/unknown_inherited_feature/mod.rs new file mode 100644 index 00000000000..3510151fe7c --- /dev/null +++ b/tests/testsuite/cargo_add/unknown_inherited_feature/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn unknown_inherited_feature() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .masquerade_as_nightly_cargo() + .arg("add") + .args(["foo", "-p", "bar"]) + .current_dir(cwd) + .assert() + .failure() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/unknown_inherited_feature/out/Cargo.toml b/tests/testsuite/cargo_add/unknown_inherited_feature/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/out/Cargo.toml rename to tests/testsuite/cargo_add/unknown_inherited_feature/out/Cargo.toml diff --git a/tests/snapshots/add/unknown_inherited_feature/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/unknown_inherited_feature/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/unknown_inherited_feature/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/unknown_inherited_feature/out/primary/Cargo.toml b/tests/testsuite/cargo_add/unknown_inherited_feature/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/unknown_inherited_feature/out/primary/Cargo.toml diff --git a/tests/snapshots/add/unknown_inherited_feature/stderr.log b/tests/testsuite/cargo_add/unknown_inherited_feature/stderr.log similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/stderr.log rename to tests/testsuite/cargo_add/unknown_inherited_feature/stderr.log diff --git a/tests/snapshots/add/unknown_inherited_feature/stdout.log b/tests/testsuite/cargo_add/unknown_inherited_feature/stdout.log similarity index 100% rename from tests/snapshots/add/unknown_inherited_feature/stdout.log rename to tests/testsuite/cargo_add/unknown_inherited_feature/stdout.log diff --git a/tests/snapshots/add/vers/in b/tests/testsuite/cargo_add/vers/in similarity index 100% rename from tests/snapshots/add/vers/in rename to tests/testsuite/cargo_add/vers/in diff --git a/tests/testsuite/cargo_add/vers/mod.rs b/tests/testsuite/cargo_add/vers/mod.rs new file mode 100644 index 00000000000..5467a6a976b --- /dev/null +++ b/tests/testsuite/cargo_add/vers/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn vers() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("my-package@>=0.1.1") + .current_dir(cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/vers/out/Cargo.toml b/tests/testsuite/cargo_add/vers/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/vers/out/Cargo.toml rename to tests/testsuite/cargo_add/vers/out/Cargo.toml diff --git a/tests/snapshots/add/vers/stderr.log b/tests/testsuite/cargo_add/vers/stderr.log similarity index 100% rename from tests/snapshots/add/vers/stderr.log rename to tests/testsuite/cargo_add/vers/stderr.log diff --git a/tests/snapshots/add/vers/stdout.log b/tests/testsuite/cargo_add/vers/stdout.log similarity index 100% rename from tests/snapshots/add/vers/stdout.log rename to tests/testsuite/cargo_add/vers/stdout.log diff --git a/tests/snapshots/add/workspace_name/in/Cargo.toml b/tests/testsuite/cargo_add/workspace_name/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_name/in/Cargo.toml rename to tests/testsuite/cargo_add/workspace_name/in/Cargo.toml diff --git a/tests/snapshots/add/workspace_name/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/workspace_name/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_name/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/workspace_name/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/workspace_name/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/workspace_name/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/workspace_name/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/workspace_name/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/workspace_name/in/primary/Cargo.toml b/tests/testsuite/cargo_add/workspace_name/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_name/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/workspace_name/in/primary/Cargo.toml diff --git a/tests/snapshots/add/workspace_name/in/primary/src/lib.rs b/tests/testsuite/cargo_add/workspace_name/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/workspace_name/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/workspace_name/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/workspace_name/mod.rs b/tests/testsuite/cargo_add/workspace_name/mod.rs new file mode 100644 index 00000000000..88b3be62f2a --- /dev/null +++ b/tests/testsuite/cargo_add/workspace_name/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn workspace_name() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/workspace_name/out/Cargo.toml b/tests/testsuite/cargo_add/workspace_name/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_name/out/Cargo.toml rename to tests/testsuite/cargo_add/workspace_name/out/Cargo.toml diff --git a/tests/snapshots/add/workspace_name/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/workspace_name/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_name/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/workspace_name/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/workspace_name/out/primary/Cargo.toml b/tests/testsuite/cargo_add/workspace_name/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_name/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/workspace_name/out/primary/Cargo.toml diff --git a/tests/snapshots/add/workspace_name/stderr.log b/tests/testsuite/cargo_add/workspace_name/stderr.log similarity index 100% rename from tests/snapshots/add/workspace_name/stderr.log rename to tests/testsuite/cargo_add/workspace_name/stderr.log diff --git a/tests/snapshots/add/workspace_name/stdout.log b/tests/testsuite/cargo_add/workspace_name/stdout.log similarity index 100% rename from tests/snapshots/add/workspace_name/stdout.log rename to tests/testsuite/cargo_add/workspace_name/stdout.log diff --git a/tests/snapshots/add/workspace_path/in/Cargo.toml b/tests/testsuite/cargo_add/workspace_path/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path/in/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path/in/Cargo.toml diff --git a/tests/snapshots/add/workspace_path/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/workspace_path/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/workspace_path/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/workspace_path/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/workspace_path/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/workspace_path/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/workspace_path/in/primary/Cargo.toml b/tests/testsuite/cargo_add/workspace_path/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path/in/primary/Cargo.toml diff --git a/tests/snapshots/add/workspace_path/in/primary/src/lib.rs b/tests/testsuite/cargo_add/workspace_path/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/workspace_path/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/workspace_path/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/workspace_path/mod.rs b/tests/testsuite/cargo_add/workspace_path/mod.rs new file mode 100644 index 00000000000..b5388682e2d --- /dev/null +++ b/tests/testsuite/cargo_add/workspace_path/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn workspace_path() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --path ../dependency") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/workspace_path/out/Cargo.toml b/tests/testsuite/cargo_add/workspace_path/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path/out/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path/out/Cargo.toml diff --git a/tests/snapshots/add/workspace_path/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/workspace_path/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/workspace_path/out/primary/Cargo.toml b/tests/testsuite/cargo_add/workspace_path/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path/out/primary/Cargo.toml diff --git a/tests/snapshots/add/workspace_path/stderr.log b/tests/testsuite/cargo_add/workspace_path/stderr.log similarity index 100% rename from tests/snapshots/add/workspace_path/stderr.log rename to tests/testsuite/cargo_add/workspace_path/stderr.log diff --git a/tests/snapshots/add/workspace_path/stdout.log b/tests/testsuite/cargo_add/workspace_path/stdout.log similarity index 100% rename from tests/snapshots/add/workspace_path/stdout.log rename to tests/testsuite/cargo_add/workspace_path/stdout.log diff --git a/tests/snapshots/add/workspace_path_dev/in/Cargo.toml b/tests/testsuite/cargo_add/workspace_path_dev/in/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path_dev/in/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path_dev/in/Cargo.toml diff --git a/tests/snapshots/add/workspace_path_dev/in/dependency/Cargo.toml b/tests/testsuite/cargo_add/workspace_path_dev/in/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path_dev/in/dependency/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path_dev/in/dependency/Cargo.toml diff --git a/tests/snapshots/add/workspace_path_dev/in/dependency/src/lib.rs b/tests/testsuite/cargo_add/workspace_path_dev/in/dependency/src/lib.rs similarity index 100% rename from tests/snapshots/add/workspace_path_dev/in/dependency/src/lib.rs rename to tests/testsuite/cargo_add/workspace_path_dev/in/dependency/src/lib.rs diff --git a/tests/snapshots/add/workspace_path_dev/in/primary/Cargo.toml b/tests/testsuite/cargo_add/workspace_path_dev/in/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path_dev/in/primary/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path_dev/in/primary/Cargo.toml diff --git a/tests/snapshots/add/workspace_path_dev/in/primary/src/lib.rs b/tests/testsuite/cargo_add/workspace_path_dev/in/primary/src/lib.rs similarity index 100% rename from tests/snapshots/add/workspace_path_dev/in/primary/src/lib.rs rename to tests/testsuite/cargo_add/workspace_path_dev/in/primary/src/lib.rs diff --git a/tests/testsuite/cargo_add/workspace_path_dev/mod.rs b/tests/testsuite/cargo_add/workspace_path_dev/mod.rs new file mode 100644 index 00000000000..a36f2546148 --- /dev/null +++ b/tests/testsuite/cargo_add/workspace_path_dev/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::cargo_add::init_registry; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn workspace_path_dev() { + init_registry(); + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = project_root.join("primary"); + + snapbox::cmd::Command::cargo() + .arg("add") + .arg_line("cargo-list-test-fixture-dependency --path ../dependency --dev") + .current_dir(&cwd) + .assert() + .success() + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); + + assert().subset_matches(curr_dir!().join("out"), &project_root); +} diff --git a/tests/snapshots/add/workspace_path_dev/out/Cargo.toml b/tests/testsuite/cargo_add/workspace_path_dev/out/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path_dev/out/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path_dev/out/Cargo.toml diff --git a/tests/snapshots/add/workspace_path_dev/out/dependency/Cargo.toml b/tests/testsuite/cargo_add/workspace_path_dev/out/dependency/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path_dev/out/dependency/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path_dev/out/dependency/Cargo.toml diff --git a/tests/snapshots/add/workspace_path_dev/out/primary/Cargo.toml b/tests/testsuite/cargo_add/workspace_path_dev/out/primary/Cargo.toml similarity index 100% rename from tests/snapshots/add/workspace_path_dev/out/primary/Cargo.toml rename to tests/testsuite/cargo_add/workspace_path_dev/out/primary/Cargo.toml diff --git a/tests/snapshots/add/workspace_path_dev/stderr.log b/tests/testsuite/cargo_add/workspace_path_dev/stderr.log similarity index 100% rename from tests/snapshots/add/workspace_path_dev/stderr.log rename to tests/testsuite/cargo_add/workspace_path_dev/stderr.log diff --git a/tests/snapshots/add/workspace_path_dev/stdout.log b/tests/testsuite/cargo_add/workspace_path_dev/stdout.log similarity index 100% rename from tests/snapshots/add/workspace_path_dev/stdout.log rename to tests/testsuite/cargo_add/workspace_path_dev/stdout.log From 639f3bdea5cb9798b1aae82a4ac84999c7cded37 Mon Sep 17 00:00:00 2001 From: Scott Schafer Date: Fri, 6 May 2022 20:51:49 -0500 Subject: [PATCH 2/2] move all `snapshot/init/` tests to `testsuite/init/` --- tests/snapshots/init/auto_git/in | 1 - tests/snapshots/init/explicit_bin_with_git/in | 1 - tests/snapshots/init/simple_bin/in | 1 - tests/snapshots/init/simple_git/in | 1 - tests/snapshots/init/simple_hg/in | 1 - tests/snapshots/init/simple_lib/in | 1 - tests/snapshots/init/with_argument/stderr.log | 1 - tests/snapshots/init/with_argument/stdout.log | 0 tests/testsuite/init.rs | 749 ------------------ tests/testsuite/init/auto_git/in | 1 + tests/testsuite/init/auto_git/mod.rs | 22 + .../init/auto_git/out/.gitignore | 0 .../init/auto_git/out/Cargo.toml | 0 .../init/auto_git/out/src/lib.rs | 0 .../init/auto_git/stderr.log | 0 .../init/auto_git/stdout.log | 0 .../in/src/main.rs | 0 .../init/bin_already_exists_explicit/mod.rs | 21 + .../out/Cargo.toml | 0 .../out/src/main.rs | 0 .../bin_already_exists_explicit/stderr.log | 0 .../bin_already_exists_explicit/stdout.log | 0 .../in/main.rs | 0 .../bin_already_exists_explicit_nosrc/mod.rs | 22 + .../out/Cargo.toml | 0 .../out/main.rs | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/src/main.rs | 0 .../init/bin_already_exists_implicit/mod.rs | 21 + .../out/Cargo.toml | 0 .../out/src/main.rs | 0 .../bin_already_exists_implicit/stderr.log | 0 .../bin_already_exists_implicit/stdout.log | 0 .../in/case.rs | 0 .../mod.rs | 22 + .../out/Cargo.toml | 0 .../out/case.rs | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/src/case.rs | 0 .../mod.rs | 22 + .../out/Cargo.toml | 0 .../out/src/case.rs | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/main.rs | 0 .../bin_already_exists_implicit_nosrc/mod.rs | 22 + .../out/Cargo.toml | 0 .../out/main.rs | 0 .../stderr.log | 0 .../stdout.log | 0 tests/testsuite/init/both_lib_and_bin/mod.rs | 19 + .../init/both_lib_and_bin/stderr.log | 0 .../init/both_lib_and_bin/stdout.log | 0 .../in/case.rs | 0 .../in/lib.rs | 0 .../mod.rs | 18 + .../stderr.log | 0 .../stdout.log | 0 .../confused_by_multiple_lib_files/in/lib.rs | 0 .../in/src/lib.rs | 0 .../confused_by_multiple_lib_files/mod.rs | 22 + .../confused_by_multiple_lib_files/out/lib.rs | 0 .../out/src/lib.rs | 0 .../confused_by_multiple_lib_files/stderr.log | 0 .../confused_by_multiple_lib_files/stdout.log | 0 .../in/case.rs | 0 .../in/lib.rs | 0 .../mod.rs | 21 + .../out/Cargo.toml | 0 .../out/case.rs | 0 .../out/lib.rs | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/case.rs | 0 .../mod.rs | 21 + .../out/Cargo.toml | 0 .../out/case.rs | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/case.rs | 0 .../mod.rs | 21 + .../out/Cargo.toml | 0 .../out/case.rs | 0 .../stderr.log | 0 .../stdout.log | 0 .../init/empty_dir}/.keep | 0 tests/testsuite/init/empty_dir/mod.rs | 7 + tests/testsuite/init/explicit_bin_with_git/in | 1 + .../init/explicit_bin_with_git/mod.rs | 21 + .../init/explicit_bin_with_git/out/.gitignore | 0 .../init/explicit_bin_with_git/out/Cargo.toml | 0 .../explicit_bin_with_git/out/src/main.rs | 0 .../init/explicit_bin_with_git/stderr.log | 0 .../init/explicit_bin_with_git/stdout.log | 0 .../init/formats_source/in/rustfmt.toml | 0 tests/testsuite/init/formats_source/mod.rs | 25 + .../init/formats_source/out/Cargo.toml | 0 .../init/formats_source/out/rustfmt.toml | 0 .../init/formats_source/out/src/lib.rs | 0 .../init/formats_source/stderr.log | 0 .../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 | 0 .../out/.fossil-settings/ignore-glob | 0 .../init/fossil_autodetect/out/Cargo.toml | 0 .../init/fossil_autodetect/out/src/lib.rs | 0 .../init/fossil_autodetect/stderr.log | 0 .../init/fossil_autodetect/stdout.log | 0 tests/testsuite/init/git_autodetect/mod.rs | 24 + .../init/git_autodetect/out/.gitignore | 0 .../init/git_autodetect/out/Cargo.toml | 0 .../init/git_autodetect/out/src/lib.rs | 0 .../init/git_autodetect/stderr.log | 0 .../init/git_autodetect/stdout.log | 0 .../in/.gitignore | 0 .../mod.rs | 22 + .../out/.gitignore | 0 .../out/Cargo.toml | 0 .../out/src/lib.rs | 0 .../stderr.log | 0 .../stdout.log | 0 .../in/rustfmt.toml | 0 .../ignores_failure_to_format_source/mod.rs | 22 + .../out/Cargo.toml | 0 .../out/rustfmt.toml | 0 .../out/src/lib.rs | 0 .../stderr.log | 0 .../stdout.log | 0 .../init/inferred_bin_with_git/in/main.rs | 0 .../init/inferred_bin_with_git/mod.rs | 21 + .../init/inferred_bin_with_git/out/.gitignore | 0 .../init/inferred_bin_with_git/out/Cargo.toml | 0 .../init/inferred_bin_with_git/out/main.rs | 0 .../init/inferred_bin_with_git}/stderr.log | 0 .../init/inferred_bin_with_git}/stdout.log | 0 .../init/inferred_lib_with_git/in/lib.rs | 0 .../init/inferred_lib_with_git/mod.rs | 21 + .../init/inferred_lib_with_git/out/.gitignore | 0 .../init/inferred_lib_with_git/out/Cargo.toml | 0 .../init/inferred_lib_with_git/out/lib.rs | 0 .../init/inferred_lib_with_git/stderr.log | 0 .../init/inferred_lib_with_git}/stdout.log | 0 tests/testsuite/init/invalid_dir_name/mod.rs | 21 + .../init/invalid_dir_name/stderr.log | 0 .../init/invalid_dir_name}/stdout.log | 0 .../init/lib_already_exists_nosrc/in/lib.rs | 0 .../init/lib_already_exists_nosrc/mod.rs | 22 + .../lib_already_exists_nosrc/out/Cargo.toml | 0 .../init/lib_already_exists_nosrc/out/lib.rs | 0 .../init/lib_already_exists_nosrc/stderr.log | 0 .../init/lib_already_exists_nosrc}/stdout.log | 0 .../init/lib_already_exists_src/in/src/lib.rs | 0 .../init/lib_already_exists_src/mod.rs | 22 + .../lib_already_exists_src/out/Cargo.toml | 0 .../lib_already_exists_src/out/src/lib.rs | 0 .../init/lib_already_exists_src/stderr.log | 0 .../init/lib_already_exists_src}/stdout.log | 0 .../init/mercurial_autodetect/in/.hg/.keep | 0 .../init/mercurial_autodetect/mod.rs | 22 + .../init/mercurial_autodetect/out/.hgignore | 0 .../init/mercurial_autodetect/out/Cargo.toml | 0 .../init/mercurial_autodetect/out/src/lib.rs | 0 .../init/mercurial_autodetect/stderr.log | 0 .../init/mercurial_autodetect}/stdout.log | 0 tests/testsuite/init/mod.rs | 53 ++ .../multibin_project_name_clash/in/case.rs | 0 .../multibin_project_name_clash/in/main.rs | 0 .../init/multibin_project_name_clash/mod.rs | 22 + .../multibin_project_name_clash/out/case.rs | 0 .../multibin_project_name_clash/out/main.rs | 0 .../multibin_project_name_clash/stderr.log | 0 .../multibin_project_name_clash}/stdout.log | 0 tests/testsuite/init/no_filename/mod.rs | 16 + .../init/no_filename/stderr.log | 0 .../init/no_filename}/stdout.log | 0 .../init/pijul_autodetect/in/.pijul/.keep | 0 tests/testsuite/init/pijul_autodetect/mod.rs | 22 + .../init/pijul_autodetect/out/.ignore | 0 .../init/pijul_autodetect/out/Cargo.toml | 0 .../init/pijul_autodetect/out/src/lib.rs | 0 .../init/pijul_autodetect/stderr.log | 0 .../init/pijul_autodetect}/stdout.log | 0 tests/testsuite/init/reserved_name/mod.rs | 21 + .../init/reserved_name/stderr.log | 0 .../init/reserved_name}/stdout.log | 0 tests/testsuite/init/simple_bin/in | 1 + tests/testsuite/init/simple_bin/mod.rs | 29 + .../init/simple_bin/out/Cargo.toml | 0 .../init/simple_bin/out/src/main.rs | 0 .../init/simple_bin}/stderr.log | 0 .../init/simple_bin}/stdout.log | 0 tests/testsuite/init/simple_git/in | 1 + tests/testsuite/init/simple_git/mod.rs | 22 + .../init/simple_git/out/.gitignore | 0 .../init/simple_git/out/Cargo.toml | 0 .../init/simple_git/out/src/lib.rs | 0 .../init/simple_git/stderr.log | 0 .../init/simple_git}/stdout.log | 0 .../simple_git_ignore_exists/in/.gitignore | 0 .../init/simple_git_ignore_exists/mod.rs | 28 + .../simple_git_ignore_exists/out/.gitignore | 0 .../simple_git_ignore_exists/out/Cargo.toml | 0 .../simple_git_ignore_exists/out/src/lib.rs | 0 .../init/simple_git_ignore_exists/stderr.log | 0 .../init/simple_git_ignore_exists}/stdout.log | 0 tests/testsuite/init/simple_hg/in | 1 + tests/testsuite/init/simple_hg/mod.rs | 27 + .../init/simple_hg/out/.hgignore | 0 .../init/simple_hg/out/Cargo.toml | 0 .../init/simple_hg/out/src/lib.rs | 0 .../init/simple_hg/stderr.log | 0 .../init/simple_hg}/stdout.log | 0 .../init/simple_hg_ignore_exists/in/.hg/.keep | 0 .../init/simple_hg_ignore_exists/in/.hgignore | 0 .../init/simple_hg_ignore_exists/mod.rs | 22 + .../simple_hg_ignore_exists/out/.hgignore | 0 .../simple_hg_ignore_exists/out/Cargo.toml | 0 .../simple_hg_ignore_exists/out/src/lib.rs | 0 .../init/simple_hg_ignore_exists/stderr.log | 0 .../init/simple_hg_ignore_exists}/stdout.log | 0 tests/testsuite/init/simple_lib/in | 1 + tests/testsuite/init/simple_lib/mod.rs | 29 + .../init/simple_lib/out/Cargo.toml | 0 .../init/simple_lib/out/src/lib.rs | 0 .../init/simple_lib/stderr.log | 0 .../init/simple_lib}/stdout.log | 0 tests/testsuite/init/unknown_flags/mod.rs | 15 + .../init/unknown_flags/stderr.log | 0 .../init/unknown_flags}/stdout.log | 0 .../init/with_argument/in/foo/.keep | 0 tests/testsuite/init/with_argument/mod.rs | 21 + .../init/with_argument/out/foo/Cargo.toml | 0 .../init/with_argument/out/foo/src/main.rs | 0 .../init/with_argument}/stderr.log | 0 .../init/with_argument}/stdout.log | 0 238 files changed, 879 insertions(+), 756 deletions(-) delete mode 120000 tests/snapshots/init/auto_git/in delete mode 120000 tests/snapshots/init/explicit_bin_with_git/in delete mode 120000 tests/snapshots/init/simple_bin/in delete mode 120000 tests/snapshots/init/simple_git/in delete mode 120000 tests/snapshots/init/simple_hg/in delete mode 120000 tests/snapshots/init/simple_lib/in delete mode 100644 tests/snapshots/init/with_argument/stderr.log delete mode 100644 tests/snapshots/init/with_argument/stdout.log delete mode 100644 tests/testsuite/init.rs create mode 120000 tests/testsuite/init/auto_git/in create mode 100644 tests/testsuite/init/auto_git/mod.rs rename tests/{snapshots => testsuite}/init/auto_git/out/.gitignore (100%) rename tests/{snapshots => testsuite}/init/auto_git/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/auto_git/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/auto_git/stderr.log (100%) rename tests/{snapshots => testsuite}/init/auto_git/stdout.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit/in/src/main.rs (100%) create mode 100644 tests/testsuite/init/bin_already_exists_explicit/mod.rs rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit/out/src/main.rs (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit/stderr.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit/stdout.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit_nosrc/in/main.rs (100%) create mode 100644 tests/testsuite/init/bin_already_exists_explicit_nosrc/mod.rs rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit_nosrc/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit_nosrc/out/main.rs (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit_nosrc/stderr.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_explicit_nosrc/stdout.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit/in/src/main.rs (100%) create mode 100644 tests/testsuite/init/bin_already_exists_implicit/mod.rs rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit/out/src/main.rs (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit/stderr.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit/stdout.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namenosrc/in/case.rs (100%) create mode 100644 tests/testsuite/init/bin_already_exists_implicit_namenosrc/mod.rs rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namenosrc/out/case.rs (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namenosrc/stderr.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namenosrc/stdout.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namesrc/in/src/case.rs (100%) create mode 100644 tests/testsuite/init/bin_already_exists_implicit_namesrc/mod.rs rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namesrc/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namesrc/out/src/case.rs (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namesrc/stderr.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_namesrc/stdout.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_nosrc/in/main.rs (100%) create mode 100644 tests/testsuite/init/bin_already_exists_implicit_nosrc/mod.rs rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_nosrc/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_nosrc/out/main.rs (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_nosrc/stderr.log (100%) rename tests/{snapshots => testsuite}/init/bin_already_exists_implicit_nosrc/stdout.log (100%) create mode 100644 tests/testsuite/init/both_lib_and_bin/mod.rs rename tests/{snapshots => testsuite}/init/both_lib_and_bin/stderr.log (100%) rename tests/{snapshots => testsuite}/init/both_lib_and_bin/stdout.log (100%) rename tests/{snapshots => testsuite}/init/cant_create_library_when_both_binlib_present/in/case.rs (100%) rename tests/{snapshots => testsuite}/init/cant_create_library_when_both_binlib_present/in/lib.rs (100%) create mode 100644 tests/testsuite/init/cant_create_library_when_both_binlib_present/mod.rs rename tests/{snapshots => testsuite}/init/cant_create_library_when_both_binlib_present/stderr.log (100%) rename tests/{snapshots => testsuite}/init/cant_create_library_when_both_binlib_present/stdout.log (100%) rename tests/{snapshots => testsuite}/init/confused_by_multiple_lib_files/in/lib.rs (100%) rename tests/{snapshots => testsuite}/init/confused_by_multiple_lib_files/in/src/lib.rs (100%) create mode 100644 tests/testsuite/init/confused_by_multiple_lib_files/mod.rs rename tests/{snapshots => testsuite}/init/confused_by_multiple_lib_files/out/lib.rs (100%) rename tests/{snapshots => testsuite}/init/confused_by_multiple_lib_files/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/confused_by_multiple_lib_files/stderr.log (100%) rename tests/{snapshots => testsuite}/init/confused_by_multiple_lib_files/stdout.log (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_both_binlib_present/in/case.rs (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_both_binlib_present/in/lib.rs (100%) create mode 100644 tests/testsuite/init/creates_binary_when_both_binlib_present/mod.rs rename tests/{snapshots => testsuite}/init/creates_binary_when_both_binlib_present/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_both_binlib_present/out/case.rs (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_both_binlib_present/out/lib.rs (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_both_binlib_present/stderr.log (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_both_binlib_present/stdout.log (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs (100%) create mode 100644 tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/mod.rs rename tests/{snapshots => testsuite}/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_instructed_and_has_lib_file/stderr.log (100%) rename tests/{snapshots => testsuite}/init/creates_binary_when_instructed_and_has_lib_file/stdout.log (100%) rename tests/{snapshots => testsuite}/init/creates_library_when_instructed_and_has_bin_file/in/case.rs (100%) create mode 100644 tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/mod.rs rename tests/{snapshots => testsuite}/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/creates_library_when_instructed_and_has_bin_file/out/case.rs (100%) rename tests/{snapshots => testsuite}/init/creates_library_when_instructed_and_has_bin_file/stderr.log (100%) rename tests/{snapshots => testsuite}/init/creates_library_when_instructed_and_has_bin_file/stdout.log (100%) rename tests/{snapshots/init/empty-dir => testsuite/init/empty_dir}/.keep (100%) create mode 100644 tests/testsuite/init/empty_dir/mod.rs create mode 120000 tests/testsuite/init/explicit_bin_with_git/in create mode 100644 tests/testsuite/init/explicit_bin_with_git/mod.rs rename tests/{snapshots => testsuite}/init/explicit_bin_with_git/out/.gitignore (100%) rename tests/{snapshots => testsuite}/init/explicit_bin_with_git/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/explicit_bin_with_git/out/src/main.rs (100%) rename tests/{snapshots => testsuite}/init/explicit_bin_with_git/stderr.log (100%) rename tests/{snapshots => testsuite}/init/explicit_bin_with_git/stdout.log (100%) rename tests/{snapshots => testsuite}/init/formats_source/in/rustfmt.toml (100%) create mode 100644 tests/testsuite/init/formats_source/mod.rs rename tests/{snapshots => testsuite}/init/formats_source/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/formats_source/out/rustfmt.toml (100%) rename tests/{snapshots => testsuite}/init/formats_source/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/formats_source/stderr.log (100%) rename tests/{snapshots => testsuite}/init/formats_source/stdout.log (100%) rename tests/{snapshots => testsuite}/init/fossil_autodetect/in/.fossil/.keep (100%) create mode 100644 tests/testsuite/init/fossil_autodetect/mod.rs rename tests/{snapshots => testsuite}/init/fossil_autodetect/out/.fossil-settings/clean-glob (100%) rename tests/{snapshots => testsuite}/init/fossil_autodetect/out/.fossil-settings/ignore-glob (100%) rename tests/{snapshots => testsuite}/init/fossil_autodetect/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/fossil_autodetect/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/fossil_autodetect/stderr.log (100%) rename tests/{snapshots => testsuite}/init/fossil_autodetect/stdout.log (100%) create mode 100644 tests/testsuite/init/git_autodetect/mod.rs rename tests/{snapshots => testsuite}/init/git_autodetect/out/.gitignore (100%) rename tests/{snapshots => testsuite}/init/git_autodetect/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/git_autodetect/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/git_autodetect/stderr.log (100%) rename tests/{snapshots => testsuite}/init/git_autodetect/stdout.log (100%) rename tests/{snapshots => testsuite}/init/git_ignore_exists_no_conflicting_entries/in/.gitignore (100%) create mode 100644 tests/testsuite/init/git_ignore_exists_no_conflicting_entries/mod.rs rename tests/{snapshots => testsuite}/init/git_ignore_exists_no_conflicting_entries/out/.gitignore (100%) rename tests/{snapshots => testsuite}/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/git_ignore_exists_no_conflicting_entries/stderr.log (100%) rename tests/{snapshots => testsuite}/init/git_ignore_exists_no_conflicting_entries/stdout.log (100%) rename tests/{snapshots => testsuite}/init/ignores_failure_to_format_source/in/rustfmt.toml (100%) create mode 100644 tests/testsuite/init/ignores_failure_to_format_source/mod.rs rename tests/{snapshots => testsuite}/init/ignores_failure_to_format_source/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/ignores_failure_to_format_source/out/rustfmt.toml (100%) rename tests/{snapshots => testsuite}/init/ignores_failure_to_format_source/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/ignores_failure_to_format_source/stderr.log (100%) rename tests/{snapshots => testsuite}/init/ignores_failure_to_format_source/stdout.log (100%) rename tests/{snapshots => testsuite}/init/inferred_bin_with_git/in/main.rs (100%) create mode 100644 tests/testsuite/init/inferred_bin_with_git/mod.rs rename tests/{snapshots => testsuite}/init/inferred_bin_with_git/out/.gitignore (100%) rename tests/{snapshots => testsuite}/init/inferred_bin_with_git/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/inferred_bin_with_git/out/main.rs (100%) rename tests/{snapshots/init/implicit_bin_with_git => testsuite/init/inferred_bin_with_git}/stderr.log (100%) rename tests/{snapshots/init/implicit_bin_with_git => testsuite/init/inferred_bin_with_git}/stdout.log (100%) rename tests/{snapshots => testsuite}/init/inferred_lib_with_git/in/lib.rs (100%) create mode 100644 tests/testsuite/init/inferred_lib_with_git/mod.rs rename tests/{snapshots => testsuite}/init/inferred_lib_with_git/out/.gitignore (100%) rename tests/{snapshots => testsuite}/init/inferred_lib_with_git/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/inferred_lib_with_git/out/lib.rs (100%) rename tests/{snapshots => testsuite}/init/inferred_lib_with_git/stderr.log (100%) rename tests/{snapshots/init/inferred_bin_with_git => testsuite/init/inferred_lib_with_git}/stdout.log (100%) create mode 100644 tests/testsuite/init/invalid_dir_name/mod.rs rename tests/{snapshots => testsuite}/init/invalid_dir_name/stderr.log (100%) rename tests/{snapshots/init/inferred_lib_with_git => testsuite/init/invalid_dir_name}/stdout.log (100%) rename tests/{snapshots => testsuite}/init/lib_already_exists_nosrc/in/lib.rs (100%) create mode 100644 tests/testsuite/init/lib_already_exists_nosrc/mod.rs rename tests/{snapshots => testsuite}/init/lib_already_exists_nosrc/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/lib_already_exists_nosrc/out/lib.rs (100%) rename tests/{snapshots => testsuite}/init/lib_already_exists_nosrc/stderr.log (100%) rename tests/{snapshots/init/invalid_dir_name => testsuite/init/lib_already_exists_nosrc}/stdout.log (100%) rename tests/{snapshots => testsuite}/init/lib_already_exists_src/in/src/lib.rs (100%) create mode 100644 tests/testsuite/init/lib_already_exists_src/mod.rs rename tests/{snapshots => testsuite}/init/lib_already_exists_src/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/lib_already_exists_src/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/lib_already_exists_src/stderr.log (100%) rename tests/{snapshots/init/lib_already_exists_nosrc => testsuite/init/lib_already_exists_src}/stdout.log (100%) rename tests/{snapshots => testsuite}/init/mercurial_autodetect/in/.hg/.keep (100%) create mode 100644 tests/testsuite/init/mercurial_autodetect/mod.rs rename tests/{snapshots => testsuite}/init/mercurial_autodetect/out/.hgignore (100%) rename tests/{snapshots => testsuite}/init/mercurial_autodetect/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/mercurial_autodetect/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/mercurial_autodetect/stderr.log (100%) rename tests/{snapshots/init/lib_already_exists_src => testsuite/init/mercurial_autodetect}/stdout.log (100%) create mode 100644 tests/testsuite/init/mod.rs rename tests/{snapshots => testsuite}/init/multibin_project_name_clash/in/case.rs (100%) rename tests/{snapshots => testsuite}/init/multibin_project_name_clash/in/main.rs (100%) create mode 100644 tests/testsuite/init/multibin_project_name_clash/mod.rs rename tests/{snapshots => testsuite}/init/multibin_project_name_clash/out/case.rs (100%) rename tests/{snapshots => testsuite}/init/multibin_project_name_clash/out/main.rs (100%) rename tests/{snapshots => testsuite}/init/multibin_project_name_clash/stderr.log (100%) rename tests/{snapshots/init/mercurial_autodetect => testsuite/init/multibin_project_name_clash}/stdout.log (100%) create mode 100644 tests/testsuite/init/no_filename/mod.rs rename tests/{snapshots => testsuite}/init/no_filename/stderr.log (100%) rename tests/{snapshots/init/multibin_project_name_clash => testsuite/init/no_filename}/stdout.log (100%) rename tests/{snapshots => testsuite}/init/pijul_autodetect/in/.pijul/.keep (100%) create mode 100644 tests/testsuite/init/pijul_autodetect/mod.rs rename tests/{snapshots => testsuite}/init/pijul_autodetect/out/.ignore (100%) rename tests/{snapshots => testsuite}/init/pijul_autodetect/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/pijul_autodetect/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/pijul_autodetect/stderr.log (100%) rename tests/{snapshots/init/no_filename => testsuite/init/pijul_autodetect}/stdout.log (100%) create mode 100644 tests/testsuite/init/reserved_name/mod.rs rename tests/{snapshots => testsuite}/init/reserved_name/stderr.log (100%) rename tests/{snapshots/init/pijul_autodetect => testsuite/init/reserved_name}/stdout.log (100%) create mode 120000 tests/testsuite/init/simple_bin/in create mode 100644 tests/testsuite/init/simple_bin/mod.rs rename tests/{snapshots => testsuite}/init/simple_bin/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/simple_bin/out/src/main.rs (100%) rename tests/{snapshots/init/inferred_bin_with_git => testsuite/init/simple_bin}/stderr.log (100%) rename tests/{snapshots/init/reserved_name => testsuite/init/simple_bin}/stdout.log (100%) create mode 120000 tests/testsuite/init/simple_git/in create mode 100644 tests/testsuite/init/simple_git/mod.rs rename tests/{snapshots => testsuite}/init/simple_git/out/.gitignore (100%) rename tests/{snapshots => testsuite}/init/simple_git/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/simple_git/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/simple_git/stderr.log (100%) rename tests/{snapshots/init/simple_bin => testsuite/init/simple_git}/stdout.log (100%) rename tests/{snapshots => testsuite}/init/simple_git_ignore_exists/in/.gitignore (100%) create mode 100644 tests/testsuite/init/simple_git_ignore_exists/mod.rs rename tests/{snapshots => testsuite}/init/simple_git_ignore_exists/out/.gitignore (100%) rename tests/{snapshots => testsuite}/init/simple_git_ignore_exists/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/simple_git_ignore_exists/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/simple_git_ignore_exists/stderr.log (100%) rename tests/{snapshots/init/simple_git => testsuite/init/simple_git_ignore_exists}/stdout.log (100%) create mode 120000 tests/testsuite/init/simple_hg/in create mode 100644 tests/testsuite/init/simple_hg/mod.rs rename tests/{snapshots => testsuite}/init/simple_hg/out/.hgignore (100%) rename tests/{snapshots => testsuite}/init/simple_hg/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/simple_hg/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/simple_hg/stderr.log (100%) rename tests/{snapshots/init/simple_git_ignore_exists => testsuite/init/simple_hg}/stdout.log (100%) rename tests/{snapshots => testsuite}/init/simple_hg_ignore_exists/in/.hg/.keep (100%) rename tests/{snapshots => testsuite}/init/simple_hg_ignore_exists/in/.hgignore (100%) create mode 100644 tests/testsuite/init/simple_hg_ignore_exists/mod.rs rename tests/{snapshots => testsuite}/init/simple_hg_ignore_exists/out/.hgignore (100%) rename tests/{snapshots => testsuite}/init/simple_hg_ignore_exists/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/simple_hg_ignore_exists/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/simple_hg_ignore_exists/stderr.log (100%) rename tests/{snapshots/init/simple_hg => testsuite/init/simple_hg_ignore_exists}/stdout.log (100%) create mode 120000 tests/testsuite/init/simple_lib/in create mode 100644 tests/testsuite/init/simple_lib/mod.rs rename tests/{snapshots => testsuite}/init/simple_lib/out/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/simple_lib/out/src/lib.rs (100%) rename tests/{snapshots => testsuite}/init/simple_lib/stderr.log (100%) rename tests/{snapshots/init/simple_hg_ignore_exists => testsuite/init/simple_lib}/stdout.log (100%) create mode 100644 tests/testsuite/init/unknown_flags/mod.rs rename tests/{snapshots => testsuite}/init/unknown_flags/stderr.log (100%) rename tests/{snapshots/init/simple_lib => testsuite/init/unknown_flags}/stdout.log (100%) rename tests/{snapshots => testsuite}/init/with_argument/in/foo/.keep (100%) create mode 100644 tests/testsuite/init/with_argument/mod.rs rename tests/{snapshots => testsuite}/init/with_argument/out/foo/Cargo.toml (100%) rename tests/{snapshots => testsuite}/init/with_argument/out/foo/src/main.rs (100%) rename tests/{snapshots/init/simple_bin => testsuite/init/with_argument}/stderr.log (100%) rename tests/{snapshots/init/unknown_flags => testsuite/init/with_argument}/stdout.log (100%) diff --git a/tests/snapshots/init/auto_git/in b/tests/snapshots/init/auto_git/in deleted file mode 120000 index 55a0d0ef92e..00000000000 --- a/tests/snapshots/init/auto_git/in +++ /dev/null @@ -1 +0,0 @@ -../empty-dir \ No newline at end of file diff --git a/tests/snapshots/init/explicit_bin_with_git/in b/tests/snapshots/init/explicit_bin_with_git/in deleted file mode 120000 index 55a0d0ef92e..00000000000 --- a/tests/snapshots/init/explicit_bin_with_git/in +++ /dev/null @@ -1 +0,0 @@ -../empty-dir \ No newline at end of file diff --git a/tests/snapshots/init/simple_bin/in b/tests/snapshots/init/simple_bin/in deleted file mode 120000 index 55a0d0ef92e..00000000000 --- a/tests/snapshots/init/simple_bin/in +++ /dev/null @@ -1 +0,0 @@ -../empty-dir \ No newline at end of file diff --git a/tests/snapshots/init/simple_git/in b/tests/snapshots/init/simple_git/in deleted file mode 120000 index 55a0d0ef92e..00000000000 --- a/tests/snapshots/init/simple_git/in +++ /dev/null @@ -1 +0,0 @@ -../empty-dir \ No newline at end of file diff --git a/tests/snapshots/init/simple_hg/in b/tests/snapshots/init/simple_hg/in deleted file mode 120000 index 55a0d0ef92e..00000000000 --- a/tests/snapshots/init/simple_hg/in +++ /dev/null @@ -1 +0,0 @@ -../empty-dir \ No newline at end of file diff --git a/tests/snapshots/init/simple_lib/in b/tests/snapshots/init/simple_lib/in deleted file mode 120000 index 55a0d0ef92e..00000000000 --- a/tests/snapshots/init/simple_lib/in +++ /dev/null @@ -1 +0,0 @@ -../empty-dir \ No newline at end of file diff --git a/tests/snapshots/init/with_argument/stderr.log b/tests/snapshots/init/with_argument/stderr.log deleted file mode 100644 index 3847e4e4a26..00000000000 --- a/tests/snapshots/init/with_argument/stderr.log +++ /dev/null @@ -1 +0,0 @@ - Created binary (application) package diff --git a/tests/snapshots/init/with_argument/stdout.log b/tests/snapshots/init/with_argument/stdout.log deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/testsuite/init.rs b/tests/testsuite/init.rs deleted file mode 100644 index 819dc14b3cb..00000000000 --- a/tests/testsuite/init.rs +++ /dev/null @@ -1,749 +0,0 @@ -//! Tests for the `cargo init` command. - -use cargo_test_support::compare::assert; -use cargo_test_support::prelude::*; -use cargo_test_support::{command_is_available, paths, Project}; -use std::fs; -use std::process::Command; - -fn mercurial_available() -> bool { - let result = Command::new("hg") - .arg("--version") - .output() - .map(|o| o.status.success()) - .unwrap_or(false); - if !result { - println!("`hg` not available, skipping test"); - } - result -} - -#[cargo_test] -fn simple_lib() { - let project = Project::from_template("tests/snapshots/init/simple_lib/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --vcs none --edition 2015") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/simple_lib/stdout.log") - .stderr_matches_path("tests/snapshots/init/simple_lib/stderr.log"); - - assert().subset_matches("tests/snapshots/init/simple_lib/out", project_root); - assert!(!project_root.join(".gitignore").is_file()); - - snapbox::cmd::Command::cargo() - .current_dir(project_root) - .arg("build") - .assert() - .success(); - assert!(!project.bin("foo").is_file()); -} - -#[cargo_test] -fn simple_bin() { - let project = Project::from_template("tests/snapshots/init/simple_bin/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --bin --vcs none --edition 2015") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/simple_bin/stdout.log") - .stderr_matches_path("tests/snapshots/init/simple_bin/stderr.log"); - - assert().subset_matches("tests/snapshots/init/simple_bin/out", project_root); - assert!(!project_root.join(".gitignore").is_file()); - - snapbox::cmd::Command::cargo() - .current_dir(project_root) - .arg("build") - .assert() - .success(); - assert!(project.bin("case").is_file()); -} - -#[cargo_test] -fn simple_git_ignore_exists() { - let project = Project::from_template("tests/snapshots/init/simple_git_ignore_exists/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --edition 2015") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/simple_git_ignore_exists/stdout.log") - .stderr_matches_path("tests/snapshots/init/simple_git_ignore_exists/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/simple_git_ignore_exists/out", - project_root, - ); - assert!(project_root.join(".git").is_dir()); - - snapbox::cmd::Command::cargo() - .current_dir(project_root) - .arg("build") - .assert() - .success(); -} - -#[cargo_test] -fn git_ignore_exists_no_conflicting_entries() { - let project = - Project::from_template("tests/snapshots/init/git_ignore_exists_no_conflicting_entries/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --edition 2015") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path( - "tests/snapshots/init/git_ignore_exists_no_conflicting_entries/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/init/git_ignore_exists_no_conflicting_entries/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/init/git_ignore_exists_no_conflicting_entries/out", - project_root, - ); - assert!(project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn both_lib_and_bin() { - let cwd = paths::root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --bin") - .current_dir(&cwd) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/init/both_lib_and_bin/stdout.log") - .stderr_matches_path("tests/snapshots/init/both_lib_and_bin/stderr.log"); - - assert!(!cwd.join("Cargo.toml").is_file()); -} - -#[cargo_test] -fn bin_already_exists_explicit() { - let project = Project::from_template("tests/snapshots/init/bin_already_exists_explicit/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --bin --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/bin_already_exists_explicit/stdout.log") - .stderr_matches_path("tests/snapshots/init/bin_already_exists_explicit/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/bin_already_exists_explicit/out", - project_root, - ); -} - -#[cargo_test] -fn bin_already_exists_implicit() { - let project = Project::from_template("tests/snapshots/init/bin_already_exists_implicit/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/bin_already_exists_implicit/stdout.log") - .stderr_matches_path("tests/snapshots/init/bin_already_exists_implicit/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/bin_already_exists_implicit/out", - project_root, - ); -} - -#[cargo_test] -fn bin_already_exists_explicit_nosrc() { - let project = - Project::from_template("tests/snapshots/init/bin_already_exists_explicit_nosrc/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --bin --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/bin_already_exists_explicit_nosrc/stdout.log") - .stderr_matches_path("tests/snapshots/init/bin_already_exists_explicit_nosrc/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/bin_already_exists_explicit_nosrc/out", - project_root, - ); - assert!(!project_root.join("src").is_dir()); -} - -#[cargo_test] -fn bin_already_exists_implicit_nosrc() { - let project = - Project::from_template("tests/snapshots/init/bin_already_exists_implicit_nosrc/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/bin_already_exists_implicit_nosrc/stdout.log") - .stderr_matches_path("tests/snapshots/init/bin_already_exists_implicit_nosrc/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/bin_already_exists_implicit_nosrc/out", - project_root, - ); - assert!(!project_root.join("src").is_dir()); -} - -#[cargo_test] -fn bin_already_exists_implicit_namenosrc() { - let project = - Project::from_template("tests/snapshots/init/bin_already_exists_implicit_namenosrc/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path( - "tests/snapshots/init/bin_already_exists_implicit_namenosrc/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/init/bin_already_exists_implicit_namenosrc/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/init/bin_already_exists_implicit_namenosrc/out", - project_root, - ); - assert!(!project_root.join("src").is_dir()); -} - -#[cargo_test] -fn bin_already_exists_implicit_namesrc() { - let project = - Project::from_template("tests/snapshots/init/bin_already_exists_implicit_namesrc/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/bin_already_exists_implicit_namesrc/stdout.log") - .stderr_matches_path("tests/snapshots/init/bin_already_exists_implicit_namesrc/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/bin_already_exists_implicit_namesrc/out", - project_root, - ); - assert!(!project_root.join("src/main.rs").is_file()); -} - -#[cargo_test] -fn confused_by_multiple_lib_files() { - let project = Project::from_template("tests/snapshots/init/confused_by_multiple_lib_files/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs none") - .current_dir(project_root) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/init/confused_by_multiple_lib_files/stdout.log") - .stderr_matches_path("tests/snapshots/init/confused_by_multiple_lib_files/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/confused_by_multiple_lib_files/out", - project_root, - ); - assert!(!project_root.join("Cargo.toml").is_file()); -} - -#[cargo_test] -fn multibin_project_name_clash() { - let project = Project::from_template("tests/snapshots/init/multibin_project_name_clash/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --vcs none") - .current_dir(project_root) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/init/multibin_project_name_clash/stdout.log") - .stderr_matches_path("tests/snapshots/init/multibin_project_name_clash/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/multibin_project_name_clash/out", - project_root, - ); - assert!(!project_root.join("Cargo.toml").is_file()); -} - -#[cargo_test] -fn lib_already_exists_src() { - let project = Project::from_template("tests/snapshots/init/lib_already_exists_src/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/lib_already_exists_src/stdout.log") - .stderr_matches_path("tests/snapshots/init/lib_already_exists_src/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/lib_already_exists_src/out", - project_root, - ); - assert!(!project_root.join("src/main.rs").is_file()); -} - -#[cargo_test] -fn lib_already_exists_nosrc() { - let project = Project::from_template("tests/snapshots/init/lib_already_exists_nosrc/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/lib_already_exists_nosrc/stdout.log") - .stderr_matches_path("tests/snapshots/init/lib_already_exists_nosrc/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/lib_already_exists_nosrc/out", - project_root, - ); - assert!(!project_root.join("src/main.rs").is_file()); -} - -#[cargo_test] -fn simple_git() { - let project = Project::from_template("tests/snapshots/init/simple_git/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --vcs git") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/simple_git/stdout.log") - .stderr_matches_path("tests/snapshots/init/simple_git/stderr.log"); - - assert().subset_matches("tests/snapshots/init/simple_git/out", project_root); - assert!(project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn auto_git() { - let project = Project::from_template("tests/snapshots/init/auto_git/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/auto_git/stdout.log") - .stderr_matches_path("tests/snapshots/init/auto_git/stderr.log"); - - assert().subset_matches("tests/snapshots/init/auto_git/out", &project_root); - assert!(project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn invalid_dir_name() { - let foo = &paths::root().join("foo.bar"); - fs::create_dir_all(foo).unwrap(); - - snapbox::cmd::Command::cargo() - .arg_line("init") - .current_dir(foo) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/init/invalid_dir_name/stdout.log") - .stderr_matches_path("tests/snapshots/init/invalid_dir_name/stderr.log"); - - assert!(!foo.join("Cargo.toml").is_file()); -} - -#[cargo_test] -fn reserved_name() { - let project_root = &paths::root().join("test"); - fs::create_dir_all(project_root).unwrap(); - - snapbox::cmd::Command::cargo() - .arg_line("init") - .current_dir(project_root) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/init/reserved_name/stdout.log") - .stderr_matches_path("tests/snapshots/init/reserved_name/stderr.log"); - - assert!(!project_root.join("Cargo.toml").is_file()); -} - -#[cargo_test] -fn git_autodetect() { - 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() - .arg_line("init --lib") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/git_autodetect/stdout.log") - .stderr_matches_path("tests/snapshots/init/git_autodetect/stderr.log"); - - assert().subset_matches("tests/snapshots/init/git_autodetect/out", project_root); - assert!(project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn mercurial_autodetect() { - let project = Project::from_template("tests/snapshots/init/mercurial_autodetect/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/mercurial_autodetect/stdout.log") - .stderr_matches_path("tests/snapshots/init/mercurial_autodetect/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/mercurial_autodetect/out", - project_root, - ); - assert!(!project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn fossil_autodetect() { - let project = Project::from_template("tests/snapshots/init/fossil_autodetect/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/fossil_autodetect/stdout.log") - .stderr_matches_path("tests/snapshots/init/fossil_autodetect/stderr.log"); - - assert().subset_matches("tests/snapshots/init/fossil_autodetect/out", project_root); - assert!(!project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn pijul_autodetect() { - let project = Project::from_template("tests/snapshots/init/pijul_autodetect/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/pijul_autodetect/stdout.log") - .stderr_matches_path("tests/snapshots/init/pijul_autodetect/stderr.log"); - - assert().subset_matches("tests/snapshots/init/pijul_autodetect/out", project_root); - assert!(!project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn simple_hg() { - if !mercurial_available() { - return; - } - - let project = Project::from_template("tests/snapshots/init/simple_hg/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --vcs hg") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/simple_hg/stdout.log") - .stderr_matches_path("tests/snapshots/init/simple_hg/stderr.log"); - - assert().subset_matches("tests/snapshots/init/simple_hg/out", project_root); - assert!(!project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn simple_hg_ignore_exists() { - let project = Project::from_template("tests/snapshots/init/simple_hg_ignore_exists/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/simple_hg_ignore_exists/stdout.log") - .stderr_matches_path("tests/snapshots/init/simple_hg_ignore_exists/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/simple_hg_ignore_exists/out", - project_root, - ); - assert!(!project_root.join(".git").is_dir()); -} - -#[cargo_test] -fn inferred_lib_with_git() { - let project = Project::from_template("tests/snapshots/init/inferred_lib_with_git/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs git") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/inferred_lib_with_git/stdout.log") - .stderr_matches_path("tests/snapshots/init/inferred_lib_with_git/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/inferred_lib_with_git/out", - project_root, - ); -} - -#[cargo_test] -fn explicit_bin_with_git() { - let project = Project::from_template("tests/snapshots/init/explicit_bin_with_git/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs git --bin") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/explicit_bin_with_git/stdout.log") - .stderr_matches_path("tests/snapshots/init/explicit_bin_with_git/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/explicit_bin_with_git/out", - project_root, - ); -} - -#[cargo_test] -fn inferred_bin_with_git() { - let project = Project::from_template("tests/snapshots/init/inferred_bin_with_git/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --vcs git") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/inferred_bin_with_git/stdout.log") - .stderr_matches_path("tests/snapshots/init/inferred_bin_with_git/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/inferred_bin_with_git/out", - project_root, - ); -} - -#[cargo_test] -fn with_argument() { - let project = Project::from_template("tests/snapshots/init/with_argument/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init foo --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/with_argument/stdout.log") - .stderr_matches_path("tests/snapshots/init/with_argument/stderr.log"); - - assert().subset_matches("tests/snapshots/init/with_argument/out", project_root); -} - -#[cargo_test] -fn unknown_flags() { - snapbox::cmd::Command::cargo() - .arg_line("init foo --flag") - .current_dir(paths::root()) - .assert() - .code(1) - .stdout_matches_path("tests/snapshots/init/unknown_flags/stdout.log") - .stderr_matches_path("tests/snapshots/init/unknown_flags/stderr.log"); -} - -#[cfg(not(windows))] -#[cargo_test] -fn no_filename() { - snapbox::cmd::Command::cargo() - .arg_line("init /") - .current_dir(paths::root()) - .assert() - .code(101) - .stdout_matches_path("tests/snapshots/init/no_filename/stdout.log") - .stderr_matches_path("tests/snapshots/init/no_filename/stderr.log"); -} - -#[cargo_test] -fn formats_source() { - if !command_is_available("rustfmt") { - return; - } - - let project = Project::from_template("tests/snapshots/init/formats_source/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/formats_source/stdout.log") - .stderr_matches_path("tests/snapshots/init/formats_source/stderr.log"); - - assert().subset_matches("tests/snapshots/init/formats_source/out", project_root); -} - -#[cargo_test] -fn ignores_failure_to_format_source() { - let project = - Project::from_template("tests/snapshots/init/ignores_failure_to_format_source/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --vcs none") - .env("PATH", "") // pretend that `rustfmt` is missing - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path("tests/snapshots/init/ignores_failure_to_format_source/stdout.log") - .stderr_matches_path("tests/snapshots/init/ignores_failure_to_format_source/stderr.log"); - - assert().subset_matches( - "tests/snapshots/init/ignores_failure_to_format_source/out", - project_root, - ); -} - -#[cargo_test] -fn creates_binary_when_instructed_and_has_lib_file() { - let project = Project::from_template( - "tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/in", - ); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --bin --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path( - "tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/out", - project_root, - ); -} - -#[cargo_test] -fn creates_library_when_instructed_and_has_bin_file() { - let project = Project::from_template( - "tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/in", - ); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path( - "tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/out", - project_root, - ); -} - -#[cargo_test] -fn creates_binary_when_both_binlib_present() { - let project = - Project::from_template("tests/snapshots/init/creates_binary_when_both_binlib_present/in"); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --bin --vcs none") - .current_dir(project_root) - .assert() - .success() - .stdout_matches_path( - "tests/snapshots/init/creates_binary_when_both_binlib_present/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/init/creates_binary_when_both_binlib_present/stderr.log", - ); - - assert().subset_matches( - "tests/snapshots/init/creates_binary_when_both_binlib_present/out", - project_root, - ); -} - -#[cargo_test] -fn cant_create_library_when_both_binlib_present() { - let project = Project::from_template( - "tests/snapshots/init/cant_create_library_when_both_binlib_present/in", - ); - let project_root = &project.root(); - - snapbox::cmd::Command::cargo() - .arg_line("init --lib") - .current_dir(project_root) - .assert() - .code(101) - .stdout_matches_path( - "tests/snapshots/init/cant_create_library_when_both_binlib_present/stdout.log", - ) - .stderr_matches_path( - "tests/snapshots/init/cant_create_library_when_both_binlib_present/stderr.log", - ); -} diff --git a/tests/testsuite/init/auto_git/in b/tests/testsuite/init/auto_git/in new file mode 120000 index 00000000000..1202506b654 --- /dev/null +++ b/tests/testsuite/init/auto_git/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/tests/testsuite/init/auto_git/mod.rs b/tests/testsuite/init/auto_git/mod.rs new file mode 100644 index 00000000000..f679634dd3b --- /dev/null +++ b/tests/testsuite/init/auto_git/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn auto_git() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), &project_root); + assert!(project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/auto_git/out/.gitignore b/tests/testsuite/init/auto_git/out/.gitignore similarity index 100% rename from tests/snapshots/init/auto_git/out/.gitignore rename to tests/testsuite/init/auto_git/out/.gitignore diff --git a/tests/snapshots/init/auto_git/out/Cargo.toml b/tests/testsuite/init/auto_git/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/auto_git/out/Cargo.toml rename to tests/testsuite/init/auto_git/out/Cargo.toml diff --git a/tests/snapshots/init/auto_git/out/src/lib.rs b/tests/testsuite/init/auto_git/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/auto_git/out/src/lib.rs rename to tests/testsuite/init/auto_git/out/src/lib.rs diff --git a/tests/snapshots/init/auto_git/stderr.log b/tests/testsuite/init/auto_git/stderr.log similarity index 100% rename from tests/snapshots/init/auto_git/stderr.log rename to tests/testsuite/init/auto_git/stderr.log diff --git a/tests/snapshots/init/auto_git/stdout.log b/tests/testsuite/init/auto_git/stdout.log similarity index 100% rename from tests/snapshots/init/auto_git/stdout.log rename to tests/testsuite/init/auto_git/stdout.log diff --git a/tests/snapshots/init/bin_already_exists_explicit/in/src/main.rs b/tests/testsuite/init/bin_already_exists_explicit/in/src/main.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit/in/src/main.rs rename to tests/testsuite/init/bin_already_exists_explicit/in/src/main.rs diff --git a/tests/testsuite/init/bin_already_exists_explicit/mod.rs b/tests/testsuite/init/bin_already_exists_explicit/mod.rs new file mode 100644 index 00000000000..fca4d5b190f --- /dev/null +++ b/tests/testsuite/init/bin_already_exists_explicit/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn bin_already_exists_explicit() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/bin_already_exists_explicit/out/Cargo.toml b/tests/testsuite/init/bin_already_exists_explicit/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit/out/Cargo.toml rename to tests/testsuite/init/bin_already_exists_explicit/out/Cargo.toml diff --git a/tests/snapshots/init/bin_already_exists_explicit/out/src/main.rs b/tests/testsuite/init/bin_already_exists_explicit/out/src/main.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit/out/src/main.rs rename to tests/testsuite/init/bin_already_exists_explicit/out/src/main.rs diff --git a/tests/snapshots/init/bin_already_exists_explicit/stderr.log b/tests/testsuite/init/bin_already_exists_explicit/stderr.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit/stderr.log rename to tests/testsuite/init/bin_already_exists_explicit/stderr.log diff --git a/tests/snapshots/init/bin_already_exists_explicit/stdout.log b/tests/testsuite/init/bin_already_exists_explicit/stdout.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit/stdout.log rename to tests/testsuite/init/bin_already_exists_explicit/stdout.log diff --git a/tests/snapshots/init/bin_already_exists_explicit_nosrc/in/main.rs b/tests/testsuite/init/bin_already_exists_explicit_nosrc/in/main.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit_nosrc/in/main.rs rename to tests/testsuite/init/bin_already_exists_explicit_nosrc/in/main.rs diff --git a/tests/testsuite/init/bin_already_exists_explicit_nosrc/mod.rs b/tests/testsuite/init/bin_already_exists_explicit_nosrc/mod.rs new file mode 100644 index 00000000000..35f72cf66a5 --- /dev/null +++ b/tests/testsuite/init/bin_already_exists_explicit_nosrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn bin_already_exists_explicit_nosrc() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join("src").is_dir()); +} diff --git a/tests/snapshots/init/bin_already_exists_explicit_nosrc/out/Cargo.toml b/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit_nosrc/out/Cargo.toml rename to tests/testsuite/init/bin_already_exists_explicit_nosrc/out/Cargo.toml diff --git a/tests/snapshots/init/bin_already_exists_explicit_nosrc/out/main.rs b/tests/testsuite/init/bin_already_exists_explicit_nosrc/out/main.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit_nosrc/out/main.rs rename to tests/testsuite/init/bin_already_exists_explicit_nosrc/out/main.rs diff --git a/tests/snapshots/init/bin_already_exists_explicit_nosrc/stderr.log b/tests/testsuite/init/bin_already_exists_explicit_nosrc/stderr.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit_nosrc/stderr.log rename to tests/testsuite/init/bin_already_exists_explicit_nosrc/stderr.log diff --git a/tests/snapshots/init/bin_already_exists_explicit_nosrc/stdout.log b/tests/testsuite/init/bin_already_exists_explicit_nosrc/stdout.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_explicit_nosrc/stdout.log rename to tests/testsuite/init/bin_already_exists_explicit_nosrc/stdout.log diff --git a/tests/snapshots/init/bin_already_exists_implicit/in/src/main.rs b/tests/testsuite/init/bin_already_exists_implicit/in/src/main.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit/in/src/main.rs rename to tests/testsuite/init/bin_already_exists_implicit/in/src/main.rs diff --git a/tests/testsuite/init/bin_already_exists_implicit/mod.rs b/tests/testsuite/init/bin_already_exists_implicit/mod.rs new file mode 100644 index 00000000000..c9f72902e18 --- /dev/null +++ b/tests/testsuite/init/bin_already_exists_implicit/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn bin_already_exists_implicit() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/bin_already_exists_implicit/out/Cargo.toml b/tests/testsuite/init/bin_already_exists_implicit/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit/out/Cargo.toml rename to tests/testsuite/init/bin_already_exists_implicit/out/Cargo.toml diff --git a/tests/snapshots/init/bin_already_exists_implicit/out/src/main.rs b/tests/testsuite/init/bin_already_exists_implicit/out/src/main.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit/out/src/main.rs rename to tests/testsuite/init/bin_already_exists_implicit/out/src/main.rs diff --git a/tests/snapshots/init/bin_already_exists_implicit/stderr.log b/tests/testsuite/init/bin_already_exists_implicit/stderr.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit/stderr.log rename to tests/testsuite/init/bin_already_exists_implicit/stderr.log diff --git a/tests/snapshots/init/bin_already_exists_implicit/stdout.log b/tests/testsuite/init/bin_already_exists_implicit/stdout.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit/stdout.log rename to tests/testsuite/init/bin_already_exists_implicit/stdout.log diff --git a/tests/snapshots/init/bin_already_exists_implicit_namenosrc/in/case.rs b/tests/testsuite/init/bin_already_exists_implicit_namenosrc/in/case.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namenosrc/in/case.rs rename to tests/testsuite/init/bin_already_exists_implicit_namenosrc/in/case.rs diff --git a/tests/testsuite/init/bin_already_exists_implicit_namenosrc/mod.rs b/tests/testsuite/init/bin_already_exists_implicit_namenosrc/mod.rs new file mode 100644 index 00000000000..1d6c383bfd6 --- /dev/null +++ b/tests/testsuite/init/bin_already_exists_implicit_namenosrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn bin_already_exists_implicit_namenosrc() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join("src").is_dir()); +} diff --git a/tests/snapshots/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml b/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml rename to tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/Cargo.toml diff --git a/tests/snapshots/init/bin_already_exists_implicit_namenosrc/out/case.rs b/tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/case.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namenosrc/out/case.rs rename to tests/testsuite/init/bin_already_exists_implicit_namenosrc/out/case.rs diff --git a/tests/snapshots/init/bin_already_exists_implicit_namenosrc/stderr.log b/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stderr.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namenosrc/stderr.log rename to tests/testsuite/init/bin_already_exists_implicit_namenosrc/stderr.log diff --git a/tests/snapshots/init/bin_already_exists_implicit_namenosrc/stdout.log b/tests/testsuite/init/bin_already_exists_implicit_namenosrc/stdout.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namenosrc/stdout.log rename to tests/testsuite/init/bin_already_exists_implicit_namenosrc/stdout.log diff --git a/tests/snapshots/init/bin_already_exists_implicit_namesrc/in/src/case.rs b/tests/testsuite/init/bin_already_exists_implicit_namesrc/in/src/case.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namesrc/in/src/case.rs rename to tests/testsuite/init/bin_already_exists_implicit_namesrc/in/src/case.rs diff --git a/tests/testsuite/init/bin_already_exists_implicit_namesrc/mod.rs b/tests/testsuite/init/bin_already_exists_implicit_namesrc/mod.rs new file mode 100644 index 00000000000..dd1f0dd8dc2 --- /dev/null +++ b/tests/testsuite/init/bin_already_exists_implicit_namesrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn bin_already_exists_implicit_namesrc() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join("src/main.rs").is_file()); +} diff --git a/tests/snapshots/init/bin_already_exists_implicit_namesrc/out/Cargo.toml b/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namesrc/out/Cargo.toml rename to tests/testsuite/init/bin_already_exists_implicit_namesrc/out/Cargo.toml diff --git a/tests/snapshots/init/bin_already_exists_implicit_namesrc/out/src/case.rs b/tests/testsuite/init/bin_already_exists_implicit_namesrc/out/src/case.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namesrc/out/src/case.rs rename to tests/testsuite/init/bin_already_exists_implicit_namesrc/out/src/case.rs diff --git a/tests/snapshots/init/bin_already_exists_implicit_namesrc/stderr.log b/tests/testsuite/init/bin_already_exists_implicit_namesrc/stderr.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namesrc/stderr.log rename to tests/testsuite/init/bin_already_exists_implicit_namesrc/stderr.log diff --git a/tests/snapshots/init/bin_already_exists_implicit_namesrc/stdout.log b/tests/testsuite/init/bin_already_exists_implicit_namesrc/stdout.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_namesrc/stdout.log rename to tests/testsuite/init/bin_already_exists_implicit_namesrc/stdout.log diff --git a/tests/snapshots/init/bin_already_exists_implicit_nosrc/in/main.rs b/tests/testsuite/init/bin_already_exists_implicit_nosrc/in/main.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_nosrc/in/main.rs rename to tests/testsuite/init/bin_already_exists_implicit_nosrc/in/main.rs diff --git a/tests/testsuite/init/bin_already_exists_implicit_nosrc/mod.rs b/tests/testsuite/init/bin_already_exists_implicit_nosrc/mod.rs new file mode 100644 index 00000000000..1e0c2efafa2 --- /dev/null +++ b/tests/testsuite/init/bin_already_exists_implicit_nosrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn bin_already_exists_implicit_nosrc() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join("src").is_dir()); +} diff --git a/tests/snapshots/init/bin_already_exists_implicit_nosrc/out/Cargo.toml b/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_nosrc/out/Cargo.toml rename to tests/testsuite/init/bin_already_exists_implicit_nosrc/out/Cargo.toml diff --git a/tests/snapshots/init/bin_already_exists_implicit_nosrc/out/main.rs b/tests/testsuite/init/bin_already_exists_implicit_nosrc/out/main.rs similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_nosrc/out/main.rs rename to tests/testsuite/init/bin_already_exists_implicit_nosrc/out/main.rs diff --git a/tests/snapshots/init/bin_already_exists_implicit_nosrc/stderr.log b/tests/testsuite/init/bin_already_exists_implicit_nosrc/stderr.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_nosrc/stderr.log rename to tests/testsuite/init/bin_already_exists_implicit_nosrc/stderr.log diff --git a/tests/snapshots/init/bin_already_exists_implicit_nosrc/stdout.log b/tests/testsuite/init/bin_already_exists_implicit_nosrc/stdout.log similarity index 100% rename from tests/snapshots/init/bin_already_exists_implicit_nosrc/stdout.log rename to tests/testsuite/init/bin_already_exists_implicit_nosrc/stdout.log diff --git a/tests/testsuite/init/both_lib_and_bin/mod.rs b/tests/testsuite/init/both_lib_and_bin/mod.rs new file mode 100644 index 00000000000..7bfac51054b --- /dev/null +++ b/tests/testsuite/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 both_lib_and_bin() { + let cwd = paths::root(); + + snapbox::cmd::Command::cargo() + .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/tests/snapshots/init/both_lib_and_bin/stderr.log b/tests/testsuite/init/both_lib_and_bin/stderr.log similarity index 100% rename from tests/snapshots/init/both_lib_and_bin/stderr.log rename to tests/testsuite/init/both_lib_and_bin/stderr.log diff --git a/tests/snapshots/init/both_lib_and_bin/stdout.log b/tests/testsuite/init/both_lib_and_bin/stdout.log similarity index 100% rename from tests/snapshots/init/both_lib_and_bin/stdout.log rename to tests/testsuite/init/both_lib_and_bin/stdout.log diff --git a/tests/snapshots/init/cant_create_library_when_both_binlib_present/in/case.rs b/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/case.rs similarity index 100% rename from tests/snapshots/init/cant_create_library_when_both_binlib_present/in/case.rs rename to tests/testsuite/init/cant_create_library_when_both_binlib_present/in/case.rs diff --git a/tests/snapshots/init/cant_create_library_when_both_binlib_present/in/lib.rs b/tests/testsuite/init/cant_create_library_when_both_binlib_present/in/lib.rs similarity index 100% rename from tests/snapshots/init/cant_create_library_when_both_binlib_present/in/lib.rs rename to tests/testsuite/init/cant_create_library_when_both_binlib_present/in/lib.rs diff --git a/tests/testsuite/init/cant_create_library_when_both_binlib_present/mod.rs b/tests/testsuite/init/cant_create_library_when_both_binlib_present/mod.rs new file mode 100644 index 00000000000..0dde10df74f --- /dev/null +++ b/tests/testsuite/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 cant_create_library_when_both_binlib_present() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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/tests/snapshots/init/cant_create_library_when_both_binlib_present/stderr.log b/tests/testsuite/init/cant_create_library_when_both_binlib_present/stderr.log similarity index 100% rename from tests/snapshots/init/cant_create_library_when_both_binlib_present/stderr.log rename to tests/testsuite/init/cant_create_library_when_both_binlib_present/stderr.log diff --git a/tests/snapshots/init/cant_create_library_when_both_binlib_present/stdout.log b/tests/testsuite/init/cant_create_library_when_both_binlib_present/stdout.log similarity index 100% rename from tests/snapshots/init/cant_create_library_when_both_binlib_present/stdout.log rename to tests/testsuite/init/cant_create_library_when_both_binlib_present/stdout.log diff --git a/tests/snapshots/init/confused_by_multiple_lib_files/in/lib.rs b/tests/testsuite/init/confused_by_multiple_lib_files/in/lib.rs similarity index 100% rename from tests/snapshots/init/confused_by_multiple_lib_files/in/lib.rs rename to tests/testsuite/init/confused_by_multiple_lib_files/in/lib.rs diff --git a/tests/snapshots/init/confused_by_multiple_lib_files/in/src/lib.rs b/tests/testsuite/init/confused_by_multiple_lib_files/in/src/lib.rs similarity index 100% rename from tests/snapshots/init/confused_by_multiple_lib_files/in/src/lib.rs rename to tests/testsuite/init/confused_by_multiple_lib_files/in/src/lib.rs diff --git a/tests/testsuite/init/confused_by_multiple_lib_files/mod.rs b/tests/testsuite/init/confused_by_multiple_lib_files/mod.rs new file mode 100644 index 00000000000..dbcfd6360f8 --- /dev/null +++ b/tests/testsuite/init/confused_by_multiple_lib_files/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn confused_by_multiple_lib_files() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join("Cargo.toml").is_file()); +} diff --git a/tests/snapshots/init/confused_by_multiple_lib_files/out/lib.rs b/tests/testsuite/init/confused_by_multiple_lib_files/out/lib.rs similarity index 100% rename from tests/snapshots/init/confused_by_multiple_lib_files/out/lib.rs rename to tests/testsuite/init/confused_by_multiple_lib_files/out/lib.rs diff --git a/tests/snapshots/init/confused_by_multiple_lib_files/out/src/lib.rs b/tests/testsuite/init/confused_by_multiple_lib_files/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/confused_by_multiple_lib_files/out/src/lib.rs rename to tests/testsuite/init/confused_by_multiple_lib_files/out/src/lib.rs diff --git a/tests/snapshots/init/confused_by_multiple_lib_files/stderr.log b/tests/testsuite/init/confused_by_multiple_lib_files/stderr.log similarity index 100% rename from tests/snapshots/init/confused_by_multiple_lib_files/stderr.log rename to tests/testsuite/init/confused_by_multiple_lib_files/stderr.log diff --git a/tests/snapshots/init/confused_by_multiple_lib_files/stdout.log b/tests/testsuite/init/confused_by_multiple_lib_files/stdout.log similarity index 100% rename from tests/snapshots/init/confused_by_multiple_lib_files/stdout.log rename to tests/testsuite/init/confused_by_multiple_lib_files/stdout.log diff --git a/tests/snapshots/init/creates_binary_when_both_binlib_present/in/case.rs b/tests/testsuite/init/creates_binary_when_both_binlib_present/in/case.rs similarity index 100% rename from tests/snapshots/init/creates_binary_when_both_binlib_present/in/case.rs rename to tests/testsuite/init/creates_binary_when_both_binlib_present/in/case.rs diff --git a/tests/snapshots/init/creates_binary_when_both_binlib_present/in/lib.rs b/tests/testsuite/init/creates_binary_when_both_binlib_present/in/lib.rs similarity index 100% rename from tests/snapshots/init/creates_binary_when_both_binlib_present/in/lib.rs rename to tests/testsuite/init/creates_binary_when_both_binlib_present/in/lib.rs diff --git a/tests/testsuite/init/creates_binary_when_both_binlib_present/mod.rs b/tests/testsuite/init/creates_binary_when_both_binlib_present/mod.rs new file mode 100644 index 00000000000..afd0c2ba542 --- /dev/null +++ b/tests/testsuite/init/creates_binary_when_both_binlib_present/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn creates_binary_when_both_binlib_present() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/creates_binary_when_both_binlib_present/out/Cargo.toml b/tests/testsuite/init/creates_binary_when_both_binlib_present/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/creates_binary_when_both_binlib_present/out/Cargo.toml rename to tests/testsuite/init/creates_binary_when_both_binlib_present/out/Cargo.toml diff --git a/tests/snapshots/init/creates_binary_when_both_binlib_present/out/case.rs b/tests/testsuite/init/creates_binary_when_both_binlib_present/out/case.rs similarity index 100% rename from tests/snapshots/init/creates_binary_when_both_binlib_present/out/case.rs rename to tests/testsuite/init/creates_binary_when_both_binlib_present/out/case.rs diff --git a/tests/snapshots/init/creates_binary_when_both_binlib_present/out/lib.rs b/tests/testsuite/init/creates_binary_when_both_binlib_present/out/lib.rs similarity index 100% rename from tests/snapshots/init/creates_binary_when_both_binlib_present/out/lib.rs rename to tests/testsuite/init/creates_binary_when_both_binlib_present/out/lib.rs diff --git a/tests/snapshots/init/creates_binary_when_both_binlib_present/stderr.log b/tests/testsuite/init/creates_binary_when_both_binlib_present/stderr.log similarity index 100% rename from tests/snapshots/init/creates_binary_when_both_binlib_present/stderr.log rename to tests/testsuite/init/creates_binary_when_both_binlib_present/stderr.log diff --git a/tests/snapshots/init/creates_binary_when_both_binlib_present/stdout.log b/tests/testsuite/init/creates_binary_when_both_binlib_present/stdout.log similarity index 100% rename from tests/snapshots/init/creates_binary_when_both_binlib_present/stdout.log rename to tests/testsuite/init/creates_binary_when_both_binlib_present/stdout.log diff --git a/tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs b/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs similarity index 100% rename from tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs rename to tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/in/case.rs diff --git a/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/mod.rs b/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/mod.rs new file mode 100644 index 00000000000..d06ec74d1c6 --- /dev/null +++ b/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn creates_binary_when_instructed_and_has_lib_file() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml b/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml rename to tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/Cargo.toml diff --git a/tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs b/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs similarity index 100% rename from tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs rename to tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/out/case.rs diff --git a/tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/stderr.log b/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stderr.log similarity index 100% rename from tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/stderr.log rename to tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stderr.log diff --git a/tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/stdout.log b/tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stdout.log similarity index 100% rename from tests/snapshots/init/creates_binary_when_instructed_and_has_lib_file/stdout.log rename to tests/testsuite/init/creates_binary_when_instructed_and_has_lib_file/stdout.log diff --git a/tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/in/case.rs b/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/in/case.rs similarity index 100% rename from tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/in/case.rs rename to tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/in/case.rs diff --git a/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/mod.rs b/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/mod.rs new file mode 100644 index 00000000000..baafe71af9e --- /dev/null +++ b/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn creates_library_when_instructed_and_has_bin_file() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml b/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml rename to tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/Cargo.toml diff --git a/tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/out/case.rs b/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/case.rs similarity index 100% rename from tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/out/case.rs rename to tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/out/case.rs diff --git a/tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/stderr.log b/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stderr.log similarity index 100% rename from tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/stderr.log rename to tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stderr.log diff --git a/tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/stdout.log b/tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stdout.log similarity index 100% rename from tests/snapshots/init/creates_library_when_instructed_and_has_bin_file/stdout.log rename to tests/testsuite/init/creates_library_when_instructed_and_has_bin_file/stdout.log diff --git a/tests/snapshots/init/empty-dir/.keep b/tests/testsuite/init/empty_dir/.keep similarity index 100% rename from tests/snapshots/init/empty-dir/.keep rename to tests/testsuite/init/empty_dir/.keep diff --git a/tests/testsuite/init/empty_dir/mod.rs b/tests/testsuite/init/empty_dir/mod.rs new file mode 100644 index 00000000000..f52a32d0a05 --- /dev/null +++ b/tests/testsuite/init/empty_dir/mod.rs @@ -0,0 +1,7 @@ +use cargo_test_support::compare::assert; +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/tests/testsuite/init/explicit_bin_with_git/in b/tests/testsuite/init/explicit_bin_with_git/in new file mode 120000 index 00000000000..1202506b654 --- /dev/null +++ b/tests/testsuite/init/explicit_bin_with_git/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/tests/testsuite/init/explicit_bin_with_git/mod.rs b/tests/testsuite/init/explicit_bin_with_git/mod.rs new file mode 100644 index 00000000000..93661fbf2c8 --- /dev/null +++ b/tests/testsuite/init/explicit_bin_with_git/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn explicit_bin_with_git() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/explicit_bin_with_git/out/.gitignore b/tests/testsuite/init/explicit_bin_with_git/out/.gitignore similarity index 100% rename from tests/snapshots/init/explicit_bin_with_git/out/.gitignore rename to tests/testsuite/init/explicit_bin_with_git/out/.gitignore diff --git a/tests/snapshots/init/explicit_bin_with_git/out/Cargo.toml b/tests/testsuite/init/explicit_bin_with_git/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/explicit_bin_with_git/out/Cargo.toml rename to tests/testsuite/init/explicit_bin_with_git/out/Cargo.toml diff --git a/tests/snapshots/init/explicit_bin_with_git/out/src/main.rs b/tests/testsuite/init/explicit_bin_with_git/out/src/main.rs similarity index 100% rename from tests/snapshots/init/explicit_bin_with_git/out/src/main.rs rename to tests/testsuite/init/explicit_bin_with_git/out/src/main.rs diff --git a/tests/snapshots/init/explicit_bin_with_git/stderr.log b/tests/testsuite/init/explicit_bin_with_git/stderr.log similarity index 100% rename from tests/snapshots/init/explicit_bin_with_git/stderr.log rename to tests/testsuite/init/explicit_bin_with_git/stderr.log diff --git a/tests/snapshots/init/explicit_bin_with_git/stdout.log b/tests/testsuite/init/explicit_bin_with_git/stdout.log similarity index 100% rename from tests/snapshots/init/explicit_bin_with_git/stdout.log rename to tests/testsuite/init/explicit_bin_with_git/stdout.log diff --git a/tests/snapshots/init/formats_source/in/rustfmt.toml b/tests/testsuite/init/formats_source/in/rustfmt.toml similarity index 100% rename from tests/snapshots/init/formats_source/in/rustfmt.toml rename to tests/testsuite/init/formats_source/in/rustfmt.toml diff --git a/tests/testsuite/init/formats_source/mod.rs b/tests/testsuite/init/formats_source/mod.rs new file mode 100644 index 00000000000..dcde4be0eff --- /dev/null +++ b/tests/testsuite/init/formats_source/mod.rs @@ -0,0 +1,25 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::{command_is_available, Project}; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn formats_source() { + if !command_is_available("rustfmt") { + return; + } + + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/formats_source/out/Cargo.toml b/tests/testsuite/init/formats_source/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/formats_source/out/Cargo.toml rename to tests/testsuite/init/formats_source/out/Cargo.toml diff --git a/tests/snapshots/init/formats_source/out/rustfmt.toml b/tests/testsuite/init/formats_source/out/rustfmt.toml similarity index 100% rename from tests/snapshots/init/formats_source/out/rustfmt.toml rename to tests/testsuite/init/formats_source/out/rustfmt.toml diff --git a/tests/snapshots/init/formats_source/out/src/lib.rs b/tests/testsuite/init/formats_source/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/formats_source/out/src/lib.rs rename to tests/testsuite/init/formats_source/out/src/lib.rs diff --git a/tests/snapshots/init/formats_source/stderr.log b/tests/testsuite/init/formats_source/stderr.log similarity index 100% rename from tests/snapshots/init/formats_source/stderr.log rename to tests/testsuite/init/formats_source/stderr.log diff --git a/tests/snapshots/init/formats_source/stdout.log b/tests/testsuite/init/formats_source/stdout.log similarity index 100% rename from tests/snapshots/init/formats_source/stdout.log rename to tests/testsuite/init/formats_source/stdout.log diff --git a/tests/snapshots/init/fossil_autodetect/in/.fossil/.keep b/tests/testsuite/init/fossil_autodetect/in/.fossil/.keep similarity index 100% rename from tests/snapshots/init/fossil_autodetect/in/.fossil/.keep rename to tests/testsuite/init/fossil_autodetect/in/.fossil/.keep diff --git a/tests/testsuite/init/fossil_autodetect/mod.rs b/tests/testsuite/init/fossil_autodetect/mod.rs new file mode 100644 index 00000000000..f0fd1f4c3dd --- /dev/null +++ b/tests/testsuite/init/fossil_autodetect/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn fossil_autodetect() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/fossil_autodetect/out/.fossil-settings/clean-glob b/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/clean-glob similarity index 100% rename from tests/snapshots/init/fossil_autodetect/out/.fossil-settings/clean-glob rename to tests/testsuite/init/fossil_autodetect/out/.fossil-settings/clean-glob diff --git a/tests/snapshots/init/fossil_autodetect/out/.fossil-settings/ignore-glob b/tests/testsuite/init/fossil_autodetect/out/.fossil-settings/ignore-glob similarity index 100% rename from tests/snapshots/init/fossil_autodetect/out/.fossil-settings/ignore-glob rename to tests/testsuite/init/fossil_autodetect/out/.fossil-settings/ignore-glob diff --git a/tests/snapshots/init/fossil_autodetect/out/Cargo.toml b/tests/testsuite/init/fossil_autodetect/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/fossil_autodetect/out/Cargo.toml rename to tests/testsuite/init/fossil_autodetect/out/Cargo.toml diff --git a/tests/snapshots/init/fossil_autodetect/out/src/lib.rs b/tests/testsuite/init/fossil_autodetect/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/fossil_autodetect/out/src/lib.rs rename to tests/testsuite/init/fossil_autodetect/out/src/lib.rs diff --git a/tests/snapshots/init/fossil_autodetect/stderr.log b/tests/testsuite/init/fossil_autodetect/stderr.log similarity index 100% rename from tests/snapshots/init/fossil_autodetect/stderr.log rename to tests/testsuite/init/fossil_autodetect/stderr.log diff --git a/tests/snapshots/init/fossil_autodetect/stdout.log b/tests/testsuite/init/fossil_autodetect/stdout.log similarity index 100% rename from tests/snapshots/init/fossil_autodetect/stdout.log rename to tests/testsuite/init/fossil_autodetect/stdout.log diff --git a/tests/testsuite/init/git_autodetect/mod.rs b/tests/testsuite/init/git_autodetect/mod.rs new file mode 100644 index 00000000000..529f41b04e5 --- /dev/null +++ b/tests/testsuite/init/git_autodetect/mod.rs @@ -0,0 +1,24 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::paths; +use cargo_test_support::prelude::*; +use std::fs; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_autodetect() { + 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() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/git_autodetect/out/.gitignore b/tests/testsuite/init/git_autodetect/out/.gitignore similarity index 100% rename from tests/snapshots/init/git_autodetect/out/.gitignore rename to tests/testsuite/init/git_autodetect/out/.gitignore diff --git a/tests/snapshots/init/git_autodetect/out/Cargo.toml b/tests/testsuite/init/git_autodetect/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/git_autodetect/out/Cargo.toml rename to tests/testsuite/init/git_autodetect/out/Cargo.toml diff --git a/tests/snapshots/init/git_autodetect/out/src/lib.rs b/tests/testsuite/init/git_autodetect/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/git_autodetect/out/src/lib.rs rename to tests/testsuite/init/git_autodetect/out/src/lib.rs diff --git a/tests/snapshots/init/git_autodetect/stderr.log b/tests/testsuite/init/git_autodetect/stderr.log similarity index 100% rename from tests/snapshots/init/git_autodetect/stderr.log rename to tests/testsuite/init/git_autodetect/stderr.log diff --git a/tests/snapshots/init/git_autodetect/stdout.log b/tests/testsuite/init/git_autodetect/stdout.log similarity index 100% rename from tests/snapshots/init/git_autodetect/stdout.log rename to tests/testsuite/init/git_autodetect/stdout.log diff --git a/tests/snapshots/init/git_ignore_exists_no_conflicting_entries/in/.gitignore b/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/in/.gitignore similarity index 100% rename from tests/snapshots/init/git_ignore_exists_no_conflicting_entries/in/.gitignore rename to tests/testsuite/init/git_ignore_exists_no_conflicting_entries/in/.gitignore diff --git a/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/mod.rs b/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/mod.rs new file mode 100644 index 00000000000..ee227c4ae34 --- /dev/null +++ b/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn git_ignore_exists_no_conflicting_entries() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/git_ignore_exists_no_conflicting_entries/out/.gitignore b/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/.gitignore similarity index 100% rename from tests/snapshots/init/git_ignore_exists_no_conflicting_entries/out/.gitignore rename to tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/.gitignore diff --git a/tests/snapshots/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml b/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml rename to tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/Cargo.toml diff --git a/tests/snapshots/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs b/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs rename to tests/testsuite/init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs diff --git a/tests/snapshots/init/git_ignore_exists_no_conflicting_entries/stderr.log b/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stderr.log similarity index 100% rename from tests/snapshots/init/git_ignore_exists_no_conflicting_entries/stderr.log rename to tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stderr.log diff --git a/tests/snapshots/init/git_ignore_exists_no_conflicting_entries/stdout.log b/tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stdout.log similarity index 100% rename from tests/snapshots/init/git_ignore_exists_no_conflicting_entries/stdout.log rename to tests/testsuite/init/git_ignore_exists_no_conflicting_entries/stdout.log diff --git a/tests/snapshots/init/ignores_failure_to_format_source/in/rustfmt.toml b/tests/testsuite/init/ignores_failure_to_format_source/in/rustfmt.toml similarity index 100% rename from tests/snapshots/init/ignores_failure_to_format_source/in/rustfmt.toml rename to tests/testsuite/init/ignores_failure_to_format_source/in/rustfmt.toml diff --git a/tests/testsuite/init/ignores_failure_to_format_source/mod.rs b/tests/testsuite/init/ignores_failure_to_format_source/mod.rs new file mode 100644 index 00000000000..770189dffaf --- /dev/null +++ b/tests/testsuite/init/ignores_failure_to_format_source/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn ignores_failure_to_format_source() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/ignores_failure_to_format_source/out/Cargo.toml b/tests/testsuite/init/ignores_failure_to_format_source/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/ignores_failure_to_format_source/out/Cargo.toml rename to tests/testsuite/init/ignores_failure_to_format_source/out/Cargo.toml diff --git a/tests/snapshots/init/ignores_failure_to_format_source/out/rustfmt.toml b/tests/testsuite/init/ignores_failure_to_format_source/out/rustfmt.toml similarity index 100% rename from tests/snapshots/init/ignores_failure_to_format_source/out/rustfmt.toml rename to tests/testsuite/init/ignores_failure_to_format_source/out/rustfmt.toml diff --git a/tests/snapshots/init/ignores_failure_to_format_source/out/src/lib.rs b/tests/testsuite/init/ignores_failure_to_format_source/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/ignores_failure_to_format_source/out/src/lib.rs rename to tests/testsuite/init/ignores_failure_to_format_source/out/src/lib.rs diff --git a/tests/snapshots/init/ignores_failure_to_format_source/stderr.log b/tests/testsuite/init/ignores_failure_to_format_source/stderr.log similarity index 100% rename from tests/snapshots/init/ignores_failure_to_format_source/stderr.log rename to tests/testsuite/init/ignores_failure_to_format_source/stderr.log diff --git a/tests/snapshots/init/ignores_failure_to_format_source/stdout.log b/tests/testsuite/init/ignores_failure_to_format_source/stdout.log similarity index 100% rename from tests/snapshots/init/ignores_failure_to_format_source/stdout.log rename to tests/testsuite/init/ignores_failure_to_format_source/stdout.log diff --git a/tests/snapshots/init/inferred_bin_with_git/in/main.rs b/tests/testsuite/init/inferred_bin_with_git/in/main.rs similarity index 100% rename from tests/snapshots/init/inferred_bin_with_git/in/main.rs rename to tests/testsuite/init/inferred_bin_with_git/in/main.rs diff --git a/tests/testsuite/init/inferred_bin_with_git/mod.rs b/tests/testsuite/init/inferred_bin_with_git/mod.rs new file mode 100644 index 00000000000..164ff49205a --- /dev/null +++ b/tests/testsuite/init/inferred_bin_with_git/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn inferred_bin_with_git() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/inferred_bin_with_git/out/.gitignore b/tests/testsuite/init/inferred_bin_with_git/out/.gitignore similarity index 100% rename from tests/snapshots/init/inferred_bin_with_git/out/.gitignore rename to tests/testsuite/init/inferred_bin_with_git/out/.gitignore diff --git a/tests/snapshots/init/inferred_bin_with_git/out/Cargo.toml b/tests/testsuite/init/inferred_bin_with_git/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/inferred_bin_with_git/out/Cargo.toml rename to tests/testsuite/init/inferred_bin_with_git/out/Cargo.toml diff --git a/tests/snapshots/init/inferred_bin_with_git/out/main.rs b/tests/testsuite/init/inferred_bin_with_git/out/main.rs similarity index 100% rename from tests/snapshots/init/inferred_bin_with_git/out/main.rs rename to tests/testsuite/init/inferred_bin_with_git/out/main.rs diff --git a/tests/snapshots/init/implicit_bin_with_git/stderr.log b/tests/testsuite/init/inferred_bin_with_git/stderr.log similarity index 100% rename from tests/snapshots/init/implicit_bin_with_git/stderr.log rename to tests/testsuite/init/inferred_bin_with_git/stderr.log diff --git a/tests/snapshots/init/implicit_bin_with_git/stdout.log b/tests/testsuite/init/inferred_bin_with_git/stdout.log similarity index 100% rename from tests/snapshots/init/implicit_bin_with_git/stdout.log rename to tests/testsuite/init/inferred_bin_with_git/stdout.log diff --git a/tests/snapshots/init/inferred_lib_with_git/in/lib.rs b/tests/testsuite/init/inferred_lib_with_git/in/lib.rs similarity index 100% rename from tests/snapshots/init/inferred_lib_with_git/in/lib.rs rename to tests/testsuite/init/inferred_lib_with_git/in/lib.rs diff --git a/tests/testsuite/init/inferred_lib_with_git/mod.rs b/tests/testsuite/init/inferred_lib_with_git/mod.rs new file mode 100644 index 00000000000..ca475c6d308 --- /dev/null +++ b/tests/testsuite/init/inferred_lib_with_git/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn inferred_lib_with_git() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/inferred_lib_with_git/out/.gitignore b/tests/testsuite/init/inferred_lib_with_git/out/.gitignore similarity index 100% rename from tests/snapshots/init/inferred_lib_with_git/out/.gitignore rename to tests/testsuite/init/inferred_lib_with_git/out/.gitignore diff --git a/tests/snapshots/init/inferred_lib_with_git/out/Cargo.toml b/tests/testsuite/init/inferred_lib_with_git/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/inferred_lib_with_git/out/Cargo.toml rename to tests/testsuite/init/inferred_lib_with_git/out/Cargo.toml diff --git a/tests/snapshots/init/inferred_lib_with_git/out/lib.rs b/tests/testsuite/init/inferred_lib_with_git/out/lib.rs similarity index 100% rename from tests/snapshots/init/inferred_lib_with_git/out/lib.rs rename to tests/testsuite/init/inferred_lib_with_git/out/lib.rs diff --git a/tests/snapshots/init/inferred_lib_with_git/stderr.log b/tests/testsuite/init/inferred_lib_with_git/stderr.log similarity index 100% rename from tests/snapshots/init/inferred_lib_with_git/stderr.log rename to tests/testsuite/init/inferred_lib_with_git/stderr.log diff --git a/tests/snapshots/init/inferred_bin_with_git/stdout.log b/tests/testsuite/init/inferred_lib_with_git/stdout.log similarity index 100% rename from tests/snapshots/init/inferred_bin_with_git/stdout.log rename to tests/testsuite/init/inferred_lib_with_git/stdout.log diff --git a/tests/testsuite/init/invalid_dir_name/mod.rs b/tests/testsuite/init/invalid_dir_name/mod.rs new file mode 100644 index 00000000000..a4d5a62fb4a --- /dev/null +++ b/tests/testsuite/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 invalid_dir_name() { + let foo = &paths::root().join("foo.bar"); + fs::create_dir_all(foo).unwrap(); + + snapbox::cmd::Command::cargo() + .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/tests/snapshots/init/invalid_dir_name/stderr.log b/tests/testsuite/init/invalid_dir_name/stderr.log similarity index 100% rename from tests/snapshots/init/invalid_dir_name/stderr.log rename to tests/testsuite/init/invalid_dir_name/stderr.log diff --git a/tests/snapshots/init/inferred_lib_with_git/stdout.log b/tests/testsuite/init/invalid_dir_name/stdout.log similarity index 100% rename from tests/snapshots/init/inferred_lib_with_git/stdout.log rename to tests/testsuite/init/invalid_dir_name/stdout.log diff --git a/tests/snapshots/init/lib_already_exists_nosrc/in/lib.rs b/tests/testsuite/init/lib_already_exists_nosrc/in/lib.rs similarity index 100% rename from tests/snapshots/init/lib_already_exists_nosrc/in/lib.rs rename to tests/testsuite/init/lib_already_exists_nosrc/in/lib.rs diff --git a/tests/testsuite/init/lib_already_exists_nosrc/mod.rs b/tests/testsuite/init/lib_already_exists_nosrc/mod.rs new file mode 100644 index 00000000000..7309e982e3a --- /dev/null +++ b/tests/testsuite/init/lib_already_exists_nosrc/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn lib_already_exists_nosrc() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join("src/main.rs").is_file()); +} diff --git a/tests/snapshots/init/lib_already_exists_nosrc/out/Cargo.toml b/tests/testsuite/init/lib_already_exists_nosrc/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/lib_already_exists_nosrc/out/Cargo.toml rename to tests/testsuite/init/lib_already_exists_nosrc/out/Cargo.toml diff --git a/tests/snapshots/init/lib_already_exists_nosrc/out/lib.rs b/tests/testsuite/init/lib_already_exists_nosrc/out/lib.rs similarity index 100% rename from tests/snapshots/init/lib_already_exists_nosrc/out/lib.rs rename to tests/testsuite/init/lib_already_exists_nosrc/out/lib.rs diff --git a/tests/snapshots/init/lib_already_exists_nosrc/stderr.log b/tests/testsuite/init/lib_already_exists_nosrc/stderr.log similarity index 100% rename from tests/snapshots/init/lib_already_exists_nosrc/stderr.log rename to tests/testsuite/init/lib_already_exists_nosrc/stderr.log diff --git a/tests/snapshots/init/invalid_dir_name/stdout.log b/tests/testsuite/init/lib_already_exists_nosrc/stdout.log similarity index 100% rename from tests/snapshots/init/invalid_dir_name/stdout.log rename to tests/testsuite/init/lib_already_exists_nosrc/stdout.log diff --git a/tests/snapshots/init/lib_already_exists_src/in/src/lib.rs b/tests/testsuite/init/lib_already_exists_src/in/src/lib.rs similarity index 100% rename from tests/snapshots/init/lib_already_exists_src/in/src/lib.rs rename to tests/testsuite/init/lib_already_exists_src/in/src/lib.rs diff --git a/tests/testsuite/init/lib_already_exists_src/mod.rs b/tests/testsuite/init/lib_already_exists_src/mod.rs new file mode 100644 index 00000000000..c420afa04f3 --- /dev/null +++ b/tests/testsuite/init/lib_already_exists_src/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn lib_already_exists_src() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join("src/main.rs").is_file()); +} diff --git a/tests/snapshots/init/lib_already_exists_src/out/Cargo.toml b/tests/testsuite/init/lib_already_exists_src/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/lib_already_exists_src/out/Cargo.toml rename to tests/testsuite/init/lib_already_exists_src/out/Cargo.toml diff --git a/tests/snapshots/init/lib_already_exists_src/out/src/lib.rs b/tests/testsuite/init/lib_already_exists_src/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/lib_already_exists_src/out/src/lib.rs rename to tests/testsuite/init/lib_already_exists_src/out/src/lib.rs diff --git a/tests/snapshots/init/lib_already_exists_src/stderr.log b/tests/testsuite/init/lib_already_exists_src/stderr.log similarity index 100% rename from tests/snapshots/init/lib_already_exists_src/stderr.log rename to tests/testsuite/init/lib_already_exists_src/stderr.log diff --git a/tests/snapshots/init/lib_already_exists_nosrc/stdout.log b/tests/testsuite/init/lib_already_exists_src/stdout.log similarity index 100% rename from tests/snapshots/init/lib_already_exists_nosrc/stdout.log rename to tests/testsuite/init/lib_already_exists_src/stdout.log diff --git a/tests/snapshots/init/mercurial_autodetect/in/.hg/.keep b/tests/testsuite/init/mercurial_autodetect/in/.hg/.keep similarity index 100% rename from tests/snapshots/init/mercurial_autodetect/in/.hg/.keep rename to tests/testsuite/init/mercurial_autodetect/in/.hg/.keep diff --git a/tests/testsuite/init/mercurial_autodetect/mod.rs b/tests/testsuite/init/mercurial_autodetect/mod.rs new file mode 100644 index 00000000000..76855cc941a --- /dev/null +++ b/tests/testsuite/init/mercurial_autodetect/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn mercurial_autodetect() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/mercurial_autodetect/out/.hgignore b/tests/testsuite/init/mercurial_autodetect/out/.hgignore similarity index 100% rename from tests/snapshots/init/mercurial_autodetect/out/.hgignore rename to tests/testsuite/init/mercurial_autodetect/out/.hgignore diff --git a/tests/snapshots/init/mercurial_autodetect/out/Cargo.toml b/tests/testsuite/init/mercurial_autodetect/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/mercurial_autodetect/out/Cargo.toml rename to tests/testsuite/init/mercurial_autodetect/out/Cargo.toml diff --git a/tests/snapshots/init/mercurial_autodetect/out/src/lib.rs b/tests/testsuite/init/mercurial_autodetect/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/mercurial_autodetect/out/src/lib.rs rename to tests/testsuite/init/mercurial_autodetect/out/src/lib.rs diff --git a/tests/snapshots/init/mercurial_autodetect/stderr.log b/tests/testsuite/init/mercurial_autodetect/stderr.log similarity index 100% rename from tests/snapshots/init/mercurial_autodetect/stderr.log rename to tests/testsuite/init/mercurial_autodetect/stderr.log diff --git a/tests/snapshots/init/lib_already_exists_src/stdout.log b/tests/testsuite/init/mercurial_autodetect/stdout.log similarity index 100% rename from tests/snapshots/init/lib_already_exists_src/stdout.log rename to tests/testsuite/init/mercurial_autodetect/stdout.log diff --git a/tests/testsuite/init/mod.rs b/tests/testsuite/init/mod.rs new file mode 100644 index 00000000000..6e949e8aca1 --- /dev/null +++ b/tests/testsuite/init/mod.rs @@ -0,0 +1,53 @@ +//! Tests for the `cargo init` command. +use std::process::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 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; +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; + +pub fn mercurial_available() -> bool { + let result = Command::new("hg") + .arg("--version") + .output() + .map(|o| o.status.success()) + .unwrap_or(false); + if !result { + println!("`hg` not available, skipping test"); + } + result +} diff --git a/tests/snapshots/init/multibin_project_name_clash/in/case.rs b/tests/testsuite/init/multibin_project_name_clash/in/case.rs similarity index 100% rename from tests/snapshots/init/multibin_project_name_clash/in/case.rs rename to tests/testsuite/init/multibin_project_name_clash/in/case.rs diff --git a/tests/snapshots/init/multibin_project_name_clash/in/main.rs b/tests/testsuite/init/multibin_project_name_clash/in/main.rs similarity index 100% rename from tests/snapshots/init/multibin_project_name_clash/in/main.rs rename to tests/testsuite/init/multibin_project_name_clash/in/main.rs diff --git a/tests/testsuite/init/multibin_project_name_clash/mod.rs b/tests/testsuite/init/multibin_project_name_clash/mod.rs new file mode 100644 index 00000000000..bc3bf2659d0 --- /dev/null +++ b/tests/testsuite/init/multibin_project_name_clash/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn multibin_project_name_clash() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join("Cargo.toml").is_file()); +} diff --git a/tests/snapshots/init/multibin_project_name_clash/out/case.rs b/tests/testsuite/init/multibin_project_name_clash/out/case.rs similarity index 100% rename from tests/snapshots/init/multibin_project_name_clash/out/case.rs rename to tests/testsuite/init/multibin_project_name_clash/out/case.rs diff --git a/tests/snapshots/init/multibin_project_name_clash/out/main.rs b/tests/testsuite/init/multibin_project_name_clash/out/main.rs similarity index 100% rename from tests/snapshots/init/multibin_project_name_clash/out/main.rs rename to tests/testsuite/init/multibin_project_name_clash/out/main.rs diff --git a/tests/snapshots/init/multibin_project_name_clash/stderr.log b/tests/testsuite/init/multibin_project_name_clash/stderr.log similarity index 100% rename from tests/snapshots/init/multibin_project_name_clash/stderr.log rename to tests/testsuite/init/multibin_project_name_clash/stderr.log diff --git a/tests/snapshots/init/mercurial_autodetect/stdout.log b/tests/testsuite/init/multibin_project_name_clash/stdout.log similarity index 100% rename from tests/snapshots/init/mercurial_autodetect/stdout.log rename to tests/testsuite/init/multibin_project_name_clash/stdout.log diff --git a/tests/testsuite/init/no_filename/mod.rs b/tests/testsuite/init/no_filename/mod.rs new file mode 100644 index 00000000000..539892a13ef --- /dev/null +++ b/tests/testsuite/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 no_filename() { + snapbox::cmd::Command::cargo() + .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/tests/snapshots/init/no_filename/stderr.log b/tests/testsuite/init/no_filename/stderr.log similarity index 100% rename from tests/snapshots/init/no_filename/stderr.log rename to tests/testsuite/init/no_filename/stderr.log diff --git a/tests/snapshots/init/multibin_project_name_clash/stdout.log b/tests/testsuite/init/no_filename/stdout.log similarity index 100% rename from tests/snapshots/init/multibin_project_name_clash/stdout.log rename to tests/testsuite/init/no_filename/stdout.log diff --git a/tests/snapshots/init/pijul_autodetect/in/.pijul/.keep b/tests/testsuite/init/pijul_autodetect/in/.pijul/.keep similarity index 100% rename from tests/snapshots/init/pijul_autodetect/in/.pijul/.keep rename to tests/testsuite/init/pijul_autodetect/in/.pijul/.keep diff --git a/tests/testsuite/init/pijul_autodetect/mod.rs b/tests/testsuite/init/pijul_autodetect/mod.rs new file mode 100644 index 00000000000..87686834c95 --- /dev/null +++ b/tests/testsuite/init/pijul_autodetect/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn pijul_autodetect() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/pijul_autodetect/out/.ignore b/tests/testsuite/init/pijul_autodetect/out/.ignore similarity index 100% rename from tests/snapshots/init/pijul_autodetect/out/.ignore rename to tests/testsuite/init/pijul_autodetect/out/.ignore diff --git a/tests/snapshots/init/pijul_autodetect/out/Cargo.toml b/tests/testsuite/init/pijul_autodetect/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/pijul_autodetect/out/Cargo.toml rename to tests/testsuite/init/pijul_autodetect/out/Cargo.toml diff --git a/tests/snapshots/init/pijul_autodetect/out/src/lib.rs b/tests/testsuite/init/pijul_autodetect/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/pijul_autodetect/out/src/lib.rs rename to tests/testsuite/init/pijul_autodetect/out/src/lib.rs diff --git a/tests/snapshots/init/pijul_autodetect/stderr.log b/tests/testsuite/init/pijul_autodetect/stderr.log similarity index 100% rename from tests/snapshots/init/pijul_autodetect/stderr.log rename to tests/testsuite/init/pijul_autodetect/stderr.log diff --git a/tests/snapshots/init/no_filename/stdout.log b/tests/testsuite/init/pijul_autodetect/stdout.log similarity index 100% rename from tests/snapshots/init/no_filename/stdout.log rename to tests/testsuite/init/pijul_autodetect/stdout.log diff --git a/tests/testsuite/init/reserved_name/mod.rs b/tests/testsuite/init/reserved_name/mod.rs new file mode 100644 index 00000000000..db14eb3834f --- /dev/null +++ b/tests/testsuite/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 reserved_name() { + let project_root = &paths::root().join("test"); + fs::create_dir_all(project_root).unwrap(); + + snapbox::cmd::Command::cargo() + .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/tests/snapshots/init/reserved_name/stderr.log b/tests/testsuite/init/reserved_name/stderr.log similarity index 100% rename from tests/snapshots/init/reserved_name/stderr.log rename to tests/testsuite/init/reserved_name/stderr.log diff --git a/tests/snapshots/init/pijul_autodetect/stdout.log b/tests/testsuite/init/reserved_name/stdout.log similarity index 100% rename from tests/snapshots/init/pijul_autodetect/stdout.log rename to tests/testsuite/init/reserved_name/stdout.log diff --git a/tests/testsuite/init/simple_bin/in b/tests/testsuite/init/simple_bin/in new file mode 120000 index 00000000000..1202506b654 --- /dev/null +++ b/tests/testsuite/init/simple_bin/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/tests/testsuite/init/simple_bin/mod.rs b/tests/testsuite/init/simple_bin/mod.rs new file mode 100644 index 00000000000..9e31cc2ae8a --- /dev/null +++ b/tests/testsuite/init/simple_bin/mod.rs @@ -0,0 +1,29 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn simple_bin() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join(".gitignore").is_file()); + + snapbox::cmd::Command::cargo() + .current_dir(project_root) + .arg("build") + .assert() + .success(); + assert!(project.bin("case").is_file()); +} diff --git a/tests/snapshots/init/simple_bin/out/Cargo.toml b/tests/testsuite/init/simple_bin/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/simple_bin/out/Cargo.toml rename to tests/testsuite/init/simple_bin/out/Cargo.toml diff --git a/tests/snapshots/init/simple_bin/out/src/main.rs b/tests/testsuite/init/simple_bin/out/src/main.rs similarity index 100% rename from tests/snapshots/init/simple_bin/out/src/main.rs rename to tests/testsuite/init/simple_bin/out/src/main.rs diff --git a/tests/snapshots/init/inferred_bin_with_git/stderr.log b/tests/testsuite/init/simple_bin/stderr.log similarity index 100% rename from tests/snapshots/init/inferred_bin_with_git/stderr.log rename to tests/testsuite/init/simple_bin/stderr.log diff --git a/tests/snapshots/init/reserved_name/stdout.log b/tests/testsuite/init/simple_bin/stdout.log similarity index 100% rename from tests/snapshots/init/reserved_name/stdout.log rename to tests/testsuite/init/simple_bin/stdout.log diff --git a/tests/testsuite/init/simple_git/in b/tests/testsuite/init/simple_git/in new file mode 120000 index 00000000000..1202506b654 --- /dev/null +++ b/tests/testsuite/init/simple_git/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/tests/testsuite/init/simple_git/mod.rs b/tests/testsuite/init/simple_git/mod.rs new file mode 100644 index 00000000000..56c73229738 --- /dev/null +++ b/tests/testsuite/init/simple_git/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn simple_git() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/simple_git/out/.gitignore b/tests/testsuite/init/simple_git/out/.gitignore similarity index 100% rename from tests/snapshots/init/simple_git/out/.gitignore rename to tests/testsuite/init/simple_git/out/.gitignore diff --git a/tests/snapshots/init/simple_git/out/Cargo.toml b/tests/testsuite/init/simple_git/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/simple_git/out/Cargo.toml rename to tests/testsuite/init/simple_git/out/Cargo.toml diff --git a/tests/snapshots/init/simple_git/out/src/lib.rs b/tests/testsuite/init/simple_git/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/simple_git/out/src/lib.rs rename to tests/testsuite/init/simple_git/out/src/lib.rs diff --git a/tests/snapshots/init/simple_git/stderr.log b/tests/testsuite/init/simple_git/stderr.log similarity index 100% rename from tests/snapshots/init/simple_git/stderr.log rename to tests/testsuite/init/simple_git/stderr.log diff --git a/tests/snapshots/init/simple_bin/stdout.log b/tests/testsuite/init/simple_git/stdout.log similarity index 100% rename from tests/snapshots/init/simple_bin/stdout.log rename to tests/testsuite/init/simple_git/stdout.log diff --git a/tests/snapshots/init/simple_git_ignore_exists/in/.gitignore b/tests/testsuite/init/simple_git_ignore_exists/in/.gitignore similarity index 100% rename from tests/snapshots/init/simple_git_ignore_exists/in/.gitignore rename to tests/testsuite/init/simple_git_ignore_exists/in/.gitignore diff --git a/tests/testsuite/init/simple_git_ignore_exists/mod.rs b/tests/testsuite/init/simple_git_ignore_exists/mod.rs new file mode 100644 index 00000000000..96da9c115fb --- /dev/null +++ b/tests/testsuite/init/simple_git_ignore_exists/mod.rs @@ -0,0 +1,28 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn simple_git_ignore_exists() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(project_root.join(".git").is_dir()); + + snapbox::cmd::Command::cargo() + .current_dir(project_root) + .arg("build") + .assert() + .success(); +} diff --git a/tests/snapshots/init/simple_git_ignore_exists/out/.gitignore b/tests/testsuite/init/simple_git_ignore_exists/out/.gitignore similarity index 100% rename from tests/snapshots/init/simple_git_ignore_exists/out/.gitignore rename to tests/testsuite/init/simple_git_ignore_exists/out/.gitignore diff --git a/tests/snapshots/init/simple_git_ignore_exists/out/Cargo.toml b/tests/testsuite/init/simple_git_ignore_exists/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/simple_git_ignore_exists/out/Cargo.toml rename to tests/testsuite/init/simple_git_ignore_exists/out/Cargo.toml diff --git a/tests/snapshots/init/simple_git_ignore_exists/out/src/lib.rs b/tests/testsuite/init/simple_git_ignore_exists/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/simple_git_ignore_exists/out/src/lib.rs rename to tests/testsuite/init/simple_git_ignore_exists/out/src/lib.rs diff --git a/tests/snapshots/init/simple_git_ignore_exists/stderr.log b/tests/testsuite/init/simple_git_ignore_exists/stderr.log similarity index 100% rename from tests/snapshots/init/simple_git_ignore_exists/stderr.log rename to tests/testsuite/init/simple_git_ignore_exists/stderr.log diff --git a/tests/snapshots/init/simple_git/stdout.log b/tests/testsuite/init/simple_git_ignore_exists/stdout.log similarity index 100% rename from tests/snapshots/init/simple_git/stdout.log rename to tests/testsuite/init/simple_git_ignore_exists/stdout.log diff --git a/tests/testsuite/init/simple_hg/in b/tests/testsuite/init/simple_hg/in new file mode 120000 index 00000000000..1202506b654 --- /dev/null +++ b/tests/testsuite/init/simple_hg/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/tests/testsuite/init/simple_hg/mod.rs b/tests/testsuite/init/simple_hg/mod.rs new file mode 100644 index 00000000000..0ba816ddc4a --- /dev/null +++ b/tests/testsuite/init/simple_hg/mod.rs @@ -0,0 +1,27 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use crate::init::mercurial_available; +use cargo_test_support::curr_dir; + +#[cargo_test] +fn simple_hg() { + if !mercurial_available() { + return; + } + + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/simple_hg/out/.hgignore b/tests/testsuite/init/simple_hg/out/.hgignore similarity index 100% rename from tests/snapshots/init/simple_hg/out/.hgignore rename to tests/testsuite/init/simple_hg/out/.hgignore diff --git a/tests/snapshots/init/simple_hg/out/Cargo.toml b/tests/testsuite/init/simple_hg/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/simple_hg/out/Cargo.toml rename to tests/testsuite/init/simple_hg/out/Cargo.toml diff --git a/tests/snapshots/init/simple_hg/out/src/lib.rs b/tests/testsuite/init/simple_hg/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/simple_hg/out/src/lib.rs rename to tests/testsuite/init/simple_hg/out/src/lib.rs diff --git a/tests/snapshots/init/simple_hg/stderr.log b/tests/testsuite/init/simple_hg/stderr.log similarity index 100% rename from tests/snapshots/init/simple_hg/stderr.log rename to tests/testsuite/init/simple_hg/stderr.log diff --git a/tests/snapshots/init/simple_git_ignore_exists/stdout.log b/tests/testsuite/init/simple_hg/stdout.log similarity index 100% rename from tests/snapshots/init/simple_git_ignore_exists/stdout.log rename to tests/testsuite/init/simple_hg/stdout.log diff --git a/tests/snapshots/init/simple_hg_ignore_exists/in/.hg/.keep b/tests/testsuite/init/simple_hg_ignore_exists/in/.hg/.keep similarity index 100% rename from tests/snapshots/init/simple_hg_ignore_exists/in/.hg/.keep rename to tests/testsuite/init/simple_hg_ignore_exists/in/.hg/.keep diff --git a/tests/snapshots/init/simple_hg_ignore_exists/in/.hgignore b/tests/testsuite/init/simple_hg_ignore_exists/in/.hgignore similarity index 100% rename from tests/snapshots/init/simple_hg_ignore_exists/in/.hgignore rename to tests/testsuite/init/simple_hg_ignore_exists/in/.hgignore diff --git a/tests/testsuite/init/simple_hg_ignore_exists/mod.rs b/tests/testsuite/init/simple_hg_ignore_exists/mod.rs new file mode 100644 index 00000000000..fa69e603abf --- /dev/null +++ b/tests/testsuite/init/simple_hg_ignore_exists/mod.rs @@ -0,0 +1,22 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn simple_hg_ignore_exists() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join(".git").is_dir()); +} diff --git a/tests/snapshots/init/simple_hg_ignore_exists/out/.hgignore b/tests/testsuite/init/simple_hg_ignore_exists/out/.hgignore similarity index 100% rename from tests/snapshots/init/simple_hg_ignore_exists/out/.hgignore rename to tests/testsuite/init/simple_hg_ignore_exists/out/.hgignore diff --git a/tests/snapshots/init/simple_hg_ignore_exists/out/Cargo.toml b/tests/testsuite/init/simple_hg_ignore_exists/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/simple_hg_ignore_exists/out/Cargo.toml rename to tests/testsuite/init/simple_hg_ignore_exists/out/Cargo.toml diff --git a/tests/snapshots/init/simple_hg_ignore_exists/out/src/lib.rs b/tests/testsuite/init/simple_hg_ignore_exists/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/simple_hg_ignore_exists/out/src/lib.rs rename to tests/testsuite/init/simple_hg_ignore_exists/out/src/lib.rs diff --git a/tests/snapshots/init/simple_hg_ignore_exists/stderr.log b/tests/testsuite/init/simple_hg_ignore_exists/stderr.log similarity index 100% rename from tests/snapshots/init/simple_hg_ignore_exists/stderr.log rename to tests/testsuite/init/simple_hg_ignore_exists/stderr.log diff --git a/tests/snapshots/init/simple_hg/stdout.log b/tests/testsuite/init/simple_hg_ignore_exists/stdout.log similarity index 100% rename from tests/snapshots/init/simple_hg/stdout.log rename to tests/testsuite/init/simple_hg_ignore_exists/stdout.log diff --git a/tests/testsuite/init/simple_lib/in b/tests/testsuite/init/simple_lib/in new file mode 120000 index 00000000000..1202506b654 --- /dev/null +++ b/tests/testsuite/init/simple_lib/in @@ -0,0 +1 @@ +../empty_dir \ No newline at end of file diff --git a/tests/testsuite/init/simple_lib/mod.rs b/tests/testsuite/init/simple_lib/mod.rs new file mode 100644 index 00000000000..f2a76de3bdb --- /dev/null +++ b/tests/testsuite/init/simple_lib/mod.rs @@ -0,0 +1,29 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn simple_lib() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); + assert!(!project_root.join(".gitignore").is_file()); + + snapbox::cmd::Command::cargo() + .current_dir(project_root) + .arg("build") + .assert() + .success(); + assert!(!project.bin("foo").is_file()); +} diff --git a/tests/snapshots/init/simple_lib/out/Cargo.toml b/tests/testsuite/init/simple_lib/out/Cargo.toml similarity index 100% rename from tests/snapshots/init/simple_lib/out/Cargo.toml rename to tests/testsuite/init/simple_lib/out/Cargo.toml diff --git a/tests/snapshots/init/simple_lib/out/src/lib.rs b/tests/testsuite/init/simple_lib/out/src/lib.rs similarity index 100% rename from tests/snapshots/init/simple_lib/out/src/lib.rs rename to tests/testsuite/init/simple_lib/out/src/lib.rs diff --git a/tests/snapshots/init/simple_lib/stderr.log b/tests/testsuite/init/simple_lib/stderr.log similarity index 100% rename from tests/snapshots/init/simple_lib/stderr.log rename to tests/testsuite/init/simple_lib/stderr.log diff --git a/tests/snapshots/init/simple_hg_ignore_exists/stdout.log b/tests/testsuite/init/simple_lib/stdout.log similarity index 100% rename from tests/snapshots/init/simple_hg_ignore_exists/stdout.log rename to tests/testsuite/init/simple_lib/stdout.log diff --git a/tests/testsuite/init/unknown_flags/mod.rs b/tests/testsuite/init/unknown_flags/mod.rs new file mode 100644 index 00000000000..23c0a7861a3 --- /dev/null +++ b/tests/testsuite/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 unknown_flags() { + snapbox::cmd::Command::cargo() + .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/tests/snapshots/init/unknown_flags/stderr.log b/tests/testsuite/init/unknown_flags/stderr.log similarity index 100% rename from tests/snapshots/init/unknown_flags/stderr.log rename to tests/testsuite/init/unknown_flags/stderr.log diff --git a/tests/snapshots/init/simple_lib/stdout.log b/tests/testsuite/init/unknown_flags/stdout.log similarity index 100% rename from tests/snapshots/init/simple_lib/stdout.log rename to tests/testsuite/init/unknown_flags/stdout.log diff --git a/tests/snapshots/init/with_argument/in/foo/.keep b/tests/testsuite/init/with_argument/in/foo/.keep similarity index 100% rename from tests/snapshots/init/with_argument/in/foo/.keep rename to tests/testsuite/init/with_argument/in/foo/.keep diff --git a/tests/testsuite/init/with_argument/mod.rs b/tests/testsuite/init/with_argument/mod.rs new file mode 100644 index 00000000000..25b0a4a070f --- /dev/null +++ b/tests/testsuite/init/with_argument/mod.rs @@ -0,0 +1,21 @@ +use cargo_test_support::compare::assert; +use cargo_test_support::prelude::*; +use cargo_test_support::Project; + +use cargo_test_support::curr_dir; + +#[cargo_test] +fn with_argument() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = &project.root(); + + snapbox::cmd::Command::cargo() + .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().subset_matches(curr_dir!().join("out"), project_root); +} diff --git a/tests/snapshots/init/with_argument/out/foo/Cargo.toml b/tests/testsuite/init/with_argument/out/foo/Cargo.toml similarity index 100% rename from tests/snapshots/init/with_argument/out/foo/Cargo.toml rename to tests/testsuite/init/with_argument/out/foo/Cargo.toml diff --git a/tests/snapshots/init/with_argument/out/foo/src/main.rs b/tests/testsuite/init/with_argument/out/foo/src/main.rs similarity index 100% rename from tests/snapshots/init/with_argument/out/foo/src/main.rs rename to tests/testsuite/init/with_argument/out/foo/src/main.rs diff --git a/tests/snapshots/init/simple_bin/stderr.log b/tests/testsuite/init/with_argument/stderr.log similarity index 100% rename from tests/snapshots/init/simple_bin/stderr.log rename to tests/testsuite/init/with_argument/stderr.log diff --git a/tests/snapshots/init/unknown_flags/stdout.log b/tests/testsuite/init/with_argument/stdout.log similarity index 100% rename from tests/snapshots/init/unknown_flags/stdout.log rename to tests/testsuite/init/with_argument/stdout.log