]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | use super::*; |
2 | use rustc_span::with_default_session_globals; | |
3 | ||
4 | #[test] | |
5 | fn test_block_doc_comment_1() { | |
6 | with_default_session_globals(|| { | |
7 | let comment = "\n * Test \n ** Test\n * Test\n"; | |
8 | let stripped = beautify_doc_string(Symbol::intern(comment)); | |
9 | assert_eq!(stripped.as_str(), " Test \n* Test\n Test"); | |
10 | }) | |
11 | } | |
12 | ||
13 | #[test] | |
14 | fn test_block_doc_comment_2() { | |
15 | with_default_session_globals(|| { | |
16 | let comment = "\n * Test\n * Test\n"; | |
17 | let stripped = beautify_doc_string(Symbol::intern(comment)); | |
18 | assert_eq!(stripped.as_str(), " Test\n Test"); | |
19 | }) | |
20 | } | |
21 | ||
22 | #[test] | |
23 | fn test_block_doc_comment_3() { | |
24 | with_default_session_globals(|| { | |
25 | let comment = "\n let a: *i32;\n *a = 5;\n"; | |
26 | let stripped = beautify_doc_string(Symbol::intern(comment)); | |
27 | assert_eq!(stripped.as_str(), " let a: *i32;\n *a = 5;"); | |
28 | }) | |
29 | } | |
30 | ||
31 | #[test] | |
32 | fn test_line_doc_comment() { | |
33 | with_default_session_globals(|| { | |
34 | let stripped = beautify_doc_string(Symbol::intern(" test")); | |
35 | assert_eq!(stripped.as_str(), " test"); | |
36 | let stripped = beautify_doc_string(Symbol::intern("! test")); | |
37 | assert_eq!(stripped.as_str(), "! test"); | |
38 | let stripped = beautify_doc_string(Symbol::intern("test")); | |
39 | assert_eq!(stripped.as_str(), "test"); | |
40 | let stripped = beautify_doc_string(Symbol::intern("!test")); | |
41 | assert_eq!(stripped.as_str(), "!test"); | |
42 | }) | |
43 | } |