Skip to content

Commit

Permalink
Add unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Dec 25, 2016
1 parent 778b3cb commit 96c52d4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/librustdoc/html/markdown.rs
Expand Up @@ -629,7 +629,7 @@ pub fn plain_summary_line(md: &str) -> String {

#[cfg(test)]
mod tests {
use super::{LangString, Markdown};
use super::{LangString, Markdown, MarkdownHtml};
use super::plain_summary_line;
use html::render::reset_ids;

Expand Down Expand Up @@ -735,4 +735,15 @@ mod tests {
t("# top header", "top header");
t("## header", "header");
}

#[test]
fn test_markdown_html_escape() {
fn t(input: &str, expect: &str) {
let output = format!("{}", MarkdownHtml(input));
assert_eq!(output, expect);
}

t("`Struct<'a, T>`", "<p><code>Struct&lt;&#39;a, T&gt;</code></p>\n");
t("Struct<'a, T>", "<p>Struct&lt;&#39;a, T&gt;</p>\n");
}
}

0 comments on commit 96c52d4

Please sign in to comment.