Skip to content

Commit 0c525bb

Browse files
committed
Test CACHEDIR.TAG is created in an existing registry
1 parent 7e366c2 commit 0c525bb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/testsuite/registry.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,12 @@ fn updating_a_dep(cargo: fn(&Project, &str) -> Execs) {
12371237
.run();
12381238
assert!(paths::home().join(".cargo/registry/CACHEDIR.TAG").is_file());
12391239

1240+
// Now delete the CACHEDIR.TAG file: this is the situation we'll be in after
1241+
// upgrading from a version of Cargo that doesn't mark this directory, to one that
1242+
// does. It should be recreated.
1243+
fs::remove_file(paths::home().join(".cargo/registry/CACHEDIR.TAG"))
1244+
.expect("remove CACHEDIR.TAG");
1245+
12401246
p.change_file(
12411247
"a/Cargo.toml",
12421248
r#"
@@ -1265,6 +1271,11 @@ fn updating_a_dep(cargo: fn(&Project, &str) -> Execs) {
12651271
",
12661272
)
12671273
.run();
1274+
1275+
assert!(
1276+
paths::home().join(".cargo/registry/CACHEDIR.TAG").is_file(),
1277+
"CACHEDIR.TAG recreated in existing registry"
1278+
);
12681279
}
12691280

12701281
#[cargo_test]

0 commit comments

Comments
 (0)