Skip to content

Commit 1696f56

Browse files
committed
Move footnote expected HTML to a separate file
This output is starting to get a little long, so this moves it to a separate file to keep things a little more tidy.
1 parent 9b12c51 commit 1696f56

File tree

2 files changed

+43
-41
lines changed

2 files changed

+43
-41
lines changed

tests/testsuite/markdown.rs

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Tests for special markdown rendering.
22
33
use crate::prelude::*;
4+
use snapbox::file;
45

56
// Checks custom header id and classes.
67
#[test]
@@ -16,47 +17,10 @@ fn custom_header_attributes() {
1617
// Test for a variety of footnote renderings.
1718
#[test]
1819
fn footnotes() {
19-
BookTest::from_dir("markdown/footnotes")
20-
.check_main_file("book/footnotes.html", str![[r##"
21-
<h1 id="footnote-tests"><a class="header" href="#footnote-tests">Footnote tests</a></h1>
22-
<p>Footnote example<sup class="footnote-reference" id="fr-1-1"><a href="#footnote-1">1</a></sup>, or with a word<sup class="footnote-reference" id="fr-word-1"><a href="#footnote-word">2</a></sup>.</p>
23-
<p>There are multiple references to word<sup class="footnote-reference" id="fr-word-2"><a href="#footnote-word">2</a></sup>.</p>
24-
<p>Footnote without a paragraph<sup class="footnote-reference" id="fr-para-1"><a href="#footnote-para">3</a></sup></p>
25-
<p>Footnote with multiple paragraphs<sup class="footnote-reference" id="fr-multiple-1"><a href="#footnote-multiple">4</a></sup></p>
26-
<p>Footnote name with wacky characters<sup class="footnote-reference" id="fr-&quot;wacky&quot;-1"><a href="#footnote-&quot;wacky&quot;">5</a></sup></p>
27-
<p>Testing when referring to something earlier.<sup class="footnote-reference" id="fr-define-before-use-1"><a href="#footnote-define-before-use">6</a></sup></p>
28-
<hr>
29-
<ol class="footnote-definition"><li id="footnote-1">
30-
<p>This is a footnote. <a href="#fr-1-1">↩</a> <a href="#fr-1-2">↩2</a></p>
31-
</li>
32-
<li id="footnote-word">
33-
<p>A longer footnote.
34-
With multiple lines. <a href="other.html">Link to other</a>.
35-
With a reference inside.<sup class="footnote-reference" id="fr-1-2"><a href="#footnote-1">1</a></sup> <a href="#fr-word-1">↩</a> <a href="#fr-word-2">↩2</a></p>
36-
</li>
37-
<li id="footnote-para">
38-
<ol>
39-
<li>Item one
40-
<ol>
41-
<li>Sub-item</li>
42-
</ol>
43-
</li>
44-
<li>Item two</li>
45-
</ol>
46-
<a href="#fr-para-1">↩</a></li>
47-
<li id="footnote-multiple">
48-
<p>One</p>
49-
<p>Two</p>
50-
<p>Three <a href="#fr-multiple-1">↩</a></p>
51-
</li>
52-
<li id="footnote-&quot;wacky&quot;">
53-
<p>Testing footnote id with special characters. <a href="#fr-&quot;wacky&quot;-1">↩</a></p>
54-
</li>
55-
<li id="footnote-define-before-use">
56-
<p>This is defined before it is referred to. <a href="#fr-define-before-use-1">↩</a></p>
57-
</li>
58-
</ol>
59-
"##]]);
20+
BookTest::from_dir("markdown/footnotes").check_main_file(
21+
"book/footnotes.html",
22+
file!["markdown/footnotes/expected/footnotes.html"],
23+
);
6024
}
6125

6226
// Basic table test.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<h1 id="footnote-tests"><a class="header" href="#footnote-tests">Footnote tests</a></h1>
2+
<p>Footnote example<sup class="footnote-reference" id="fr-1-1"><a href="#footnote-1">1</a></sup>, or with a word<sup class="footnote-reference" id="fr-word-1"><a href="#footnote-word">2</a></sup>.</p>
3+
<p>There are multiple references to word<sup class="footnote-reference" id="fr-word-2"><a href="#footnote-word">2</a></sup>.</p>
4+
<p>Footnote without a paragraph<sup class="footnote-reference" id="fr-para-1"><a href="#footnote-para">3</a></sup></p>
5+
<p>Footnote with multiple paragraphs<sup class="footnote-reference" id="fr-multiple-1"><a href="#footnote-multiple">4</a></sup></p>
6+
<p>Footnote name with wacky characters<sup class="footnote-reference" id="fr-&quot;wacky&quot;-1"><a href="#footnote-&quot;wacky&quot;">5</a></sup></p>
7+
<p>Testing when referring to something earlier.<sup class="footnote-reference" id="fr-define-before-use-1"><a href="#footnote-define-before-use">6</a></sup></p>
8+
<hr>
9+
<ol class="footnote-definition"><li id="footnote-1">
10+
<p>This is a footnote. <a href="#fr-1-1"></a> <a href="#fr-1-2">↩2</a></p>
11+
</li>
12+
<li id="footnote-word">
13+
<p>A longer footnote.
14+
With multiple lines. <a href="other.html">Link to other</a>.
15+
With a reference inside.<sup class="footnote-reference" id="fr-1-2"><a href="#footnote-1">1</a></sup> <a href="#fr-word-1"></a> <a href="#fr-word-2">↩2</a></p>
16+
</li>
17+
<li id="footnote-para">
18+
<ol>
19+
<li>Item one
20+
<ol>
21+
<li>Sub-item</li>
22+
</ol>
23+
</li>
24+
<li>Item two</li>
25+
</ol>
26+
<a href="#fr-para-1"></a></li>
27+
<li id="footnote-multiple">
28+
<p>One</p>
29+
<p>Two</p>
30+
<p>Three <a href="#fr-multiple-1"></a></p>
31+
</li>
32+
<li id="footnote-&quot;wacky&quot;">
33+
<p>Testing footnote id with special characters. <a href="#fr-&quot;wacky&quot;-1"></a></p>
34+
</li>
35+
<li id="footnote-define-before-use">
36+
<p>This is defined before it is referred to. <a href="#fr-define-before-use-1"></a></p>
37+
</li>
38+
</ol>

0 commit comments

Comments
 (0)