From 2afe6b38d3fe8d851b0d37f85c0d058388603127 Mon Sep 17 00:00:00 2001 From: mo8it Date: Wed, 26 Jun 2024 15:12:58 +0200 Subject: [PATCH] Fix tests --- exercises/13_error_handling/errors1.rs | 7 ++++--- solutions/13_error_handling/errors1.rs | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/exercises/13_error_handling/errors1.rs b/exercises/13_error_handling/errors1.rs index 6d9701b1..ec7cb3cb 100644 --- a/exercises/13_error_handling/errors1.rs +++ b/exercises/13_error_handling/errors1.rs @@ -32,9 +32,10 @@ mod tests { #[test] fn explains_why_generating_nametag_text_fails() { assert_eq!( - generate_nametag_text(String::new()).as_deref(), - // Don't change this line - Err("`name` was empty; it must be nonempty."), + generate_nametag_text(String::new()) + .as_ref() + .map_err(|e| e.as_str()), + Err("Empty names aren't allowed"), ); } } diff --git a/solutions/13_error_handling/errors1.rs b/solutions/13_error_handling/errors1.rs index 2a13bfdd..f552ca7f 100644 --- a/solutions/13_error_handling/errors1.rs +++ b/solutions/13_error_handling/errors1.rs @@ -28,8 +28,10 @@ mod tests { #[test] fn explains_why_generating_nametag_text_fails() { assert_eq!( - generate_nametag_text(String::new()).as_deref(), - Err("`name` was empty; it must be nonempty."), + generate_nametag_text(String::new()) + .as_ref() + .map_err(|e| e.as_str()), + Err("Empty names aren't allowed"), ); } }