summaryrefslogtreecommitdiffstats
path: root/vendor/pulldown-cmark/tests/errors.rs
blob: cac34798d8c86f7f3dd54b4edb5c16e29e6c584b (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
use pulldown_cmark::{Options, Parser};

fn parse(md: &str) {
    let parser = Parser::new(md);

    for _ in parser {}
}

fn parse_all_options(md: &str) {
    let parser = Parser::new_ext(md, Options::all());

    for _ in parser {}
}

#[test]
fn test_lists_inside_code_spans() {
    parse(
        r"- `
x
**
  *
  `",
    );
}

#[test]
fn test_fuzzer_input_1() {
    parse(">\n >>><N\n");
}

#[test]
fn test_fuzzer_input_2() {
    parse(" \u{b}\\\r- ");
}

#[test]
fn test_fuzzer_input_3() {
    parse_all_options("\n # #\r\u{1c} ");
}

#[test]
fn test_fuzzer_input_4() {
    parse_all_options("\u{0}{\tϐ}\n-");
}

#[test]
fn test_fuzzer_input_5() {
    parse_all_options(" \u{c}{}\n-\n");
}

#[test]
fn test_fuzzer_input_6() {
    parse("*\t[][\n\t<p]>\n\t[]");
}

#[test]
fn test_fuzzer_input_7() {
    parse_all_options("[][{]}\n-");
}

#[test]
fn test_fuzzer_input_8() {
    parse_all_options("a\n \u{c}{}\n-");
}

#[test]
fn test_fuzzer_input_9() {
    parse_all_options("a\n \u{c}{}\\\n-");
}

#[test]
fn test_fuzzer_input_10() {
    parse_all_options("[[    \t\n   \u{c}\u{c}\u{c}\u{c}\u{c}    {}\n-\r\u{e}\u{0}\u{0}{# }\n\u{b}\u{b}\u{b}\u{b}\u{b}\u{b}\u{b}\u{b}\u{b}\u{b}\u{0}\u{0}");
}

#[test]
fn test_fuzzer_input_11() {
    parse_all_options(
        "[[\u{c}\u{c}   \t\n   \u{c}\u{c}\u{c}\u{c}\u{c}\u{c}\u{c}\u{c}\u{c}       {}\n-\r\u{e}",
    );
}

#[test]
fn test_fuzzer_input_12() {
    parse_all_options("\u{c}-\n\u{c}\n-");
}

#[test]
fn test_wrong_code_block() {
    parse(
        r##"```
 * ```
 "##,
    );
}

#[test]
fn test_unterminated_link() {
    parse("[](\\");
}

#[test]
fn test_unterminated_autolink() {
    parse("<a");
}

#[test]
fn test_infinite_loop() {
    parse("[<!W\n\\\n");
}

#[test]
fn test_html_tag() {
    parse("<script\u{feff}");
}

// all of test_bad_slice_* were found in https://github.com/raphlinus/pulldown-cmark/issues/521
#[test]
fn test_bad_slice_a() {
    parse("><a\n");
}

#[test]
fn test_bad_slice_b() {
    parse("><a a\n");
}

#[test]
fn test_bad_slice_unicode() {
    parse("><a a=\n毿>")
}