From f87525c39d631f99f879c0be761af1ca39524952 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 13 Dec 2022 12:26:05 +0400 Subject: Add some tests for `Location` --- src/util/location.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') 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" + ); + } } -- cgit