mirror of
https://github.com/rust-lang/cargo
synced 2024-10-31 08:59:36 +00:00
1a8bfdf0cf
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>
21 lines
660 B
Rust
21 lines
660 B
Rust
use cargo_test_support::compare::assert_ui;
|
|
use cargo_test_support::prelude::*;
|
|
use cargo_test_support::Project;
|
|
|
|
use cargo_test_support::curr_dir;
|
|
|
|
#[cargo_test]
|
|
fn case() {
|
|
let project = Project::from_template(curr_dir!().join("in"));
|
|
let project_root = &project.root();
|
|
|
|
snapbox::cmd::Command::cargo_ui()
|
|
.arg_line("init --bin --vcs none")
|
|
.current_dir(project_root.join("crates").join("foo"))
|
|
.assert()
|
|
.success()
|
|
.stdout_matches_path(curr_dir!().join("stdout.log"))
|
|
.stderr_matches_path(curr_dir!().join("stderr.log"));
|
|
|
|
assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
|
|
}
|