Skip to content

Commit

Permalink
refactor: more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Dec 6, 2024
1 parent 061ce1e commit 07ce116
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/rope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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);
Expand Down

0 comments on commit 07ce116

Please sign in to comment.