Skip to content
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

[WIP] rustdoc testing: Further improve chapters and sections #2298

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fmease
Copy link
Member

@fmease fmease commented Mar 20, 2025

Follow-up to #2295 (applies my remaining review comments).

This is WIP / a draft because I g2g. Will impl all FIXME(fmease)s when I come back.

cc @lolbinarycat @jieyouxu @notriddle

@fmease fmease added S-waiting-on-author Status: this PR is waiting for additional action by the OP A-compiletest Area: src/tools/compiletest A-test-suite Area: rust-lang/rust test suites T-rustdoc Relevant to rustdoc team labels Mar 20, 2025
Comment on lines +13 to +15
## Htmldocck-Specific Directives

In addition to the directives listed here,
`rustdoc` tests also support most
[compiletest directives](../tests/directives.html).
Directives to htmldocck are similar to those given to `compiletest` in that they take the form of `//@` comments.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: even though it's an implementation detail, I think it's worth hammering in the distinction that htmldocck directives are handled by htmldocck and not compiletest.

@@ -34,33 +32,41 @@ In this case, the start of the next line should be `//`, with no `@`.

For example, `//@ !has 'foo/struct.Bar.html'` checks that crate `foo` does not have a page for a struct named `Bar` in the crate root.

<!-- FIXME(fmease): Mention that the regexes match case-sensitively and in single-line mode? -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: may also be worth mentioning if the regexes have any string and/or regex escape rules. For instance, I know some compiletest regex directives don't handle this very well.

Comment on lines -81 to +87
htmldocck supports the `--bless` option to accept the current subtree
Htmldocck supports the `--bless` option to accept the current subtree
Copy link
Member

@jieyouxu jieyouxu Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: IIRC the --bless flow requires html-tidy to be installed and available somewhere. Not sure if this is mentioned already. Maybe worth explicitly remarking or linking to that?

Comment on lines +121 to +124
<!-- FIXME(fmease):
Should definitely also mention `//@ aux-crate` and `//@ proc-macro`
UNLESS we nuke this paragraph entirely and refer to the compiletest section(s)?
-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark (not-a-review-comment): I think this is where I would like compiletest to support some kind of directive handling "plugin" and allow htmldocck to register plugins. Then we could phrase this as "htmldocck registers additional directive handling to compiletest" either here, or even put this bit under main compiletest chapter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: may or may not be helpful for someone looking to adjust how tests/rustdoc works / change htmldocck/compiletest for tests/rustdoc purposes... but here's a very coarse TL;DR on the test infra bits involved on running tests/rustdoc:


Test infra setup

The test infra setup for tests/rustdoc involves the following bits:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: src/tools/compiletest A-test-suite Area: rust-lang/rust test suites S-waiting-on-author Status: this PR is waiting for additional action by the OP T-rustdoc Relevant to rustdoc team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants