aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-12-13 12:26:05 +0400
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-12-13 12:26:05 +0400
commitf87525c39d631f99f879c0be761af1ca39524952 (patch)
treee075de65da93d995c52a49f87b1865b4f6a781b6 /src/util
parentb417a89d6c33649bfa3e6fa1b951cd2ad9803299 (diff)
downloadmarkdown-rs-f87525c39d631f99f879c0be761af1ca39524952.tar.gz
markdown-rs-f87525c39d631f99f879c0be761af1ca39524952.tar.bz2
markdown-rs-f87525c39d631f99f879c0be761af1ca39524952.zip
Add some tests for `Location`
Diffstat (limited to 'src/util')
-rw-r--r--src/util/location.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util/location.rs b/src/util/location.rs
index deff307..87d2ad8 100644
--- a/src/util/location.rs
+++ b/src/util/location.rs
@@ -196,4 +196,19 @@ mod tests {
"should support some points (4)"
);
}
+ #[test]
+ fn test_empty() {
+ let location = Location::new("".as_bytes());
+ assert_eq!(location.to_point(0), Some(Point::new(1, 1, 0)), "to_point");
+ assert_eq!(
+ location.relative_to_point(&[], 0),
+ None,
+ "relative_to_point"
+ );
+ assert_eq!(
+ Location::relative_to_absolute(&[], 0),
+ None,
+ "relative_to_absolute"
+ );
+ }
}