Skip to content

Commit

Permalink
Add test for rust-lang#112901
Browse files Browse the repository at this point in the history
It's a lot of snapshots, but it's quite hard to test this sort of
formatting with other ways.
  • Loading branch information
camelid committed Jun 26, 2023
1 parent 89c0e58 commit 35b3577
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/rustdoc/issue-112901-where-clause.assoc-S-impl-F.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section id="associatedtype.F" class="associatedtype trait-impl"><a href="#associatedtype.F" class="anchor">&#167;</a><h4 class="code-header">type <a href="trait.Tr.html#associatedtype.F" class="associatedtype">F</a>&lt;T&gt; = T
<span class="where">where
T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span></h4></section>
3 changes: 3 additions & 0 deletions tests/rustdoc/issue-112901-where-clause.assoc-Tr-F.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section id="associatedtype.F" class="method"><a class="srclink rightside" href="../../src/foo/issue-112901-where-clause.rs.html#28-30">source</a><h4 class="code-header">type <a href="#associatedtype.F" class="associatedtype">F</a>&lt;T&gt;
<span class="where">where
T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span></h4></section>
5 changes: 5 additions & 0 deletions tests/rustdoc/issue-112901-where-clause.assoc-Tr-decl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<pre class="rust item-decl"><code>pub trait Tr {
type <a href="#associatedtype.F" class="associatedtype">F</a>&lt;T&gt;
<span class="where">where
T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span>;
}</code></pre>
3 changes: 3 additions & 0 deletions tests/rustdoc/issue-112901-where-clause.assoc-Tr-impl-F.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section id="associatedtype.F-1" class="associatedtype trait-impl"><a href="#associatedtype.F-1" class="anchor">&#167;</a><h4 class="code-header">type <a href="#associatedtype.F" class="associatedtype">F</a>&lt;T&gt; = T
<span class="where">where
T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span></h4></section>
36 changes: 36 additions & 0 deletions tests/rustdoc/issue-112901-where-clause.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#![crate_name = "foo"]
#![feature(trivial_bounds)]

pub mod structs {
// @has foo/structs/struct.A.html
// @snapshot structs-A - '//pre[@class="rust item-decl"]'
pub struct A<T>(T)
where
T: Copy;

// @has foo/structs/struct.S.html
// @snapshot structs-S - '//pre[@class="rust item-decl"]'
pub struct S
where
String: Clone;
}

pub mod assoc {
// @has foo/assoc/struct.S.html
// @snapshot assoc-S-impl-F - '//section[@id="associatedtype.F"]'
pub struct S;

// @has foo/assoc/trait.Tr.html
// @snapshot assoc-Tr-decl - '//pre[@class="rust item-decl"]'
// @snapshot assoc-Tr-F - '//section[@id="associatedtype.F"]'
// @snapshot assoc-Tr-impl-F - '//section[@id="associatedtype.F-1"]'
pub trait Tr {
type F<T>
where
T: Clone;
}

impl Tr for S {
type F<T> = T where T: Clone;
}
}
3 changes: 3 additions & 0 deletions tests/rustdoc/issue-112901-where-clause.structs-A.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<pre class="rust item-decl"><code>pub struct A&lt;T&gt;(_)
<span class="where">where
T: <a class="trait" href="{{channel}}/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a></span>;</code></pre>
3 changes: 3 additions & 0 deletions tests/rustdoc/issue-112901-where-clause.structs-S.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<pre class="rust item-decl"><code>pub struct S
<span class="where">where
<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span>;</code></pre>

0 comments on commit 35b3577

Please sign in to comment.