refactor: rename env variable to keep_cmd for clarity

This commit is contained in:
Andrew Phillips
2025-05-14 09:44:51 -03:00
committed by Andrew Phillips (aider)
parent 412f5d74d0
commit f089c8002d

View File

@@ -41,10 +41,10 @@ mod tests {
// Helper function to create test items with specific content and tags
fn create_test_items(dir: &Path) {
// Set the data directory for this test
let env = format!("KEEP_DIR={} cargo run -- --verbose", dir.display());
let keep_cmd = format!("KEEP_DIR={} cargo run -- --verbose", dir.display());
// Create first item with tag_a and tag
let cmd = format!("echo {} | {} tag tag_a tag", INPUT_A, env);
let cmd = format!("echo {} | {} tag tag_a tag", INPUT_A, keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -54,7 +54,7 @@ mod tests {
);
// Create second item with tag_b and tag
let cmd = format!("echo {} | {} tag tag_b tag", INPUT_B, env);
let cmd = format!("echo {} | {} tag tag_b tag", INPUT_B, keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -83,14 +83,14 @@ mod tests {
// Create test items with the common environment setup
create_test_items(data_dir);
// Set the data directory for this test
let env = format!("KEEP_DIR={} cargo run -- --verbose", data_dir.display());
let keep_cmd = format!("KEEP_DIR={} cargo run -- --verbose", data_dir.display());
// Test content and tags
let input = "test content";
let tag = "tag";
// Create a command that pipes input to keep with the specified environment
let cmd = format!("echo {} | {} {}", input, env, tag);
let cmd = format!("echo {} | {} {}", input, keep_cmd, tag);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -107,9 +107,9 @@ mod tests {
// Create test items with the common environment setup
create_test_items(data_dir);
let env = format!("KEEP_DIR={} cargo run -- --verbose", data_dir.display());
let keep_cmd = format!("KEEP_DIR={} cargo run -- --verbose", data_dir.display());
let cmd = format!("{} --get 1", env);
let cmd = format!("{} --get 1", keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -120,7 +120,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);
let cmd = format!("{} -g 1", env);
let cmd = format!("{} -g 1", keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -131,7 +131,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);
let cmd = format!("{} 1", env);
let cmd = format!("{} 1", keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -142,7 +142,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);
let cmd = format!("{} --get", env);
let cmd = format!("{} --get", keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -153,7 +153,7 @@ mod tests {
let output_str = String::from_utf8_lossy(&output.stdout).to_string();
assert!(output_str.contains(INPUT_B), "Command output does not contain expected string. Command: {} Output: {} Expected: \"{}\"", cmd, output_str, INPUT_B);
let cmd = format!("{} --get tag_a", env);
let cmd = format!("{} --get tag_a", keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -164,7 +164,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);
let cmd = format!("{} --get tag_b", env);
let cmd = format!("{} --get tag_b", keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),
@@ -175,7 +175,7 @@ mod tests {
let output_str = String::from_utf8_lossy(&output.stdout).to_string();
assert!(output_str.contains(INPUT_B), "Command output does not contain expected string. Command: {} Output: {} Expected: \"{}\"", cmd, output_str, INPUT_B);
let cmd = format!("{} --get tag", env);
let cmd = format!("{} --get tag", keep_cmd);
let output = run_sh(cmd.as_str());
assert!(
output.status.success(),