test: add test for unknown compression handling and fix whitespace
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
ec3716e4b9
commit
20f455884c
18
src/tests.rs
18
src/tests.rs
@@ -232,6 +232,12 @@ mod tests {
|
|||||||
// Set the data directory for this test
|
// Set the data directory for this test
|
||||||
let env = format!("KEEP_DIR={} cargo run -- --verbose", data_dir.display());
|
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
|
// Test with no compression
|
||||||
let cmd = format!("echo {} | {} -c none none", INPUT_A, env);
|
let cmd = format!("echo {} | {} -c none none", INPUT_A, env);
|
||||||
println!("RUNNING: {}", cmd);
|
println!("RUNNING: {}", cmd);
|
||||||
@@ -273,6 +279,7 @@ mod tests {
|
|||||||
let output_str = String::from_utf8_lossy(&output.stdout).to_string();
|
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);
|
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
|
// Test with bzip2 compression
|
||||||
let cmd = format!("echo {} | {} -c bzip2 bzip2", INPUT_A, env);
|
let cmd = format!("echo {} | {} -c bzip2 bzip2", INPUT_A, env);
|
||||||
println!("RUNNING: {}", cmd);
|
println!("RUNNING: {}", cmd);
|
||||||
@@ -285,17 +292,6 @@ mod tests {
|
|||||||
assert!(output.status.success(), "Command failed: {} {}", cmd, output.status);
|
assert!(output.status.success(), "Command failed: {} {}", cmd, output.status);
|
||||||
let output_str = String::from_utf8_lossy(&output.stdout).to_string();
|
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);
|
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);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user