about summary refs log tree commit diff
path: root/compiler/rustc_ast/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-02-06 22:21:09 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-02-07 17:07:53 +0100
commit33cbf8908d4cf1c971128ee35e7bd2ea50225b63 (patch)
tree1421dc8530d9c8ed98a7ca11b36bfcc2e8e0866b /compiler/rustc_ast/src
parente3942874a06677f17be284f27b5494531cc7224a (diff)
downloadrust-33cbf8908d4cf1c971128ee35e7bd2ea50225b63.tar.gz
rust-33cbf8908d4cf1c971128ee35e7bd2ea50225b63.zip
Add test for block doc comments horizontal trim
Diffstat (limited to 'compiler/rustc_ast/src')
-rw-r--r--compiler/rustc_ast/src/util/comments/tests.rs20
1 files changed, 6 insertions, 14 deletions
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");
     })
 }