Skip to content

Commit 94b305d

Browse files
GuillaumeGomezpietroalbini
authored andcommitted
Add test for non-rust code block hashtag prepended lines
1 parent 76184b1 commit 94b305d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/librustdoc/html/markdown/tests.rs

+37
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,40 @@ fn test_find_testable_code_line() {
309309
t("```rust\n```\n```rust\n```", &[1, 3]);
310310
t("```rust\n```\n ```rust\n```", &[1, 3]);
311311
}
312+
313+
#[test]
314+
fn test_ascii_with_prepending_hashtag() {
315+
fn t(input: &str, expect: &str) {
316+
let mut map = IdMap::new();
317+
let output = Markdown {
318+
content: input,
319+
links: &[],
320+
ids: &mut map,
321+
error_codes: ErrorCodes::Yes,
322+
edition: DEFAULT_EDITION,
323+
playground: &None,
324+
heading_offset: HeadingOffset::H2,
325+
}
326+
.into_string();
327+
assert_eq!(output, expect, "original: {}", input);
328+
}
329+
330+
t(
331+
r#"```ascii
332+
#..#.####.#....#.....##..
333+
#..#.#....#....#....#..#.
334+
####.###..#....#....#..#.
335+
#..#.#....#....#....#..#.
336+
#..#.#....#....#....#..#.
337+
#..#.####.####.####..##..
338+
```"#,
339+
"<div class=\"example-wrap\"><pre class=\"language-ascii\"><code>\
340+
#..#.####.#....#.....##..
341+
#..#.#....#....#....#..#.
342+
####.###..#....#....#..#.
343+
#..#.#....#....#....#..#.
344+
#..#.#....#....#....#..#.
345+
#..#.####.####.####..##..
346+
</code></pre></div>",
347+
);
348+
}

0 commit comments

Comments
 (0)