mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 03:42:17 +00:00
preserve multiline string trailing whitespace
This commit is contained in:
parent
7be537dd55
commit
1551d8fb0d
2 changed files with 9 additions and 2 deletions
|
@ -627,8 +627,8 @@ fn fmt_str_body(body: &str, buf: &mut Buf) {
|
||||||
'\u{200c}' => buf.push_str("\\u(200c)"),
|
'\u{200c}' => buf.push_str("\\u(200c)"),
|
||||||
'\u{feff}' => buf.push_str("\\u(feff)"),
|
'\u{feff}' => buf.push_str("\\u(feff)"),
|
||||||
// Don't change anything else in the string
|
// Don't change anything else in the string
|
||||||
' ' => buf.spaces(1),
|
' ' => buf.push_str_allow_spaces(" "),
|
||||||
'\n' => buf.newline(),
|
'\n' => buf.push_str_allow_spaces("\n"),
|
||||||
_ => buf.push(c),
|
_ => buf.push(c),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6379,6 +6379,13 @@ mod test_fmt {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn preserve_multiline_string_trailing_whitespace() {
|
||||||
|
expr_formats_same(indoc!(
|
||||||
|
"x =\n \"\"\"\n foo\n bar \n baz\n \"\"\"\nx"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// this is a parse error atm
|
// this is a parse error atm
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn multiline_apply() {
|
// fn multiline_apply() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue