//! Test-only helpers shared by the module test suites. use std::fs; use std::path::PathBuf; use std::time::{SystemTime, UNIX_EPOCH}; /// Create a unique scratch directory under the platform temp dir (the test /// runner points TEMP/TMP at `target\tmp`). pub fn temp_dir(name: &str) -> PathBuf { let unique = SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() .as_nanos(); let dir = std::env::temp_dir().join(format!("md-preview-{name}-{}-{unique}", std::process::id())); fs::create_dir_all(&dir).unwrap(); dir }