Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bb47ac0

Browse files
Add test containing multiple snippets for double width characters
1 parent 29cfa73 commit bb47ac0

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

‎tests/formatter.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,3 +608,40 @@ fn test_point_to_double_width_characters_across_lines() {
608608

609609
assert_eq!(DisplayList::from(snippets).to_string(), expected);
610610
}
611+
612+
#[test]
613+
fn test_point_to_double_width_characters_multiple() {
614+
let snippets = Snippet {
615+
slices: vec![snippet::Slice {
616+
source: "お寿司\n食べたい🍣",
617+
line_start: 1,
618+
origin: Some("<current file>"),
619+
annotations: vec![
620+
snippet::SourceAnnotation {
621+
range: (0, 3),
622+
label: "Sushi1",
623+
annotation_type: snippet::AnnotationType::Error,
624+
},
625+
snippet::SourceAnnotation {
626+
range: (6, 8),
627+
label: "Sushi2",
628+
annotation_type: snippet::AnnotationType::Note,
629+
},
630+
],
631+
fold: false,
632+
}],
633+
title: None,
634+
footer: vec![],
635+
opt: Default::default(),
636+
};
637+
638+
let expected = r#" --> <current file>:1:1
639+
|
640+
1 | お寿司
641+
| ^^^^^^ Sushi1
642+
2 | 食べたい🍣
643+
| ---- note: Sushi2
644+
|"#;
645+
646+
assert_eq!(DisplayList::from(snippets).to_string(), expected);
647+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /