fix: improve command execution in tests
This commit is contained in:
38
src/tests.rs
38
src/tests.rs
@@ -53,10 +53,11 @@ mod tests {
|
||||
|
||||
// Save an item with some content
|
||||
let input = "test content";
|
||||
// Create a command that pipes input to keep with the specified environment
|
||||
let cmd = format!("echo {} | {}", input, env);
|
||||
let mut child = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(format!("echo {} | {}", input, env))
|
||||
.arg("cargo run -- --save"))
|
||||
.arg(cmd)
|
||||
.spawn()
|
||||
.expect("Failed to spawn process");
|
||||
|
||||
@@ -83,10 +84,11 @@ mod tests {
|
||||
|
||||
// Save an item with some content
|
||||
let input = "test content";
|
||||
// Create a command that pipes input to keep with the specified environment
|
||||
let cmd = format!("echo {} | {}", input, env);
|
||||
let mut child = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(format!("echo {} | {}", input, env))
|
||||
.arg("cargo run -- --save"))
|
||||
.arg(cmd)
|
||||
.spawn()
|
||||
.expect("Failed to spawn process");
|
||||
|
||||
@@ -112,10 +114,11 @@ mod tests {
|
||||
|
||||
// Save an item with some content
|
||||
let input = "test content";
|
||||
// Create a command that pipes input to keep with the specified environment
|
||||
let cmd = format!("echo {} | {}", input, env);
|
||||
let mut child = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(format!("echo {} | {}", input, env))
|
||||
.arg("cargo run -- --save"))
|
||||
.arg(cmd)
|
||||
.spawn()
|
||||
.expect("Failed to spawn process");
|
||||
|
||||
@@ -141,10 +144,11 @@ mod tests {
|
||||
|
||||
// Save an item with some content
|
||||
let input = "test content";
|
||||
// Create a command that pipes input to keep with the specified environment
|
||||
let cmd = format!("echo {} | {}", input, env);
|
||||
let mut child = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(format!("echo {} | {}", input, env))
|
||||
.arg("cargo run -- --save"))
|
||||
.arg(cmd)
|
||||
.spawn()
|
||||
.expect("Failed to spawn process");
|
||||
|
||||
@@ -186,10 +190,12 @@ mod tests {
|
||||
|
||||
// Save an item with some content and metadata
|
||||
let input = "test content";
|
||||
// Create a command that pipes input to keep with the specified environment and metadata
|
||||
let cmd = format!("echo {} | {}", input, env);
|
||||
let mut child = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(format!("echo {} | {}", input, env))
|
||||
.arg("cargo run -- --save --meta key=value"))
|
||||
.arg(cmd)
|
||||
.arg("cargo run -- --save --meta key=value")
|
||||
.spawn()
|
||||
.expect("Failed to spawn process");
|
||||
|
||||
@@ -224,10 +230,12 @@ mod tests {
|
||||
|
||||
// Save an item with some content and tags
|
||||
let input = "test content";
|
||||
// Create a command that pipes input to keep with the specified environment and tags
|
||||
let cmd = format!("echo {} | {}", input, env);
|
||||
let mut child = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(format!("echo {} | {}", input, env))
|
||||
.arg("cargo run -- --save --tag tag1 --tag tag2"))
|
||||
.arg(cmd)
|
||||
.arg("cargo run -- --save --tag tag1 --tag tag2")
|
||||
.spawn()
|
||||
.expect("Failed to spawn process");
|
||||
|
||||
@@ -253,10 +261,12 @@ mod tests {
|
||||
|
||||
// Save an item with some content and compression
|
||||
let input = "test content";
|
||||
// Create a command that pipes input to keep with the specified environment and compression
|
||||
let cmd = format!("echo {} | {}", input, env);
|
||||
let mut child = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(format!("echo {} | {}", input, env))
|
||||
.arg("cargo run -- --save --compression gzip"))
|
||||
.arg(cmd)
|
||||
.arg("cargo run -- --save --compression gzip")
|
||||
.spawn()
|
||||
.expect("Failed to spawn process");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user