Skip to content

Commit 389f263

Browse files
committed
test(build-dir): Add test for build-dir template nearest suggestion
1 parent 27366fd commit 389f263

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/testsuite/build_dir.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,29 @@ fn template_should_error_for_invalid_variables() {
516516
.run();
517517
}
518518

519+
#[cargo_test]
520+
fn template_should_suggest_nearest_variable() {
521+
let p = project()
522+
.file("src/lib.rs", "")
523+
.file(
524+
".cargo/config.toml",
525+
r#"
526+
[build]
527+
build-dir = "{workspace-ro}/build-dir"
528+
"#,
529+
)
530+
.build();
531+
532+
p.cargo("build -Z build-dir")
533+
.masquerade_as_nightly_cargo(&["build-dir"])
534+
.with_status(101)
535+
.with_stderr_data(str![[r#"
536+
[ERROR] unexpected variable `workspace-ro` in build.build-dir path `{workspace-ro}/build-dir`
537+
538+
"#]])
539+
.run();
540+
}
541+
519542
#[cargo_test]
520543
fn template_workspace_root() {
521544
let p = project()

0 commit comments

Comments
 (0)