Skip to content

Commit 3eb2ae0

Browse files
committed
Add two tests
1 parent 7a0001d commit 3eb2ae0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/testsuite/build.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4989,3 +4989,32 @@ fn reduced_reproduction_8249() {
49894989
p.cargo("check").run();
49904990
p.cargo("check").run();
49914991
}
4992+
4993+
#[cargo_test]
4994+
fn target_directory_is_excluded_from_backups() {
4995+
let p = project()
4996+
.file("Cargo.toml", &basic_bin_manifest("foo"))
4997+
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
4998+
.build();
4999+
5000+
p.cargo("build").run();
5001+
let cachedir_tag = p.target_debug_dir().join("CACHEDIR.TAG");
5002+
assert!(cachedir_tag.is_file());
5003+
assert!(fs::read_to_string(&cachedir_tag)
5004+
.unwrap()
5005+
.starts_with("Signature: 8a477f597d28d172789f06886806bc55"));
5006+
}
5007+
5008+
#[cargo_test]
5009+
fn target_directory_is_not_excluded_from_backups_if_it_already_exists() {
5010+
let p = project()
5011+
.file("Cargo.toml", &basic_bin_manifest("foo"))
5012+
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
5013+
.build();
5014+
5015+
let cachedir_tag = p.target_debug_dir().join("CACHEDIR.TAG");
5016+
p.cargo("build").run();
5017+
fs::remove_file(&cachedir_tag).unwrap();
5018+
p.cargo("build").run();
5019+
assert!(!&cachedir_tag.is_file());
5020+
}

0 commit comments

Comments
 (0)