From 42e1f7903dafc0fd5476aa00632ef5037437da3b Mon Sep 17 00:00:00 2001 From: Lawrence Chou Date: Tue, 26 Sep 2023 21:08:54 +0800 Subject: [PATCH] Test DoubleEndedIterator --- src/titlecase/ascii.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/titlecase/ascii.rs b/src/titlecase/ascii.rs index 45500ae90..9870dc122 100644 --- a/src/titlecase/ascii.rs +++ b/src/titlecase/ascii.rs @@ -292,4 +292,17 @@ mod tests { assert!(min <= count); assert!(count <= max.unwrap()); } + + #[test] + fn double_ended_iterator() { + let mut iter = Titlecase::with_slice(b"abc"); + assert_eq!(iter.next_back(), Some(b'c')); + assert_eq!(iter.next_back(), Some(b'b')); + assert_eq!(iter.next_back(), Some(b'A')); + + let mut iter = Titlecase::with_slice(b"abc"); + assert_eq!(iter.next(), Some(b'A')); + assert_eq!(iter.next_back(), Some(b'c')); + assert_eq!(iter.next_back(), Some(b'B')); // FIXME: Should be 'b' + } }