aboutsummaryrefslogtreecommitdiffstats
path: root/src/unist.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-13 15:43:37 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-13 15:43:37 +0200
commit5ad84c1670733843f677b2c5bee8c50d78b8e24a (patch)
treec29cb45cc43849105987d46d4fd0883e5cc47519 /src/unist.rs
parentb220a42caf0066de6f12e0fba0782aee529dd054 (diff)
downloadmarkdown-rs-5ad84c1670733843f677b2c5bee8c50d78b8e24a.tar.gz
markdown-rs-5ad84c1670733843f677b2c5bee8c50d78b8e24a.tar.bz2
markdown-rs-5ad84c1670733843f677b2c5bee8c50d78b8e24a.zip
Add a couple tests for `Debug` on unist interfaces
Diffstat (limited to 'src/unist.rs')
-rw-r--r--src/unist.rs23
1 files changed, 23 insertions, 0 deletions
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"
+ );
+ }
+}