Test fixes
This commit is contained in:
parent
b865e97b29
commit
0be6307a41
@ -45,7 +45,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> HeadingAnchors<'a, I> {
|
|||||||
let heading_html = format!(
|
let heading_html = format!(
|
||||||
"\
|
"\
|
||||||
<{level} id=\"{slug}\">\
|
<{level} id=\"{slug}\">\
|
||||||
{inner} <a href=\"#{slug}\" class=\"header-anchor\" aria-hidden=\"true\" role=\"presentation\">§</a> \
|
{inner} <a href=\"#{slug}\" class=\"header-anchor\" aria-hidden=\"true\" role=\"presentation\">§</a>\
|
||||||
</{level}>",
|
</{level}>",
|
||||||
);
|
);
|
||||||
Event::Html(CowStr::Boxed(heading_html.into_boxed_str()))
|
Event::Html(CowStr::Boxed(heading_html.into_boxed_str()))
|
||||||
@ -110,15 +110,15 @@ mod tests {
|
|||||||
fn test_heading_ids() {
|
fn test_heading_ids() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
render("# Test"),
|
render("# Test"),
|
||||||
r##"<h1 id="test"><a href="#test" class="header-anchor" aria-hidden="true" role="presentation">#</a> Test</h1>"##
|
r##"<h1 id="test">Test <a href="#test" class="header-anchor" aria-hidden="true" role="presentation">§</a></h1>"##
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
render("# `Test`"),
|
render("# `Test`"),
|
||||||
r##"<h1 id="test"><a href="#test" class="header-anchor" aria-hidden="true" role="presentation">#</a> <code>Test</code></h1>"##
|
r##"<h1 id="test"><code>Test</code> <a href="#test" class="header-anchor" aria-hidden="true" role="presentation">§</a></h1>"##
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
render("# [Test](https://example.com)"),
|
render("# [Test](https://example.com)"),
|
||||||
r##"<h1 id="test"><a href="#test" class="header-anchor" aria-hidden="true" role="presentation">#</a> <a href="https://example.com">Test</a></h1>"##
|
r##"<h1 id="test"><a href="https://example.com">Test</a> <a href="#test" class="header-anchor" aria-hidden="true" role="presentation">§</a></h1>"##
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,6 +270,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sidenote_markers() {
|
fn sidenote_markers() {
|
||||||
|
let text_selector = "\u{FE0E}";
|
||||||
assert_eq!(render("look[^1]\n\n[^1]: blah\n\nweee"), vec![
|
assert_eq!(render("look[^1]\n\n[^1]: blah\n\nweee"), vec![
|
||||||
Start(Tag::Paragraph),
|
Start(Tag::Paragraph),
|
||||||
Text("look".into()),
|
Text("look".into()),
|
||||||
@ -289,7 +290,7 @@ mod tests {
|
|||||||
),
|
),
|
||||||
Start(Tag::Paragraph),
|
Start(Tag::Paragraph),
|
||||||
Text("blah".into()),
|
Text("blah".into()),
|
||||||
Html(r##" <a href="#fnref-1" class="footnote-backref">↩</a>"##.into()),
|
Html(format!(r##" <a href="#fnref-1" class="footnote-backref">↩{text_selector}</a>"##).into()),
|
||||||
End(TagEnd::Paragraph),
|
End(TagEnd::Paragraph),
|
||||||
Html("</div></div>".into()),
|
Html("</div></div>".into()),
|
||||||
])
|
])
|
||||||
|
@ -111,9 +111,10 @@ mod tests {
|
|||||||
fn test_deserialize_date() {
|
fn test_deserialize_date() {
|
||||||
let deserialized: DeserializedDate =
|
let deserialized: DeserializedDate =
|
||||||
toml::from_str(r#"d = "2017-02-17 14:30:42 -0400""#).unwrap();
|
toml::from_str(r#"d = "2017-02-17 14:30:42 -0400""#).unwrap();
|
||||||
let expected = FixedOffset::west(4 * 3600)
|
let expected = FixedOffset::west_opt(4 * 3600)
|
||||||
.ymd(2017, 2, 17)
|
.unwrap()
|
||||||
.and_hms(14, 30, 42);
|
.with_ymd_and_hms(2017, 2, 17, 14, 30, 42)
|
||||||
|
.unwrap();
|
||||||
assert_eq!(deserialized.d, expected);
|
assert_eq!(deserialized.d, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user