-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for where clause order #92332
Conversation
Please use I also imagine rustdoc-gui is somewhat slower since it spins up a browser, and rustdoc's tests are already quite slow. @rustbot author |
Like I said, there are a lot of |
Also: it would be very long because of all the links and tags (for syntax highlighting) in it. So I really don't think |
Can you try doing a snapshot test for the XPath |
The goal here isn't to check for the DOM but for the clause order. So once again, I really don't think that using |
The goal is to check the DOM—GUI tests are for checking dynamic components of a page, not the generated HTML. I really don't think using GUI tests for this is good. Can you please at least post the output of the snapshot test? I'm not sure what you mean about there being lots of |
No, the goal is to check the text to ensure that the where clause are generated in the correct order. In any case, here what src/test/rustdoc/where-clause-order.rs: #![crate_name = "foo"]
pub trait SomeTrait<Rhs = Self>
where Rhs: ?Sized
{}
// @has 'foo/trait.SomeTrait.html'
// @snapshot S1 - "//div[@id='impl-SomeTrait%3C(A%2C%20B%2C%20C%2C%20D%2C%20E)%3E-for-(A%2C%20B%2C%20C%\
2C%20D%2C%20E)']/h3"
impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E) where
A: PartialOrd<A> + PartialEq<A>,
B: PartialOrd<B> + PartialEq<B>,
C: PartialOrd<C> + PartialEq<C>,
D: PartialOrd<D> + PartialEq<D>,
E: PartialOrd<E> + PartialEq<E> + ?Sized
{} src/test/rustdoc/where-clause-order.S1.html <h3 class="code-header in-band">impl<A, B, C, D, E> <a class="trait" href="trait.SomeTrait.html" \
title="trait foo::SomeTrait">SomeTrait</a><<a class="primitive" href="https://doc.rust-lang.org/nigh\
tly/std/primitive.tuple.html">(</a>A, B, C, D, E<a class="primitive" href="https://doc.rust-lang.org/ni\
ghtly/std/primitive.tuple.html">)</a>> for <a class="primitive" href="https://doc.rust-lang.org/nigh\
tly/std/primitive.tuple.html">(</a>A, B, C, D, E<a class="primitive" href="https://doc.rust-lang.org/ni\
ghtly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br />   \
0;A: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="tr\
ait core::cmp::PartialOrd">PartialOrd</a><A> + <a class="trait" href="https://doc.rust-lang.org/n\
ightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><A>,<br />&\
#160;   B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Parti\
alOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><B> + <a class="trait" href="https:\
//doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq\
</a><B>,<br />    C: <a class="trait" href="https://doc.rust-lang.org/nightly\
/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><C> + <a class\
="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp:\
:PartialEq">PartialEq</a><C>,<br />    D: <a class="trait" href="https://doc.\
rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a\
><D> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" ti\
tle="trait core::cmp::PartialEq">PartialEq</a><D>,<br />    E: <a class="trai\
t" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::Part\
ialOrd">PartialOrd</a><E> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/tra\
it.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><E> + ?<a class="trait" href="\
https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized\
</a>, </span></h3> Just like I said: it's not helpful at all to ensure the where clauses are sorted as expected... |
I still don't think that GUI tests are the right way to test this, but for some reason r? @jsha |
☔ The latest upstream changes (presumably #92465) made this pull request unmergeable. Please resolve the merge conflicts. |
Here's a test against the HTML (i.e. not a GUI test) that passes and is equally as clear as the GUI test. It doesn't use @snapshot. @GuillaumeGomez would you be willing to do this instead? src/test/rustdoc/where-clause-order.rs
|
Yes it's fine. The reading isn't great but doesn't matter. |
f8ea233
to
ec0c838
Compare
Done! |
@bors r+ rollup |
📌 Commit ec0c838 has been approved by |
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#84083 (Clarify the guarantees that ThreadId does and doesn't make.) - rust-lang#91593 (Remove unnecessary bounds for some Hash{Map,Set} methods) - rust-lang#92297 (Reduce compile time of rustbuild) - rust-lang#92332 (Add test for where clause order) - rust-lang#92438 (Enforce formatting for rustc_codegen_cranelift) - rust-lang#92463 (Remove pronunciation guide from Vec<T>) - rust-lang#92468 (Emit an error for `--cfg=)`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
I didn't use
@snapshot
because of the
characters, it's much simpler doing it through rustdoc-gui testsuite.r? @camelid