2 use rustc_span::with_default_session_globals;
5 fn line_doc_comments() {
6 assert!(line_doc_comment_style("///").is_some());
7 assert!(line_doc_comment_style("/// blah").is_some());
8 assert!(line_doc_comment_style("////").is_none());
12 fn test_block_doc_comment_1() {
13 with_default_session_globals(|| {
14 let comment = "\n * Test \n ** Test\n * Test\n";
15 let stripped = beautify_doc_string(Symbol::intern(comment));
16 assert_eq!(stripped, " Test \n* Test\n Test");
21 fn test_block_doc_comment_2() {
22 with_default_session_globals(|| {
23 let comment = "\n * Test\n * Test\n";
24 let stripped = beautify_doc_string(Symbol::intern(comment));
25 assert_eq!(stripped, " Test\n Test");
30 fn test_block_doc_comment_3() {
31 with_default_session_globals(|| {
32 let comment = "\n let a: *i32;\n *a = 5;\n";
33 let stripped = beautify_doc_string(Symbol::intern(comment));
34 assert_eq!(stripped, " let a: *i32;\n *a = 5;");
39 fn test_line_doc_comment() {
40 with_default_session_globals(|| {
41 let stripped = beautify_doc_string(Symbol::intern(" test"));
42 assert_eq!(stripped, " test");
43 let stripped = beautify_doc_string(Symbol::intern("! test"));
44 assert_eq!(stripped, "! test");
45 let stripped = beautify_doc_string(Symbol::intern("test"));
46 assert_eq!(stripped, "test");
47 let stripped = beautify_doc_string(Symbol::intern("!test"));
48 assert_eq!(stripped, "!test");