#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Terminal I/O failed during picker: {0}")]
Io(#[source] std::io::Error),
}
impl PartialEq for Error {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Io(l), Self::Io(r)) => l.kind() == r.kind(),
}
}
}
#[cfg(test)]
mod tests {
use std::io;
use similar_asserts::assert_eq;
use super::*;
fn io(kind: io::ErrorKind) -> io::Error {
io::Error::from(kind)
}
#[test]
fn io_eq_compares_kind() {
let a = Error::Io(io(io::ErrorKind::BrokenPipe));
let b = Error::Io(io(io::ErrorKind::BrokenPipe));
let c = Error::Io(io(io::ErrorKind::Other));
assert_eq!(a, b);
assert_ne!(a, c);
}
}