1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
use std::path::PathBuf;
use crate::path_utils::{CanonicalizedPathBuf, canonicalize};

pub fn root() -> CanonicalizedPathBuf {
    canonicalize(
        PathBuf::from(env!("CARGO_MANIFEST_DIR"))
            .parent().unwrap()
            .into()
    ).unwrap()
}

#[cfg(test)]
pub fn errmsg<T>(r: crate::errors::Result<T>) -> String {
    match r {
        Ok(_) => panic!("expected an Err!"),
        Err(crate::errors::FhttpError { msg }) => msg,
    }
}