fhttp-test-utils 2.0.0

test utils library for the fhttp tool
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use anyhow::Result;
use fhttp_core::path_utils::{CanonicalizedPathBuf, canonicalize};
use temp_dir::TempDir;

pub fn write_test_file<S: AsRef<str>>(
    workdir: &TempDir,
    filename: S,
    content: S,
) -> Result<CanonicalizedPathBuf> {
    let file = workdir.child(filename.as_ref());
    std::fs::write(&file, content.as_ref().as_bytes())?;
    canonicalize(&file)
}