47 lines
1.2 KiB
Rust
47 lines
1.2 KiB
Rust
use pixstrip_core::error::PixstripError;
|
|
|
|
#[test]
|
|
fn error_display_image_load() {
|
|
let err = PixstripError::ImageLoad {
|
|
path: "/tmp/bad.jpg".into(),
|
|
reason: "corrupt header".into(),
|
|
};
|
|
let msg = err.to_string();
|
|
assert!(msg.contains("/tmp/bad.jpg"));
|
|
assert!(msg.contains("corrupt header"));
|
|
}
|
|
|
|
#[test]
|
|
fn error_display_unsupported_format() {
|
|
let err = PixstripError::UnsupportedFormat {
|
|
format: "bmp".into(),
|
|
};
|
|
assert!(err.to_string().contains("bmp"));
|
|
}
|
|
|
|
#[test]
|
|
fn error_display_io() {
|
|
let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "file missing");
|
|
let err = PixstripError::Io(io_err);
|
|
assert!(err.to_string().contains("file missing"));
|
|
}
|
|
|
|
#[test]
|
|
fn error_display_output_exists() {
|
|
let err = PixstripError::OutputExists {
|
|
path: "/tmp/out.jpg".into(),
|
|
};
|
|
assert!(err.to_string().contains("/tmp/out.jpg"));
|
|
}
|
|
|
|
#[test]
|
|
fn error_display_processing() {
|
|
let err = PixstripError::Processing {
|
|
operation: "resize".into(),
|
|
reason: "invalid dimensions".into(),
|
|
};
|
|
let msg = err.to_string();
|
|
assert!(msg.contains("resize"));
|
|
assert!(msg.contains("invalid dimensions"));
|
|
}
|