From: LukeMathWalker <20745048+LukeMathWalker@users.noreply.github.com> Date: Tue, 14 May 2024 08:03:45 +0000 (+0200) Subject: Check the implementation of Display in the tests. X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=ae7769d879eab82b2260d03d55291935f6e6739d;p=rust_exercises.git Check the implementation of Display in the tests. --- diff --git a/exercises/05_ticket_v2/09_error_trait/src/lib.rs b/exercises/05_ticket_v2/09_error_trait/src/lib.rs index 53dd114..ca89efc 100644 --- a/exercises/05_ticket_v2/09_error_trait/src/lib.rs +++ b/exercises/05_ticket_v2/09_error_trait/src/lib.rs @@ -95,5 +95,11 @@ mod tests { assert_eq!(ticket.description, "Description not provided"); } + #[test] + fn display_is_correctly_implemented() { + let ticket = Ticket::new("".into(), valid_description(), Status::ToDo); + assert_eq!(format!("{}", ticket.unwrap_err()), "Title cannot be empty"); + } + assert_impl_one!(TicketNewError: std::error::Error); }