aboutsummaryrefslogtreecommitdiffstats
path: root/tests/misc_zero.rs
blob: 47aa8ed9ec955eabf948421644ddb61dfd78901b (plain) (blame)
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
extern crate micromark;
use micromark::micromark;

#[test]
fn zero() {
    assert_eq!(micromark(""), "", "should support no markdown");

    assert_eq!(
        micromark("asd\0asd"),
        "<p>asd�asd</p>",
        "should replace `\\0` w/ a replacement characters (`�`)"
    );

    assert_eq!(
        micromark("&#0;"),
        "<p>�</p>",
        "should replace NUL in a character reference"
    );

    // This doesn’t make sense in markdown, as character escapes only work on
    // ascii punctuation, but it’s good to demonstrate the behavior.
    assert_eq!(
        micromark("\\0"),
        "<p>\\0</p>",
        "should not support NUL in a character escape"
    );
}