From f16aa7b18d1ccf3ac1c9dd7245f3ec96ed9424aa Mon Sep 17 00:00:00 2001 From: Nikita Revenco <154856872+nikitarevenco@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:13:25 +0000 Subject: [PATCH] test: add several more tests --- helix-core/src/surround.rs | 108 ++++++++++++++++++++++++++++++++----- 1 file changed, 96 insertions(+), 12 deletions(-) diff --git a/helix-core/src/surround.rs b/helix-core/src/surround.rs index 2d4242b39..fada7c5c6 100644 --- a/helix-core/src/surround.rs +++ b/helix-core/src/surround.rs @@ -439,7 +439,7 @@ pub fn find_prev_tag( loop { let prev_char = match chars.prev() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos -= 1; @@ -448,7 +448,7 @@ pub fn find_prev_tag( loop { let current_char = match chars.prev() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos -= 1; if current_char == '<' { @@ -485,13 +485,13 @@ pub fn find_next_tag( loop { let next_char = match chars.next() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos += 1; if next_char == '<' { let char_after_that = match chars.next() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos += 1; if char_after_that == '/' { @@ -499,7 +499,7 @@ pub fn find_next_tag( loop { let current_char = match chars.next() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos += 1; if is_valid_tagname_char(current_char) { @@ -665,7 +665,7 @@ mod test { } #[test] - fn test_find_surrounding_tag_with_imposter() { + fn test_find_surrounding_tag_with_extra_closing_tag() { let (doc, selection, expectations) = rope_with_selections_and_expectations_tags( "