]>
Commit | Line | Data |
---|---|---|
a2a8927a XL |
1 | use pulldown_cmark::Parser; |
2 | ||
3 | fn parse(md: &str) { | |
4 | let parser = Parser::new(md); | |
5 | ||
6 | for _ in parser {} | |
7 | } | |
8 | ||
9 | #[test] | |
10 | fn test_lists_inside_code_spans() { | |
11 | parse( | |
12 | r"- ` | |
13 | x | |
14 | ** | |
15 | * | |
16 | `", | |
17 | ); | |
18 | } | |
1b1a35ee XL |
19 | |
20 | #[test] | |
21 | fn test_wrong_code_block() { | |
a2a8927a XL |
22 | parse( |
23 | r##"``` | |
1b1a35ee | 24 | * ``` |
a2a8927a XL |
25 | "##, |
26 | ); | |
1b1a35ee XL |
27 | } |
28 | ||
29 | #[test] | |
30 | fn test_unterminated_link() { | |
a2a8927a | 31 | parse("[](\\"); |
1b1a35ee XL |
32 | } |
33 | ||
34 | #[test] | |
35 | fn test_unterminated_autolink() { | |
a2a8927a | 36 | parse("<a"); |
1b1a35ee XL |
37 | } |
38 | ||
39 | #[test] | |
40 | fn test_infinite_loop() { | |
a2a8927a | 41 | parse("[<!W\n\\\n"); |
1b1a35ee XL |
42 | } |
43 | ||
44 | #[test] | |
45 | fn test_html_tag() { | |
a2a8927a XL |
46 | parse("<script\u{feff}"); |
47 | } | |
1b1a35ee | 48 | |
a2a8927a XL |
49 | // all of test_bad_slice_* were found in https://github.com/raphlinus/pulldown-cmark/issues/521 |
50 | #[test] | |
51 | fn test_bad_slice_a() { | |
52 | parse("><a\n"); | |
53 | } | |
54 | ||
55 | #[test] | |
56 | fn test_bad_slice_b() { | |
57 | parse("><a a\n"); | |
58 | } | |
59 | ||
60 | #[test] | |
61 | fn test_bad_slice_unicode() { | |
62 | parse("><a a=\n毿>") | |
1b1a35ee | 63 | } |