From d4a25294395b99b988ef0479efcb217ff706f40f Mon Sep 17 00:00:00 2001 From: Don Isaac Date: Sun, 20 Oct 2024 15:39:14 -0400 Subject: [PATCH] test(span): add `Span::is_empty` unit tests (#6706) --- crates/oxc_span/src/span/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/oxc_span/src/span/mod.rs b/crates/oxc_span/src/span/mod.rs index 8fb94109c..4d66624b0 100644 --- a/crates/oxc_span/src/span/mod.rs +++ b/crates/oxc_span/src/span/mod.rs @@ -401,6 +401,17 @@ impl<'a> CloneIn<'a> for Span { mod test { use super::Span; + #[test] + fn test_size() { + let s = Span::sized(0, 5); + assert_eq!(s.size(), 5); + assert!(!s.is_empty()); + + let s = Span::sized(5, 0); + assert_eq!(s.size(), 0); + assert!(s.is_empty()); + } + #[test] fn test_hash() { use std::hash::{DefaultHasher, Hash, Hasher}; @@ -410,6 +421,7 @@ mod test { Span::new(0, 5).hash(&mut second); assert_eq!(first.finish(), second.finish()); } + #[test] fn test_eq() { assert_eq!(Span::new(0, 0), Span::new(0, 0));