From ae7769d879eab82b2260d03d55291935f6e6739d Mon Sep 17 00:00:00 2001 From: LukeMathWalker <20745048+LukeMathWalker@users.noreply.github.com> Date: Tue, 14 May 2024 10:03:45 +0200 Subject: [PATCH] Check the implementation of Display in the tests. --- exercises/05_ticket_v2/09_error_trait/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- 2.45.2