mirror of
https://github.com/rust-lang/cargo
synced 2024-10-05 23:39:47 +00:00
test: renamed uplifted artifact remains unmodified after rebuild
This commit is contained in:
parent
531ce1321d
commit
bf1523b663
|
@ -99,6 +99,7 @@ features = [
|
|||
[dev-dependencies]
|
||||
cargo-test-macro = { path = "crates/cargo-test-macro" }
|
||||
cargo-test-support = { path = "crates/cargo-test-support" }
|
||||
same-file = "1.0.6"
|
||||
snapbox = { version = "0.3.0", features = ["diff", "path"] }
|
||||
|
||||
[build-dependencies]
|
||||
|
|
|
@ -6247,3 +6247,32 @@ fn primary_package_env_var() {
|
|||
|
||||
foo.cargo("test").run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn renamed_uplifted_artifact_remains_unmodified_after_rebuild() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
authors = []
|
||||
version = "0.0.0"
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
p.cargo("build").run();
|
||||
|
||||
let bin = p.bin("foo");
|
||||
let renamed_bin = p.bin("foo-renamed");
|
||||
|
||||
fs::rename(&bin, &renamed_bin).unwrap();
|
||||
|
||||
p.change_file("src/main.rs", "fn main() { eprintln!(\"hello, world\"); }");
|
||||
p.cargo("build").run();
|
||||
|
||||
let not_the_same = !same_file::is_same_file(bin, renamed_bin).unwrap();
|
||||
assert!(not_the_same, "renamed uplifted artifact must be unmodified");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue