use assert_cmd::Command;
use std::fs;
use std::io::Write;
use std::time::Duration;
use tempfile::TempDir;
#[allow(deprecated)] fn crush_cmd() -> Command {
Command::cargo_bin("crush").expect("Failed to find crush binary")
}
#[test]
#[ignore] fn test_cancelling_message_appears_immediately() {
}
#[test]
#[ignore] fn test_operation_cancelled_message() {
}
#[test]
fn test_cancel_hint_functionality_exists() -> Result<(), Box<dyn std::error::Error>> {
let dir = TempDir::new()?;
let input = dir.path().join("large.txt");
let output = dir.path().join("large.txt.crush");
let mut file = fs::File::create(&input)?;
let data = vec![b'x'; 2 * 1024 * 1024]; file.write_all(&data)?;
drop(file);
crush_cmd()
.arg("compress")
.arg(&input)
.arg("-o")
.arg(&output)
.timeout(Duration::from_secs(30))
.assert()
.success();
assert!(output.exists(), "Compressed file should exist");
Ok(())
}
#[test]
#[ignore] fn test_cancel_hint_displayed_manual() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}