test: add output validation for compression formats
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
c46e78b067
commit
6d365f7eed
55
src/tests.rs
55
src/tests.rs
@@ -328,25 +328,72 @@ mod tests {
|
||||
let env = format!("KEEP_DIR={} cargo run -- --verbose", data_dir.display());
|
||||
|
||||
// Test with no compression
|
||||
let cmd = format!("echo {} | {} -c none --tag none", INPUT_A, env);
|
||||
let cmd = format!("echo {} | {} -c none none", INPUT_A, env);
|
||||
let output = run_sh(cmd.as_str());
|
||||
assert!(output.status.success(), "Command failed: {} {}", cmd, output.status);
|
||||
|
||||
let cmd = format!("{} --get none", env);
|
||||
let output = run_sh(cmd.as_str());
|
||||
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);
|
||||
|
||||
|
||||
// Test with lz4 compression
|
||||
let cmd = format!("echo {} | {} -c lz4 --tag lz4", INPUT_A, env);
|
||||
let cmd = format!("echo {} | {} -c lz4 lz4", INPUT_A, env);
|
||||
let output = run_sh(cmd.as_str());
|
||||
assert!(output.status.success(), "Command failed: {} {}", cmd, output.status);
|
||||
|
||||
let cmd = format!("{} --get lz4", env);
|
||||
let output = run_sh(cmd.as_str());
|
||||
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);
|
||||
|
||||
|
||||
// Test with gzip compression
|
||||
let cmd = format!("echo {} | {} -c gzip --tag gzip", INPUT_A, env);
|
||||
let cmd = format!("echo {} | {} -c gzip gzip", INPUT_A, env);
|
||||
let output = run_sh(cmd.as_str());
|
||||
assert!(output.status.success(), "Command failed: {} {}", cmd, output.status);
|
||||
|
||||
let cmd = format!("{} --get gzip", env);
|
||||
let output = run_sh(cmd.as_str());
|
||||
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);
|
||||
|
||||
// Test with bzip2 compression
|
||||
let cmd = format!("echo {} | {} -c bzip2 --tag bzip2", INPUT_A, env);
|
||||
let cmd = format!("echo {} | {} -c bzip2 bzip2", INPUT_A, env);
|
||||
let output = run_sh(cmd.as_str());
|
||||
assert!(output.status.success(), "Command failed: {} {}", cmd, output.status);
|
||||
|
||||
let cmd = format!("{} --get bzip2", env);
|
||||
let output = run_sh(cmd.as_str());
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user