mirror of
https://github.com/PR0M3TH3AN/Marlin.git
synced 2025-09-09 07:38:50 +00:00
update
This commit is contained in:
23
cli-bin/tests/util.rs
Normal file
23
cli-bin/tests/util.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
//! tests/util.rs
|
||||
//! Small helpers shared across integration tests.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use tempfile::TempDir;
|
||||
use assert_cmd::Command;
|
||||
/// Absolute path to the freshly-built `marlin` binary.
|
||||
pub fn bin() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_BIN_EXE_marlin"))
|
||||
}
|
||||
|
||||
/// Build a `Command` for `marlin` whose `MARLIN_DB_PATH` is
|
||||
/// `<tmp>/index.db`.
|
||||
///
|
||||
/// Each call yields a brand-new `Command`, so callers can freely add
|
||||
/// arguments, change the working directory, etc., without affecting
|
||||
/// other invocations.
|
||||
pub fn marlin(tmp: &TempDir) -> Command {
|
||||
let db_path: &Path = &tmp.path().join("index.db");
|
||||
let mut cmd = Command::new(bin());
|
||||
cmd.env("MARLIN_DB_PATH", db_path);
|
||||
cmd
|
||||
}
|
Reference in New Issue
Block a user