diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_spans.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/test_spans.rs b/tests/test_spans.rs index a8bf97c..0b0e156 100644 --- a/tests/test_spans.rs +++ b/tests/test_spans.rs @@ -540,10 +540,13 @@ fn assert_char_encoding_independence<S: AsRef<str> + Clone>( let utf16_tokens = NaiveParser::new(PosTrackingReader::new(Utf16Reader(string_reader))).flatten(); let utf8_labels = labeler(Box::new(utf8_tokens)); + let utf16_labels = labeler(Box::new(utf16_tokens)); - for (idx, (span, _)) in labeler(Box::new(utf16_tokens)).into_iter().enumerate() { - let expected_utf16_span = html[..utf8_labels[idx].0.start].encode_utf16().count() * 2 - ..html[..utf8_labels[idx].0.end].encode_utf16().count() * 2; + for (idx, (span, _)) in utf16_labels.into_iter().enumerate() { + let expected_utf16_span = Range { + start: html[..utf8_labels[idx].0.start].encode_utf16().count() * 2, + end: html[..utf8_labels[idx].0.end].encode_utf16().count() * 2, + }; assert_eq!( span, expected_utf16_span, |