use std::fmt;
use std::path::Path;
use crate::core::Matcher;
use crate::matchers::files::{FileExistsMatcher, FileExistsMode};
use super::ExpectationFormat;
pub fn be_existing_file<'a, Actual>() -> Matcher<'a, Actual, Actual>
where
Actual: fmt::Debug + AsRef<Path> + 'a,
{
Matcher::new(
FileExistsMatcher::new(FileExistsMode::Exists),
ExpectationFormat::new(
"to exist in the filesystem",
"to not exist in the filesystem",
),
)
}
pub fn be_regular_file<'a, Actual>() -> Matcher<'a, Actual, Actual>
where
Actual: fmt::Debug + AsRef<Path> + 'a,
{
Matcher::new(
FileExistsMatcher::new(FileExistsMode::RegularFile),
ExpectationFormat::new("to exist and be a regular file", "to not be a regular file"),
)
}
pub fn be_directory<'a, Actual>() -> Matcher<'a, Actual, Actual>
where
Actual: fmt::Debug + AsRef<Path> + 'a,
{
Matcher::new(
FileExistsMatcher::new(FileExistsMode::Directory),
ExpectationFormat::new("to exist and be a directory", "to not be a directory"),
)
}
pub fn be_symlink<'a, Actual>() -> Matcher<'a, Actual, Actual>
where
Actual: fmt::Debug + AsRef<Path> + 'a,
{
Matcher::new(
FileExistsMatcher::new(FileExistsMode::Symlink),
ExpectationFormat::new(
"to exist and be a symbolic link",
"to not be a symbolic link",
),
)
}