use std::string::String;
use tempfile::TempDir;
use anyhow::Result;
#[allow(dead_code)]
pub fn create_test_dir() -> Result<TempDir> {
Ok(tempfile::tempdir()?)
}
#[allow(dead_code)]
pub fn cleanup_test_dir(dir: TempDir) -> Result<()> {
dir.close()?;
Ok(())
}
#[allow(dead_code)]
pub struct OutputCapture {
pub stdout: Vec<u8>,
pub stderr: Vec<u8>,
}
impl OutputCapture {
#[allow(dead_code)]
pub fn new() -> Self {
Self {
stdout: Vec::new(),
stderr: Vec::new(),
}
}
#[allow(dead_code)]
pub fn get_stdout(&self) -> String {
String::from_utf8_lossy(&self.stdout).to_string()
}
#[allow(dead_code)]
pub fn get_stderr(&self) -> String {
String::from_utf8_lossy(&self.stderr).to_string()
}
}