Skip to content

Commit

Permalink
Fix tests for surround primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
sudormrfbin authored and archseer committed Apr 29, 2022
1 parent 76175db commit 22ae1b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions helix-core/src/surround.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ mod test {

// cursor on s[o]me, c[h]ars, newl[i]ne
assert_eq!(
get_surround_pos(slice, &selection, '(', 1)
get_surround_pos(slice, &selection, Some('('), 1)
.unwrap()
.as_slice(),
&[0, 5, 7, 13, 15, 23]
Expand All @@ -359,7 +359,7 @@ mod test {
Selection::new(SmallVec::from_slice(&[Range::point(2), Range::point(9)]), 0);
// cursor on s[o]me, c[h]ars
assert_eq!(
get_surround_pos(slice, &selection, '(', 1),
get_surround_pos(slice, &selection, Some('('), 1),
Err(Error::PairNotFound) // different surround chars
);

Expand All @@ -369,15 +369,15 @@ mod test {
);
// cursor on [x]x, newli[n]e
assert_eq!(
get_surround_pos(slice, &selection, '(', 1),
get_surround_pos(slice, &selection, Some('('), 1),
Err(Error::PairNotFound) // overlapping surround chars
);

let selection =
Selection::new(SmallVec::from_slice(&[Range::point(2), Range::point(3)]), 0);
// cursor on s[o][m]e
assert_eq!(
get_surround_pos(slice, &selection, '[', 1),
get_surround_pos(slice, &selection, Some('['), 1),
Err(Error::CursorOverlap)
);
}
Expand Down

0 comments on commit 22ae1b9

Please sign in to comment.