cargo/tests/testsuite/cargo_init/mod.rs
David Calavera 1a8bfdf0cf Update workspace manifest with new members.
When a user runs `cargo new` or `cargo init` within a workspace, Cargo will automatically add the new package to the members list in the workspace if necessary. The heuristic to add the new package is as follows:

- If there is no `members` list in the workspace yet, a new `members` list is created.
- If there is an `exclude` statement, Cargo checks if the new package should be excluded. If it doesn't match the `exclude` list, the package is added to the `members` list.
- If there is a glob expression in the `members` list that matches the new package, the package is not added to the `members` list.
- If the existent `members` list is sorted, Cargo tries to preserve the ordering when it adds the new package.

This change doesn't try to format the resulting `members` list in any way, leaving the formatting decissions to the user.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2023-10-28 07:42:23 -07:00

46 lines
1.2 KiB
Rust

//! Tests for the `cargo init` command.
mod auto_git;
mod bin_already_exists_explicit;
mod bin_already_exists_explicit_nosrc;
mod bin_already_exists_implicit;
mod bin_already_exists_implicit_namenosrc;
mod bin_already_exists_implicit_namesrc;
mod bin_already_exists_implicit_nosrc;
mod both_lib_and_bin;
mod cant_create_library_when_both_binlib_present;
mod confused_by_multiple_lib_files;
mod creates_binary_when_both_binlib_present;
mod creates_binary_when_instructed_and_has_lib_file;
mod creates_library_when_instructed_and_has_bin_file;
mod explicit_bin_with_git;
mod formats_source;
mod fossil_autodetect;
mod git_autodetect;
mod git_ignore_exists_no_conflicting_entries;
mod help;
mod ignores_failure_to_format_source;
mod inferred_bin_with_git;
mod inferred_lib_with_git;
mod inherit_workspace_package_table;
mod invalid_dir_name;
mod lib_already_exists_nosrc;
mod lib_already_exists_src;
mod mercurial_autodetect;
mod multibin_project_name_clash;
#[cfg(not(windows))]
mod no_filename;
#[cfg(unix)]
mod path_contains_separator;
mod pijul_autodetect;
mod reserved_name;
mod simple_bin;
mod simple_git;
mod simple_git_ignore_exists;
mod simple_hg;
mod simple_hg_ignore_exists;
mod simple_lib;
mod unknown_flags;
mod with_argument;
mod workspace_add_member;