-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
htmldocck: Add support for /text()
in @snapshot
#92914
Conversation
cc @jsha: I think this should mitigate your concern about |
if xpath.endswith('/text()'): | ||
xpath = xpath[:-7] | ||
normalize_to_text = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duplicates code elsewhere in htmldocck.
How does this differ from our current XPath checks, where the stuff between the quotes is a text match? E.g.:
Also, is |
It makes the checks more readable and enables diffing and
Yes, |
An example of how the old way is not very readable: // @has macro_generated_macro/macro.linebreak.html //pre 'macro_rules! linebreak {'
// @has - //pre ' ('
// @has - //pre ' <= 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25'
// @has - //pre ' 26 27 28 =>'
// @has - //pre ' ) => { ... };'
// @has - //pre '};' from an old version of #92908. |
Looks good to me, then! I'll wait for @GuillaumeGomez to review, since they know these tests better than I. |
Yes, that seems good to me. On a somewhat similar topic: it'd be nice that we merged #89676 at some point to really support XPath completely... Currently it's very hacky and pretty bad. |
This allows just testing the text, in cases where the HTML tags don't matter.
9498a09
to
9c6d8ef
Compare
I'm fine with this dd. Could you maybe a test making use of it please? |
Is it good enough that I'll be adding tests making use of it in #92908? |
That sounds good to me! @bors: r+ rollup |
📌 Commit 9c6d8ef has been approved by |
…askrgr Rollup of 14 pull requests Successful merges: - rust-lang#92629 (Pick themes on settings page, not every page) - rust-lang#92640 (Fix ICEs related to `Deref<Target=[T; N]>` on newtypes) - rust-lang#92701 (Add some more attribute validation) - rust-lang#92803 (Hide mobile sidebar on some clicks) - rust-lang#92830 (Rustdoc style cleanups) - rust-lang#92866 ("Does exists" typos fix) - rust-lang#92870 (add `rustc_diagnostic_item` attribute to `AtomicBool` type) - rust-lang#92914 (htmldocck: Add support for `/text()` in ``@snapshot`)` - rust-lang#92923 (Abstract the pretty printer's ringbuffer to be infinitely sized) - rust-lang#92946 (Exclude llvm-libunwind from the self-contained set on s390x-musl targets) - rust-lang#92947 (rustdoc: Use `intersperse` in a `visit_path` function) - rust-lang#92997 (Add `~const` bound test for negative impls) - rust-lang#93004 (update codegen test for LLVM 14) - rust-lang#93016 (Stabilize vec_spare_capacity) Failed merges: - rust-lang#92924 (Delete pretty printer tracing) r? `@ghost` `@rustbot` modify labels: rollup
This allows just testing the text, in cases where the HTML tags don't
matter.
See #92908 (comment) for an example of when this would be useful.
r? @GuillaumeGomez