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 fbdab5c

Browse files
Add test to ensure it works when double-width and signle-width are mixed
1 parent bb47ac0 commit fbdab5c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎tests/formatter.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,3 +645,31 @@ fn test_point_to_double_width_characters_multiple() {
645645

646646
assert_eq!(DisplayList::from(snippets).to_string(), expected);
647647
}
648+
649+
#[test]
650+
fn test_point_to_double_width_characters_mixed() {
651+
let snippets = Snippet {
652+
slices: vec![snippet::Slice {
653+
source: "こんにちは、新しいWorld!",
654+
line_start: 1,
655+
origin: Some("<current file>"),
656+
annotations: vec![snippet::SourceAnnotation {
657+
range: (6, 14),
658+
label: "New world",
659+
annotation_type: snippet::AnnotationType::Error,
660+
}],
661+
fold: false,
662+
}],
663+
title: None,
664+
footer: vec![],
665+
opt: Default::default(),
666+
};
667+
668+
let expected = r#" --> <current file>:1:7
669+
|
670+
1 | こんにちは、新しいWorld!
671+
| ^^^^^^^^^^^ New world
672+
|"#;
673+
674+
assert_eq!(DisplayList::from(snippets).to_string(), expected);
675+
}

0 commit comments

Comments
(0)

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