Add test for block doc comments horizontal trim
This commit is contained in:
parent
e3942874a0
commit
33cbf8908d
3 changed files with 28 additions and 15 deletions
|
@ -45,25 +45,17 @@ fn test_line_doc_comment() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_doc_blocks() {
|
fn test_doc_blocks() {
|
||||||
create_default_session_globals_then(|| {
|
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(
|
let stripped = beautify_doc_string(
|
||||||
Symbol::intern(
|
Symbol::intern("\n * # Returns\n *\n "),
|
||||||
" # Returns
|
|
||||||
*
|
|
||||||
",
|
|
||||||
),
|
|
||||||
CommentKind::Block,
|
CommentKind::Block,
|
||||||
);
|
);
|
||||||
assert_eq!(stripped.as_str(), " # Returns\n\n");
|
assert_eq!(stripped.as_str(), " # Returns\n\n");
|
||||||
|
|
||||||
let stripped = beautify_doc_string(
|
let stripped = beautify_doc_string(Symbol::intern("\n * a\n "), CommentKind::Block);
|
||||||
Symbol::intern(
|
assert_eq!(stripped.as_str(), " a\n");
|
||||||
"
|
|
||||||
* # Returns
|
|
||||||
*
|
|
||||||
",
|
|
||||||
),
|
|
||||||
CommentKind::Block,
|
|
||||||
);
|
|
||||||
assert_eq!(stripped.as_str(), " # Returns\n\n");
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
16
src/test/rustdoc-ui/block-doc-comment.rs
Normal file
16
src/test/rustdoc-ui/block-doc-comment.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// check-pass
|
||||||
|
// compile-flags:--test
|
||||||
|
|
||||||
|
// This test ensures that no code block is detected in the doc comments.
|
||||||
|
|
||||||
|
pub mod Wormhole {
|
||||||
|
/** # Returns
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
pub fn foofoo() {}
|
||||||
|
/**
|
||||||
|
* # Returns
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
pub fn barbar() {}
|
||||||
|
}
|
5
src/test/rustdoc-ui/block-doc-comment.stdout
Normal file
5
src/test/rustdoc-ui/block-doc-comment.stdout
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
running 0 tests
|
||||||
|
|
||||||
|
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue