#[cfg(test)]
pub(crate) mod fixtures {
use codelens_engine::ProjectRoot;
pub fn temp_project_root(label: &str) -> ProjectRoot {
let dir = std::env::temp_dir().join(format!(
"codelens-test-{label}-{}-{:?}",
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos(),
std::thread::current().id(),
));
std::fs::create_dir_all(&dir).unwrap();
std::fs::write(dir.join("lib.rs"), "fn sample() {}\n").unwrap();
ProjectRoot::new(&dir).unwrap()
}
#[cfg(feature = "http")]
pub fn temp_project_dir(label: &str) -> std::path::PathBuf {
let dir = std::env::temp_dir().join(format!(
"codelens-test-{label}-{}-{:?}",
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos(),
std::thread::current().id(),
));
std::fs::create_dir_all(&dir).unwrap();
dir
}
}