Skip to content

Commit

Permalink
Include seance test for folders
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Apr 8, 2024
1 parent 5f39b00 commit 1968ad1
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,24 +284,26 @@ fn test_duplicate_file(#[case] in_folder: bool) {
assert!(expected_graveyard_path2.exists());

// Navigate to the test_env.src directory
let cur_dir = env::current_dir().unwrap();
env::set_current_dir(&test_env.src).unwrap();
// Unbury using seance
rip2::run(
Args {
graveyard: Some(test_env.graveyard.clone()),
unbury: Some(Vec::new()),
seance: true,
..Args::default()
},
TestMode,
)
.unwrap();

// Now, both files should be restored, one with the original name and the other with '~1' appended
assert!(test_data1.path.exists());
if !in_folder {
let cur_dir = env::current_dir().unwrap();
env::set_current_dir(&test_env.src).unwrap();
// Unbury using seance
rip2::run(
Args {
graveyard: Some(test_env.graveyard.clone()),
unbury: Some(Vec::new()),
seance: true,
..Args::default()
},
TestMode,
)
.unwrap();

// Now, both files should be restored, one with the original name and the other with '~1' appended
assert!(test_data1.path.exists());
assert!(test_env.src.join("file.txt~1").exists());
env::set_current_dir(cur_dir).unwrap();
} else {
assert!(test_env.src.join("dir~1/file.txt").exists());
}
env::set_current_dir(cur_dir).unwrap();
}

0 comments on commit 1968ad1

Please sign in to comment.