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
|
// Save an item with some content
|
||||||
let input = "test 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")
|
let mut child = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("echo {} | {}", input, env))
|
.arg(cmd)
|
||||||
.arg("cargo run -- --save"))
|
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to spawn process");
|
.expect("Failed to spawn process");
|
||||||
|
|
||||||
@@ -83,10 +84,11 @@ mod tests {
|
|||||||
|
|
||||||
// Save an item with some content
|
// Save an item with some content
|
||||||
let input = "test 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")
|
let mut child = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("echo {} | {}", input, env))
|
.arg(cmd)
|
||||||
.arg("cargo run -- --save"))
|
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to spawn process");
|
.expect("Failed to spawn process");
|
||||||
|
|
||||||
@@ -112,10 +114,11 @@ mod tests {
|
|||||||
|
|
||||||
// Save an item with some content
|
// Save an item with some content
|
||||||
let input = "test 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")
|
let mut child = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("echo {} | {}", input, env))
|
.arg(cmd)
|
||||||
.arg("cargo run -- --save"))
|
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to spawn process");
|
.expect("Failed to spawn process");
|
||||||
|
|
||||||
@@ -141,10 +144,11 @@ mod tests {
|
|||||||
|
|
||||||
// Save an item with some content
|
// Save an item with some content
|
||||||
let input = "test 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")
|
let mut child = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("echo {} | {}", input, env))
|
.arg(cmd)
|
||||||
.arg("cargo run -- --save"))
|
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to spawn process");
|
.expect("Failed to spawn process");
|
||||||
|
|
||||||
@@ -186,10 +190,12 @@ mod tests {
|
|||||||
|
|
||||||
// Save an item with some content and metadata
|
// Save an item with some content and metadata
|
||||||
let input = "test content";
|
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")
|
let mut child = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("echo {} | {}", input, env))
|
.arg(cmd)
|
||||||
.arg("cargo run -- --save --meta key=value"))
|
.arg("cargo run -- --save --meta key=value")
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to spawn process");
|
.expect("Failed to spawn process");
|
||||||
|
|
||||||
@@ -224,10 +230,12 @@ mod tests {
|
|||||||
|
|
||||||
// Save an item with some content and tags
|
// Save an item with some content and tags
|
||||||
let input = "test content";
|
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")
|
let mut child = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("echo {} | {}", input, env))
|
.arg(cmd)
|
||||||
.arg("cargo run -- --save --tag tag1 --tag tag2"))
|
.arg("cargo run -- --save --tag tag1 --tag tag2")
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to spawn process");
|
.expect("Failed to spawn process");
|
||||||
|
|
||||||
@@ -253,10 +261,12 @@ mod tests {
|
|||||||
|
|
||||||
// Save an item with some content and compression
|
// Save an item with some content and compression
|
||||||
let input = "test content";
|
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")
|
let mut child = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("echo {} | {}", input, env))
|
.arg(cmd)
|
||||||
.arg("cargo run -- --save --compression gzip"))
|
.arg("cargo run -- --save --compression gzip")
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to spawn process");
|
.expect("Failed to spawn process");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user