From 33cbf8908d4cf1c971128ee35e7bd2ea50225b63 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 6 Feb 2022 22:21:09 +0100 Subject: Add test for block doc comments horizontal trim --- compiler/rustc_ast/src/util/comments/tests.rs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'compiler/rustc_ast/src') diff --git a/compiler/rustc_ast/src/util/comments/tests.rs b/compiler/rustc_ast/src/util/comments/tests.rs index 0b8772947e6..11d50603a10 100644 --- a/compiler/rustc_ast/src/util/comments/tests.rs +++ b/compiler/rustc_ast/src/util/comments/tests.rs @@ -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 - * - ", - ), - CommentKind::Block, - ); + 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("\n * a\n "), CommentKind::Block); + assert_eq!(stripped.as_str(), " a\n"); }) } -- cgit 1.4.1-3-g733a5