diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:47:55 +0000 |
commit | 2aadc03ef15cb5ca5cc2af8a7c08e070742f0ac4 (patch) | |
tree | 033cc839730fda84ff08db877037977be94e5e3a /tests/testsuite/member_discovery.rs | |
parent | Initial commit. (diff) | |
download | cargo-2aadc03ef15cb5ca5cc2af8a7c08e070742f0ac4.tar.xz cargo-2aadc03ef15cb5ca5cc2af8a7c08e070742f0ac4.zip |
Adding upstream version 0.70.1+ds1.upstream/0.70.1+ds1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/testsuite/member_discovery.rs')
-rw-r--r-- | tests/testsuite/member_discovery.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/testsuite/member_discovery.rs b/tests/testsuite/member_discovery.rs new file mode 100644 index 0000000..5377443 --- /dev/null +++ b/tests/testsuite/member_discovery.rs @@ -0,0 +1,44 @@ +//! Tests for workspace member discovery. + +use cargo::core::{Shell, Workspace}; +use cargo::util::config::Config; + +use cargo_test_support::install::cargo_home; +use cargo_test_support::project; +use cargo_test_support::registry; + +/// Tests exclusion of non-directory files from workspace member discovery using glob `*`. +#[cargo_test] +fn bad_file_member_exclusion() { + let p = project() + .file( + "Cargo.toml", + r#" + [workspace] + members = [ "crates/*" ] + "#, + ) + .file("crates/.DS_Store", "PLACEHOLDER") + .file( + "crates/bar/Cargo.toml", + r#" + [package] + name = "bar" + version = "0.1.0" + authors = [] + "#, + ) + .file("crates/bar/src/main.rs", "fn main() {}") + .build(); + + // Prevent this test from accessing the network by setting up .cargo/config. + registry::init(); + let config = Config::new( + Shell::from_write(Box::new(Vec::new())), + cargo_home(), + cargo_home(), + ); + let ws = Workspace::new(&p.root().join("Cargo.toml"), &config).unwrap(); + assert_eq!(ws.members().count(), 1); + assert_eq!(ws.members().next().unwrap().name(), "bar"); +} |