Skip to content

Commit

Permalink
tests: add tests for creating errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ihrwein committed Nov 19, 2021
1 parent 113a0c5 commit c16a378
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,34 @@ where
}
}
}

#[test]
fn create_permanent_error() {
let e = Error::permanent("err");
assert_eq!(e, Error::Permanent("err"));
}

#[test]
fn create_transient_error() {
let e = Error::transient("err");
assert_eq!(
e,
Error::Transient {
err: "err",
retry_after: None
}
);
}

#[test]
fn create_transient_error_with_retry_after() {
let retry_after = Duration::from_secs(42);
let e = Error::retry_after("err", retry_after);
assert_eq!(
e,
Error::Transient {
err: "err",
retry_after: Some(retry_after),
}
);
}

0 comments on commit c16a378

Please sign in to comment.