Skip to content

Commit

Permalink
test: reformat for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Jan 14, 2025
1 parent b9718ce commit dff3578
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,39 +1346,37 @@ fn test_force_already_in_graveyard(#[values(false, true)] force: bool) {
);
}

#[cfg(unix)]
#[rstest]
fn test_force_special_file(#[values(false, true)] force: bool) {
let _env_lock = aquire_lock();
let test_env = TestEnv::new();

#[cfg(unix)]
{
use std::os::unix::net::UnixListener;
let socket_path = test_env.src.join("test.sock");
UnixListener::bind(&socket_path).unwrap();

let result = rip2::run(
Args {
targets: [socket_path.clone()].to_vec(),
graveyard: Some(test_env.graveyard.clone()),
force,
..Args::default()
},
TestMode,
&mut Vec::new(),
);
use std::os::unix::net::UnixListener;
let socket_path = test_env.src.join("test.sock");
UnixListener::bind(&socket_path).unwrap();

if force {
// In force mode, should error without prompting
assert!(result.is_err());
let err = result.unwrap_err();
assert!(err.to_string().contains("Failed to bury file"));
} else {
// In non-force mode with TestMode (which returns true for prompts),
// should succeed in deleting the file
assert!(result.is_ok());
assert!(!socket_path.exists());
}
let result = rip2::run(
Args {
targets: [socket_path.clone()].to_vec(),
graveyard: Some(test_env.graveyard.clone()),
force,
..Args::default()
},
TestMode,
&mut Vec::new(),
);

if force {
// In force mode, should error without prompting
assert!(result.is_err());
let err = result.unwrap_err();
assert!(err.to_string().contains("Failed to bury file"));
} else {
// In non-force mode with TestMode (which returns true for prompts),
// should succeed in deleting the file
assert!(result.is_ok());
assert!(!socket_path.exists());
}
}

Expand Down

0 comments on commit dff3578

Please sign in to comment.