Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename --out-dir to --artifact-dir #13809

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions tests/testsuite/artifact_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,55 @@ For more information, try '--help'.
.run();
}

#[cargo_test]
fn deprecated_out_dir() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not important enough for this change but in the future, I generally recommend adding the tests as the first commit (with them passing). Then as you change behavior, that is reflected in how the tests are changed to ensure they still pass. This makes it easier for reviewers to see how behavior changed, we can then show those diffs in posts to the community for them to understand changes, and it helps "test the test" (I've made changes where I thought I was testing the right condition and wasn't).

let p = project()
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
.build();

p.cargo("build -Z unstable-options --out-dir out")
.masquerade_as_nightly_cargo(&["out-dir"])
.enable_mac_dsym()
.with_stderr_contains("[WARNING] the --out-dir flag has been changed to --artifact-dir")
.run();
check_dir_contents(
&p.root().join("out"),
&["foo"],
&["foo", "foo.dSYM"],
&["foo.exe", "foo.pdb"],
&["foo.exe"],
);
}

#[cargo_test]
fn cargo_build_deprecated_out_dir() {
let p = project()
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
.file(
".cargo/config.toml",
r#"
[build]
out-dir = "out"
"#,
)
.build();

p.cargo("build -Z unstable-options")
.masquerade_as_nightly_cargo(&["out-dir"])
.enable_mac_dsym()
.with_stderr_contains(
"[WARNING] the out-dir config option has been changed to artifact-dir",
)
.run();
check_dir_contents(
&p.root().join("out"),
&["foo"],
&["foo", "foo.dSYM"],
&["foo.exe", "foo.pdb"],
&["foo.exe"],
);
}

fn check_dir_contents(
artifact_dir: &Path,
expected_linux: &[&str],
Expand Down