Skip to content

Commit dd82e5b

Browse files
Add regression test for merged <code> tags
1 parent 15d1916 commit dd82e5b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/rustdoc/code-tags-merge.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// This test checks that rustdoc is combining `<code>` tags as expected.
2+
3+
#![crate_name = "foo"]
4+
5+
//@ has 'foo/index.html'
6+
7+
// First we check that summary lines also get the `<code>` merge.
8+
//@ has - '//dd/code' 'Stream<Item = io::Result<Bytes>>'
9+
//@ !has - '//dd/code/code' 'Stream<Item = io::Result<Bytes>>'
10+
// Then we check that the docblocks have it too.
11+
//@ has 'foo/struct.Foo.html'
12+
//@ has - '//*[@class="docblock"]//code' 'Stream<Item = io::Result<Bytes>>'
13+
//@ has - '//*[@class="docblock"]//code' 'Stream<Item = io::Result<Bytes>>'
14+
/// [`Stream`](crate::Foo)`<Item = `[`io::Result`](crate::Foo)`<`[`Bytes`](crate::Foo)`>>`
15+
pub struct Foo;
16+
17+
impl Foo {
18+
//@ has - '//*[@class="impl-items"]//*[@class="docblock"]//code' '<Stream>'
19+
/// A `<`[`Stream`](crate::Foo)`>` stuff.
20+
pub fn bar() {}
21+
22+
//@ has - '//*[@class="impl-items"]//*[@class="docblock"]//code' '<'
23+
//@ has - '//*[@class="impl-items"]//*[@class="docblock"]//a' 'Stream a'
24+
//@ has - '//*[@class="impl-items"]//*[@class="docblock"]//code' 'Stream'
25+
//@ has - '//*[@class="impl-items"]//*[@class="docblock"]//code' '>'
26+
/// A `<`[`Stream` a](crate::Foo)`>` stuff.
27+
pub fn foo() {}
28+
}

0 commit comments

Comments
 (0)