Skip to content

Commit

Permalink
Add test to check artifact name conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
justahero committed May 28, 2024
1 parent ca659a1 commit 1e9f5c7
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/testsuite/sbom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,42 @@ fn build_sbom_project_bin_and_lib() {
);
}

#[cargo_test]
fn build_sbom_with_artifact_name_conflict() {
Package::new("deps", "0.1.0")
.file(
"Cargo.toml",
r#"
[package]
name = "deps" # name conflict
version = "0.1.0"
authors = []
"#,
)
.file("src/lib.rs", "pub fn bar() -> i32 { 2 }")
.publish();

let p = configured_project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
[dependencies]
deps = "0.1.0"
"#,
)
.file("src/main.rs", "fn main() { let _i = deps::bar(); }")
.build();

p.cargo("build -Zsbom")
.masquerade_as_nightly_cargo(&["sbom"])
.run();
}

#[cargo_test]
fn build_sbom_with_multiple_crate_types() {
let p = configured_project()
Expand Down

0 comments on commit 1e9f5c7

Please sign in to comment.