summary refs log tree commit diff
path: root/src/libsyntax/parse/lexer/comments/tests.rs
blob: f9cd69fb50d7472c9b3044c9c5f2fc3be279cdb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use super::*;

#[test]
fn test_block_doc_comment_1() {
    let comment = "/**\n * Test \n **  Test\n *   Test\n*/";
    let stripped = strip_doc_comment_decoration(comment);
    assert_eq!(stripped, " Test \n*  Test\n   Test");
}

#[test]
fn test_block_doc_comment_2() {
    let comment = "/**\n * Test\n *  Test\n*/";
    let stripped = strip_doc_comment_decoration(comment);
    assert_eq!(stripped, " Test\n  Test");
}

#[test]
fn test_block_doc_comment_3() {
    let comment = "/**\n let a: *i32;\n *a = 5;\n*/";
    let stripped = strip_doc_comment_decoration(comment);
    assert_eq!(stripped, " let a: *i32;\n *a = 5;");
}

#[test]
fn test_block_doc_comment_4() {
    let comment = "/*******************\n test\n *********************/";
    let stripped = strip_doc_comment_decoration(comment);
    assert_eq!(stripped, " test");
}

#[test]
fn test_line_doc_comment() {
    let stripped = strip_doc_comment_decoration("/// test");
    assert_eq!(stripped, " test");
    let stripped = strip_doc_comment_decoration("///! test");
    assert_eq!(stripped, " test");
    let stripped = strip_doc_comment_decoration("// test");
    assert_eq!(stripped, " test");
    let stripped = strip_doc_comment_decoration("// test");
    assert_eq!(stripped, " test");
    let stripped = strip_doc_comment_decoration("///test");
    assert_eq!(stripped, "test");
    let stripped = strip_doc_comment_decoration("///!test");
    assert_eq!(stripped, "test");
    let stripped = strip_doc_comment_decoration("//test");
    assert_eq!(stripped, "test");
}