Skip to content

Commit 96c52d4

Browse files
committed
Add unittest
1 parent 778b3cb commit 96c52d4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/librustdoc/html/markdown.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ pub fn plain_summary_line(md: &str) -> String {
629629

630630
#[cfg(test)]
631631
mod tests {
632-
use super::{LangString, Markdown};
632+
use super::{LangString, Markdown, MarkdownHtml};
633633
use super::plain_summary_line;
634634
use html::render::reset_ids;
635635

@@ -735,4 +735,15 @@ mod tests {
735735
t("# top header", "top header");
736736
t("## header", "header");
737737
}
738+
739+
#[test]
740+
fn test_markdown_html_escape() {
741+
fn t(input: &str, expect: &str) {
742+
let output = format!("{}", MarkdownHtml(input));
743+
assert_eq!(output, expect);
744+
}
745+
746+
t("`Struct<'a, T>`", "<p><code>Struct&lt;&#39;a, T&gt;</code></p>\n");
747+
t("Struct<'a, T>", "<p>Struct&lt;&#39;a, T&gt;</p>\n");
748+
}
738749
}

0 commit comments

Comments
 (0)