1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
    Appellation: errors <module>
    Contrib: FL03 <jo3mccain@icloud.com>
*/
//! # Errors
//!
//!
pub use self::{error::*, kinds::*};

pub(crate) mod error;
pub(crate) mod kinds;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_error() {
        let msg = "test";
        let err = Error::new(ErrorKind::custom("custom"), msg.to_string());
        assert_eq!(err.kind(), &ErrorKind::custom("custom"));
    }

    #[test]
    #[cfg(feature = "serde")]
    fn test_error_serde() {
        let err = Error::new(ErrorKind::custom("custom"), "test".to_string());
        let json = serde_json::to_value(&err).unwrap();
        let err2: Error = serde_json::from_value(json).unwrap();
        assert_eq!(err, err2);
    }
}