From 89fe2ffa3ec84266636fe8d29d1aa57bcce56552 Mon Sep 17 00:00:00 2001
From: Nikita Revenco <154856872+nikitarevenco@users.noreply.github.com>
Date: Wed, 13 Nov 2024 18:49:35 +0000
Subject: [PATCH] test: use new util function to test ranges of html tags and
their names
---
helix-core/src/surround.rs | 299 ++++++++++++++++---------------------
1 file changed, 130 insertions(+), 169 deletions(-)
diff --git a/helix-core/src/surround.rs b/helix-core/src/surround.rs
index da54fe61a..2d4242b39 100644
--- a/helix-core/src/surround.rs
+++ b/helix-core/src/surround.rs
@@ -541,147 +541,6 @@ mod test {
);
}
- #[test]
- fn test_find_next_tag() {
- let doc = Rope::from("hello");
-
- assert_eq!(
- find_next_tag(doc.slice(..), 7, 1).unwrap(),
- (
- Range::new(12, 14),
- String::from("tag"),
- doc.to_string().len()
- )
- );
- }
-
- #[test]
- fn test_find_next_tag_broken() {
- let doc = Rope::from("hello");
-
- assert_eq!(
- find_next_tag(doc.slice(..), 7, 1).unwrap(),
- (
- Range::new(18, 28),
- String::from("Hello.World"),
- doc.to_string().len()
- )
- );
- }
-
- #[test]
- fn test_find_prev_tag() {
- let doc = Rope::from("hello");
-
- assert_eq!(
- find_prev_tag(doc.slice(..), 7, 1).unwrap(),
- (Range::new(1, 3), String::from("tag"), 0)
- );
- }
-
- #[test]
- fn test_find_prev_tag_broken() {
- let doc = Rope::from(" ");
-
- assert_eq!(
- find_prev_tag(doc.slice(..), 32, 1).unwrap(),
- (Range::new(1, 11), String::from("Hello.World"), 0)
- );
- }
-
- #[test]
- fn test_find_surrounding_tag_simple() {
- #[rustfmt::skip]
- let (doc, selection, _expectations) =
- rope_with_selections_and_expectations_tags(
- " simple example ",
- " ____ ^ ____ "
- );
-
- assert_eq!(
- get_surround_pos_tag(doc.slice(..), &selection, 1),
- Ok(vec![(
- (Range::new(1, 4), Range::new(24, 27)),
- String::from("html")
- )])
- );
- }
-
- // #[test]
- // fn test_find_surrounding_tag_with_imposter() {
- // #[rustfmt::skip]
- // let (doc, selection, expectations) =
- // rope_with_selections_and_expectations_tags(
- // " simple example