From 07ce116b074a586a14cc99cf119c320140e8fcb5 Mon Sep 17 00:00:00 2001 From: Hana Date: Sat, 7 Dec 2024 01:49:15 +0800 Subject: [PATCH] refactor: more tests --- src/rope.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/rope.rs b/src/rope.rs index 080bd51..4be3644 100644 --- a/src/rope.rs +++ b/src/rope.rs @@ -401,14 +401,19 @@ mod tests { // empty slice let rope = a.byte_slice(0..0); assert_eq!(rope.to_string(), "".to_string()); + + // slice with len + let rope = Rope::from_str("abc"); + let rope = rope.byte_slice(3..3); + assert_eq!(rope.to_string(), "".to_string()) } #[test] #[should_panic] - fn slice_panics_range_start_out_of_bound() { + fn slice_panics_range_start_out_of_bounds() { let mut a = Rope::new(); a.append("abc"); - a.byte_slice(3..3); + a.byte_slice(3..4); } #[test] @@ -421,7 +426,7 @@ mod tests { #[test] #[should_panic] - fn slice_panics_range_end_out_of_bound() { + fn slice_panics_range_end_out_of_bounds() { let mut a = Rope::new(); a.append("abc"); a.byte_slice(0..4);