1
Fork 0

Add test for block doc comments horizontal trim

This commit is contained in:
Guillaume Gomez 2022-02-06 22:21:09 +01:00
parent e3942874a0
commit 33cbf8908d
3 changed files with 28 additions and 15 deletions

View file

@ -45,25 +45,17 @@ fn test_line_doc_comment() {
#[test]
fn test_doc_blocks() {
create_default_session_globals_then(|| {
let stripped =
beautify_doc_string(Symbol::intern(" # Returns\n *\n "), CommentKind::Block);
assert_eq!(stripped.as_str(), " # Returns\n\n");
let stripped = beautify_doc_string(
Symbol::intern(
" # Returns
*
",
),
Symbol::intern("\n * # Returns\n *\n "),
CommentKind::Block,
);
assert_eq!(stripped.as_str(), " # Returns\n\n");
let stripped = beautify_doc_string(
Symbol::intern(
"
* # Returns
*
",
),
CommentKind::Block,
);
assert_eq!(stripped.as_str(), " # Returns\n\n");
let stripped = beautify_doc_string(Symbol::intern("\n * a\n "), CommentKind::Block);
assert_eq!(stripped.as_str(), " a\n");
})
}