Skip to content

Commit 9a65110

Browse files
committed
Update tests and ensure out-dir still works
1 parent 54cc04f commit 9a65110

File tree

1 file changed

+54
-5
lines changed

1 file changed

+54
-5
lines changed

tests/testsuite/artifact_dir.rs

+54-5
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ fn include_only_the_binary_from_the_current_package() {
179179
}
180180

181181
#[cargo_test]
182-
fn out_dir_is_a_file() {
182+
fn artifact_dir_is_a_file() {
183183
let p = project()
184184
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
185185
.file("out", "")
@@ -256,7 +256,7 @@ fn avoid_build_scripts() {
256256
}
257257

258258
#[cargo_test]
259-
fn cargo_build_out_dir() {
259+
fn cargo_build_artifact_dir() {
260260
let p = project()
261261
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
262262
.file(
@@ -282,7 +282,7 @@ fn cargo_build_out_dir() {
282282
}
283283

284284
#[cargo_test]
285-
fn unsupported_short_out_dir_flag() {
285+
fn unsupported_short_artifact_dir_flag() {
286286
let p = project()
287287
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
288288
.build();
@@ -304,8 +304,57 @@ 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(
308-
out_dir: &Path,
357+
artifact_dir: &Path,
309358
expected_linux: &[&str],
310359
expected_mac: &[&str],
311360
expected_win_msvc: &[&str],
@@ -323,7 +372,7 @@ fn check_dir_contents(
323372
expected_linux
324373
};
325374

326-
let actual = list_dir(out_dir);
375+
let actual = list_dir(artifact_dir);
327376
let mut expected = expected.iter().map(|s| s.to_string()).collect::<Vec<_>>();
328377
expected.sort_unstable();
329378
assert_eq!(actual, expected);

0 commit comments

Comments
 (0)