Debian Codegraph @

src/tests/spoiler.rs

raw
1 use super::*;
2
3 #[test]
4 fn spoiler() {
5 html_opts!(
6 [extension.spoiler],
7 "The ||dog dies at the end of Marley and Me||.\n",
8 "<p>The <span class=\"spoiler\">dog dies at the end of Marley and Me</span>.</p>\n",
9 );
10 }
11
12 #[test]
13 fn spoiler_in_table() {
14 html_opts!(
15 [extension.table, extension.spoiler],
16 "Text | Result\n--- | ---\n`||some clever text||` | ||some clever text||\n",
17 concat!(
18 "<table>\n",
19 "<thead>\n",
20 "<tr>\n",
21 "<th>Text</th>\n",
22 "<th>Result</th>\n",
23 "</tr>\n",
24 "</thead>\n",
25 "<tbody>\n",
26 "<tr>\n",
27 "<td><code>||some clever text||</code></td>\n",
28 "<td><span class=\"spoiler\">some clever text</span></td>\n",
29 "</tr>\n",
30 "</tbody>\n",
31 "</table>\n"
32 ),
33 );
34 }
35
36 #[test]
37 fn spoiler_regressions() {
38 html_opts!(
39 [extension.spoiler],
40 "|should not be spoiler|\n||should be spoiler||\n|||should be spoiler surrounded by pipes|||",
41 concat!(
42 "<p>|should not be spoiler|\n",
43 "<span class=\"spoiler\">should be spoiler</span>\n",
44 "|<span class=\"spoiler\">should be spoiler surrounded by pipes</span>|</p>\n"
45 ),
46 );
47 }
48
49 #[test]
50 fn mismatched_spoilers() {
51 html_opts!(
52 [extension.spoiler],
53 "|||this is a spoiler with pipe in front||\n||this is not a spoiler|\n||this is a spoiler with pipe after|||",
54 concat!(
55 "<p>|<span class=\"spoiler\">this is a spoiler with pipe in front</span>\n",
56 "||this is not a spoiler|\n",
57 "<span class=\"spoiler\">this is a spoiler with pipe after</span>|</p>\n"
58 ),
59 );
60 }