aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-09-04 09:06:51 +0200
committerMartin Fischer <martin@push-f.com>2023-09-28 07:26:44 +0200
commitf434e817fad59bc4b4f03c65c19a035f415aee1a (patch)
tree01d8d7f34fea2c744e4ae91c40913b61f3aa8680
parent049e17c0a3a0a522db90fbdbb3cf1c5106fb15fb (diff)
chore: make assert_char_encoding_independence more readable
-rw-r--r--tests/test_spans.rs9
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,