test: add test for unknown compression handling and fix whitespace

This commit is contained in:
Andrew Phillips
2025-05-12 16:40:04 -03:00
committed by Andrew Phillips (aider)
parent ec3716e4b9
commit 20f455884c

View File

@@ -232,6 +232,12 @@ mod tests {
// Set the data directory for this test
let env = format!("KEEP_DIR={} cargo run -- --verbose", data_dir.display());
// Test with no compression
let cmd = format!("echo {} | {} -c unknown unknown", INPUT_A, env);
println!("RUNNING: {}", cmd);
let output = run_sh(cmd.as_str());
assert!(!output.status.success(), "Command succeeded when it should have failed: {} {}", cmd, output.status);
// Test with no compression
let cmd = format!("echo {} | {} -c none none", INPUT_A, env);
println!("RUNNING: {}", cmd);
@@ -273,6 +279,7 @@ mod tests {
let output_str = String::from_utf8_lossy(&output.stdout).to_string();
assert!(output_str.contains(INPUT_A), "Command output does not contain expected string. Command: {} Output: {} Expected: \"{}\"", cmd, output_str, INPUT_A);
// Test with bzip2 compression
let cmd = format!("echo {} | {} -c bzip2 bzip2", INPUT_A, env);
println!("RUNNING: {}", cmd);
@@ -285,17 +292,6 @@ mod tests {
assert!(output.status.success(), "Command failed: {} {}", cmd, output.status);
let output_str = String::from_utf8_lossy(&output.stdout).to_string();
assert!(output_str.contains(INPUT_A), "Command output does not contain expected string. Command: {} Output: {} Expected: \"{}\"", cmd, output_str, INPUT_A);
// Verify all items were created
let cmd = format!("{} --list", env);
let output = run_sh(cmd.as_str());
assert!(output.status.success(), "Command failed: {}", cmd);
let output_str = String::from_utf8_lossy(&output.stdout).to_string();
assert!(output_str.contains("none"), "Command output does not contain expected string. Command: {} Output: {}", cmd, output_str);
assert!(output_str.contains("lz4"), "Command output does not contain expected string. Command: {} Output: {}", cmd, output_str);
assert!(output_str.contains("gzip"), "Command output does not contain expected string. Command: {} Output: {}", cmd, output_str);
assert!(output_str.contains("bzip2"), "Command output does not contain expected string. Command: {} Output: {}", cmd, output_str);
});
}
}