From 5ad84c1670733843f677b2c5bee8c50d78b8e24a Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 13 Oct 2022 15:43:37 +0200 Subject: Add a couple tests for `Debug` on unist interfaces --- src/unist.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/unist.rs b/src/unist.rs index 75ef359..ce2de65 100644 --- a/src/unist.rs +++ b/src/unist.rs @@ -73,3 +73,26 @@ impl fmt::Debug for Position { ) } } + +#[cfg(test)] +mod tests { + use super::*; + use alloc::format; + + #[test] + fn unist_test() { + let point = Point::new(1, 1, 0); + assert_eq!( + format!("{:?}", point), + "1:1 (0)", + "should support `Debug` on unist points" + ); + + let position = Position::new(1, 1, 0, 1, 3, 2); + assert_eq!( + format!("{:?}", position), + "1:1-1:3 (0-2)", + "should support `Debug` on unist positions" + ); + } +} -- cgit