summaryrefslogtreecommitdiff
path: root/src/pinentry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pinentry.rs')
-rw-r--r--src/pinentry.rs27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/pinentry.rs b/src/pinentry.rs
index d1387f4..e1dec3e 100644
--- a/src/pinentry.rs
+++ b/src/pinentry.rs
@@ -348,26 +348,16 @@ mod tests {
let response = "ERR ".to_string() + error + "\n";
let expected = error;
- let error = parse_pinentry_pin(response);
-
- if let Error::Error(ref e) = error.err().unwrap() {
- assert_eq!(e, &expected);
- } else {
- panic!("Unexpected result");
- }
+ let error = parse_pinentry_pin(response).unwrap_err();
+ assert_eq!(error.to_string(), expected)
}
#[test]
fn parse_pinentry_pin_unexpected() {
let response = "foobar\n";
let expected = format!("Unexpected response: {}", response);
- let error = parse_pinentry_pin(response);
-
- if let Error::Error(ref e) = error.err().unwrap() {
- assert_eq!(e, &expected);
- } else {
- panic!("Unexpected result");
- }
+ let error = parse_pinentry_pin(response).unwrap_err();
+ assert_eq!(error.to_string(), expected)
}
#[test]
@@ -384,12 +374,7 @@ mod tests {
fn parse_pinentry_response_unexpected() {
let response = "ERR 42";
let expected = format!("Unexpected response: {}", response);
- let error = parse_pinentry_response(response);
-
- if let Error::Error(ref e) = error.err().unwrap() {
- assert_eq!(e, &expected);
- } else {
- panic!("Unexpected result");
- }
+ let error = parse_pinentry_response(response).unwrap_err();
+ assert_eq!(error.to_string(), expected)
}
}