Skip to content

Commit 0aac303

Browse files
committed
Add tests for out-dir option deprecation
Ensure that the old options still work and provide the proper deprecation warning.
1 parent 4b309bc commit 0aac303

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

tests/testsuite/artifact_dir.rs

+49
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,55 @@ For more information, try '--help'.
304304
.run();
305305
}
306306

307+
#[cargo_test]
308+
fn deprecated_out_dir() {
309+
let p = project()
310+
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
311+
.build();
312+
313+
p.cargo("build -Z unstable-options --out-dir out")
314+
.masquerade_as_nightly_cargo(&["out-dir"])
315+
.enable_mac_dsym()
316+
.with_stderr_contains("[WARNING] the --out-dir flag has been changed to --artifact-dir")
317+
.run();
318+
check_dir_contents(
319+
&p.root().join("out"),
320+
&["foo"],
321+
&["foo", "foo.dSYM"],
322+
&["foo.exe", "foo.pdb"],
323+
&["foo.exe"],
324+
);
325+
}
326+
327+
#[cargo_test]
328+
fn cargo_build_deprecated_out_dir() {
329+
let p = project()
330+
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
331+
.file(
332+
".cargo/config.toml",
333+
r#"
334+
[build]
335+
out-dir = "out"
336+
"#,
337+
)
338+
.build();
339+
340+
p.cargo("build -Z unstable-options")
341+
.masquerade_as_nightly_cargo(&["out-dir"])
342+
.enable_mac_dsym()
343+
.with_stderr_contains(
344+
"[WARNING] the out-dir config option has been changed to artifact-dir",
345+
)
346+
.run();
347+
check_dir_contents(
348+
&p.root().join("out"),
349+
&["foo"],
350+
&["foo", "foo.dSYM"],
351+
&["foo.exe", "foo.pdb"],
352+
&["foo.exe"],
353+
);
354+
}
355+
307356
fn check_dir_contents(
308357
artifact_dir: &Path,
309358
expected_linux: &[&str],

0 commit comments

Comments
 (0)