test(build-dir): Added test for unmatched brackets in build-dir path

This commit is contained in:
Ross Sullivan 2025-04-10 21:34:35 +09:00
parent 210ebb5d11
commit 2a11c26af2
No known key found for this signature in database
GPG Key ID: A7D198C212395322

View File

@ -684,6 +684,39 @@ fn template_workspace_path_hash_should_handle_symlink() {
}
}
#[cargo_test]
fn template_should_handle_ignore_unmatched_brackets() {
let p = project()
.file("src/lib.rs", "")
.file(
".cargo/config.toml",
r#"
[build]
build-dir = "foo/{bar"
"#,
)
.build();
p.cargo("build -Z build-dir")
.masquerade_as_nightly_cargo(&["build-dir"])
.run();
let p = project()
.file("src/lib.rs", "")
.file(
".cargo/config.toml",
r#"
[build]
build-dir = "foo/}bar"
"#,
)
.build();
p.cargo("build -Z build-dir")
.masquerade_as_nightly_cargo(&["build-dir"])
.run();
}
fn parse_workspace_manifest_path_hash(hash_dir: &PathBuf) -> PathBuf {
// Since the hash will change between test runs simply find the first directories and assume
// that is the hash dir. The format is a 2 char directory followed by the remaining hash in the