refactor: adjust tests for unused variables and simplified command args
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
68167e9d05
commit
543468bf0e
10
src/tests.rs
10
src/tests.rs
@@ -3,7 +3,7 @@ mod tests {
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::process::Stdio;
|
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
|
||||||
// Helper function to run the keep command with given arguments
|
// Helper function to run the keep command with given arguments
|
||||||
@@ -22,7 +22,7 @@ mod tests {
|
|||||||
F: FnOnce(&Path),
|
F: FnOnce(&Path),
|
||||||
{
|
{
|
||||||
let dir = tempdir().expect("Failed to create temporary directory");
|
let dir = tempdir().expect("Failed to create temporary directory");
|
||||||
let db_path = dir.path().join("keep-1.db");
|
let _db_path = dir.path().join("keep-1.db");
|
||||||
|
|
||||||
// Create the data directory structure
|
// Create the data directory structure
|
||||||
fs::create_dir_all(dir.path()).expect("Failed to create directory");
|
fs::create_dir_all(dir.path()).expect("Failed to create directory");
|
||||||
@@ -165,7 +165,7 @@ mod tests {
|
|||||||
let id = list_output_str.lines().next().expect("No items found").split_whitespace().next().expect("No ID found").parse::<i64>().expect("Invalid ID");
|
let id = list_output_str.lines().next().expect("No items found").split_whitespace().next().expect("No ID found").parse::<i64>().expect("Invalid ID");
|
||||||
|
|
||||||
// Delete the item
|
// Delete the item
|
||||||
let output = Command::new("sh")
|
let _output = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("{} cargo run -- --delete {}", env, id))
|
.arg(format!("{} cargo run -- --delete {}", env, id))
|
||||||
.output()
|
.output()
|
||||||
@@ -235,7 +235,7 @@ mod tests {
|
|||||||
let mut cmd = Command::new("sh");
|
let mut cmd = Command::new("sh");
|
||||||
cmd.arg("-c")
|
cmd.arg("-c")
|
||||||
.arg(format!("echo {} | {}", input, env))
|
.arg(format!("echo {} | {}", input, env))
|
||||||
.arg("cargo run -- --save --tag tag1 --tag tag2");
|
.arg("cargo run -- --save tag1 tag2");
|
||||||
|
|
||||||
cmd.spawn()
|
cmd.spawn()
|
||||||
.expect("Failed to spawn process")
|
.expect("Failed to spawn process")
|
||||||
@@ -245,7 +245,7 @@ mod tests {
|
|||||||
// List items with a specific tag
|
// List items with a specific tag
|
||||||
let output = Command::new("sh")
|
let output = Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("{} cargo run -- --list --tag tag1", env))
|
.arg(format!("{} cargo run -- --list tag1", env))
|
||||||
.output()
|
.output()
|
||||||
.expect("Failed to execute command");
|
.expect("Failed to execute command");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user