test(span): add Span::is_empty unit tests (#6706)

This commit is contained in:
Don Isaac 2024-10-20 15:39:14 -04:00 committed by GitHub
parent f99528d3c2
commit d4a2529439
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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));