use crate::types::report::MustBeRelative;
use crate::types::report::OutsideProject;
use crate::types::report::Quoted;
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum PathShape {
#[error("empty")]
Empty,
#[error(transparent)]
MustBeRelative(MustBeRelative),
#[error(transparent)]
OutsideProject(OutsideProject),
#[error("{0} must use / as the separator")]
Separator(Quoted),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn path_shape_empty() {
assert_eq!(PathShape::Empty.to_string(), "empty");
}
#[test]
fn path_shape_must_be_relative() {
let shape = PathShape::MustBeRelative(MustBeRelative::new("/x"));
assert_eq!(shape.to_string(), "\"/x\" must be relative");
}
#[test]
fn path_shape_outside_project() {
let shape = PathShape::OutsideProject(OutsideProject::new("../x"));
assert_eq!(shape.to_string(), "\"../x\" must stay inside the project");
}
#[test]
fn path_shape_separator() {
let shape = PathShape::Separator(Quoted::new("a\\b"));
assert_eq!(shape.to_string(), "\"a\\b\" must use / as the separator");
}
}