summaryrefslogtreecommitdiff
path: root/tests/self-doc.rs
blob: 936456633f8076097c4f27d4af3125b3bb6d1cde (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
#[test]
fn ensure_it_compiles() {
    document_features::document_features!();
    document_features::document_features!(feature_label = "**`{feature}`**");
    document_features::document_features!(feature_label = r"**`{feature}`**");
    document_features::document_features!(feature_label = r#"**`{feature}`**"#);
    document_features::document_features!(
        feature_label = "<span class=\"stab portability\"><code>{feature}</code></span>"
    );
    document_features::document_features!(
        feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#
    );
    document_features::document_features!(
        feature_label = r##"<span class="stab portability"><code>{feature}</code></span>"##
    );
}

#[test]
fn self_doc() {
    let actual = document_features::document_features!();
    let expected =
        "* **`self-test`** —  Internal feature used only for the tests, don't enable\n\n";
    assert_eq!(actual, expected);
}

#[test]
fn self_doc_with_custom_label() {
    let actual = document_features::document_features!(
        feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#
    );
    let expected =
        "* <span class=\"stab portability\"><code>self-test</code></span> —  Internal feature used only for the tests, don't enable\n\n";
    assert_eq!(actual, expected);
    let actual2 = document_features::document_features!(
        feature_label = "<span class=\"stab\u{0020}portability\"><code>{feature}</code></span>"
    );
    assert_eq!(actual2, expected);
}