Attribute Macro path

Source
#[path]
Expand description

Run test case when the path(file or folder) exist.

#[cfg(test)]
mod tests {

    // etc exists
    #[test_with::path(/etc)]
    #[test]
    fn test_works() {
        assert!(true);
    }

    // nothing does not exist
    #[test_with::path(/nothing)]
    #[test]
    fn test_ignored() {
        panic!("should be ignored")
    }

    // etc and tmp exist
    #[test_with::path(/etc, /tmp)]
    #[test]
    fn test_works_too() {
        assert!(true);
    }
}