Skip to content

Commit

Permalink
chore: unit tests errors/mod.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Naumel committed May 11, 2023
1 parent e96919e commit 3ac8c84
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,26 @@ impl fmt::Display for TransmuteError {
}

impl Error for TransmuteError {}

#[cfg(test)]
mod tests {
use serde::de::Error;

use super::*;

#[test]
fn test_transmute_error() {
let error = TransmuteError::new("Test error message");

assert_eq!(error.details, "Test error message");
assert_eq!(error.to_string(), "TransmuteError: Test error message");
}

#[test]
fn test_transmute_error_from() {
let yaml_error = serde_yaml::Error::custom("YAML parsing error");
let transmute_error: TransmuteError = yaml_error.into();

assert_eq!(transmute_error.details, "YAML parsing error");
}
}

0 comments on commit 3ac8c84

Please sign in to comment.