Skip to content

Commit f67585d

Browse files
committed
Update test cases for intra-doc links in summaries
1 parent 20915d4 commit f67585d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/librustdoc/html/markdown/tests.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fn test_header_ids_multiple_blocks() {
221221
#[test]
222222
fn test_short_markdown_summary() {
223223
fn t(input: &str, expect: &str) {
224-
let output = short_markdown_summary(input);
224+
let output = short_markdown_summary(input, &[][..]);
225225
assert_eq!(output, expect, "original: {}", input);
226226
}
227227

@@ -232,6 +232,7 @@ fn test_short_markdown_summary() {
232232
t("Hard-break \nsummary", "Hard-break summary");
233233
t("hello [Rust] :)\n\n[Rust]: https://www.rust-lang.org", "hello Rust :)");
234234
t("hello [Rust](https://www.rust-lang.org \"Rust\") :)", "hello Rust :)");
235+
t("dud [link]", "dud [link]");
235236
t("code `let x = i32;` ...", "code <code>let x = i32;</code> …");
236237
t("type `Type<'static>` ...", "type <code>Type<'static></code> …");
237238
t("# top header", "top header");
@@ -259,6 +260,7 @@ fn test_plain_text_summary() {
259260
t("Hard-break \nsummary", "Hard-break summary");
260261
t("hello [Rust] :)\n\n[Rust]: https://www.rust-lang.org", "hello Rust :)");
261262
t("hello [Rust](https://www.rust-lang.org \"Rust\") :)", "hello Rust :)");
263+
t("dud [link]", "dud [link]");
262264
t("code `let x = i32;` ...", "code `let x = i32;` …");
263265
t("type `Type<'static>` ...", "type `Type<'static>` …");
264266
t("# top header", "top header");

src/test/rustdoc-js/summaries.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const QUERY = ['summaries', 'summaries::Sidebar', 'summaries::Sidebar2'];
55
const EXPECTED = [
66
{
77
'others': [
8-
{ 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link and <code>code</code>.' },
8+
{ 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link, [<code>code</code>], and <code>Sidebar2</code> intra-doc.' },
99
],
1010
},
1111
{

src/test/rustdoc-js/summaries.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#![crate_type = "lib"]
22
#![crate_name = "summaries"]
33

4-
//! This *summary* has a [link] and `code`.
4+
//! This *summary* has a [link], [`code`], and [`Sidebar2`] intra-doc.
55
//!
6-
//! This is the second paragraph.
6+
//! This is the second paragraph. It should not be rendered.
7+
//! To test that intra-doc links are resolved properly, [`code`] should render
8+
//! the square brackets, and [`Sidebar2`] should not.
79
//!
810
//! [link]: https://example.com
911

0 commit comments

Comments
 (0)