on master help sign in
Fix failing test with unicode-lines feature (#3455)
commitd6e4fd15fc86eacbd083f29ed5d3669d3b2e7014 authorA-Walrus <58790821+A-Walrus@users.noreply.github.com> dateWed 17 Aug 2022, 04:37 (4 years ago) parent6618cf2
1 file changed+12−3
helix-core/src/line_ending.rs+12−3
helix-core/src/line_ending.rs+12−3
@@ -305,8 +305,17 @@ mod line_ending_tests {
305305 fn line_end_char_index_rope_slice() {
306306 let r = Rope::from_str("Hello\rworld\nhow\r\nare you?");
307307 let s = &r.slice(..);
308− assert_eq!(line_end_char_index(s, 0), 11);
309− assert_eq!(line_end_char_index(s, 1), 15);
310− assert_eq!(line_end_char_index(s, 2), 25);
308+ #[cfg(not(feature = "unicode-lines"))]
309+ {
310+ assert_eq!(line_end_char_index(s, 0), 11);
311+ assert_eq!(line_end_char_index(s, 1), 15);
312+ assert_eq!(line_end_char_index(s, 2), 25);
313+ }
314+ #[cfg(feature = "unicode-lines")]
315+ {
316+ assert_eq!(line_end_char_index(s, 0), 5);
317+ assert_eq!(line_end_char_index(s, 1), 11);
318+ assert_eq!(line_end_char_index(s, 2), 15);
319+ }
311320 }
312321}