Skip to content

Start documenting tests/rustdoc-json #2422

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

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

Conversation

aDotInTheVoid
Copy link
Member

@aDotInTheVoid aDotInTheVoid commented May 28, 2025

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

thanks! r=me with or without addressing the comments

Copy link
Member

Choose a reason for hiding this comment

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

@@ -155,7 +155,8 @@ The bulk of [`rustdoc`] is in [`librustdoc`]. However, the [`rustdoc`] binary
itself is [`src/tools/rustdoc`], which does nothing except call [`rustdoc::main`].

There is also `JavaScript` and `CSS` for the docs in [`src/tools/rustdoc-js`]
and [`src/tools/rustdoc-themes`].
and [`src/tools/rustdoc-themes`]. The type definitions for `--output-format=json`
are in a seperate crate in [`src/rustdoc-json-types`].
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
are in a seperate crate in [`src/rustdoc-json-types`].
are in a separate crate in [`src/rustdoc-json-types`].

This page is specifically about the test suite named `rustdoc-json`, which tests rustdoc's [json output].
For other test suites used for testing rustdoc, see [Rustdoc tests](../rustdoc.md#tests).

Tests are run with compiletest, and have access to the usuall set of [directives](../tests/directives.md).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Tests are run with compiletest, and have access to the usuall set of [directives](../tests/directives.md).
Tests are run with compiletest, and have access to the usual set of [directives](../tests/directives.md).

For other test suites used for testing rustdoc, see [Rustdoc tests](../rustdoc.md#tests).

Tests are run with compiletest, and have access to the usuall set of [directives](../tests/directives.md).
Frequenly used directives here are:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Frequenly used directives here are:
Frequently used directives here are:

## jsondoclint

[jsondoclint] checks that all [`Id`]s exist in the `index` (or `paths`).
This makes sure their are no dangling [`Id`]s.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This makes sure their are no dangling [`Id`]s.
This makes sure there are no dangling [`Id`]s.

Comment on lines +30 to +38
- `//@ has <path>`:: Checks `<path>` exists, i.e. matches at least 1 value.
- `//@ !has <path>`:: Checks `<path>` doesn't exist, i.e. matches 0 values.
- `//@ has <path> <value>`: Check `<path>` exists, and 1 of the matches is equal to the given `<value>`
- `//@ !has <path> <value>`: Checks `<path>` exists, but none of the matches equal the given `<value>`.
- `//@ is <path> <value>`: Check `<path>` matches exacly one value, and it's equal to the given `<value>`.
- `//@ is <path> <value> <value>...`: Check that `<path>` matches to exactly every given `<value>`.
Ordering doesn't matter here.
- `//@ !is <path> <value>`: Check `<path>` matches exactly one value, and that value is not equal to the given `<value>`.
- `//@ count <path> <number>` Check that `<path>` matches to `<number>` of values.
Copy link
Member

Choose a reason for hiding this comment

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

can you link to an exhaustive reference of the directives? source code is fine, just somewhere to look if a new directive gets added and i can't find it in the dev guide.


- `//@ has <path>`:: Checks `<path>` exists, i.e. matches at least 1 value.
- `//@ !has <path>`:: Checks `<path>` doesn't exist, i.e. matches 0 values.
- `//@ has <path> <value>`: Check `<path>` exists, and 1 of the matches is equal to the given `<value>`
Copy link
Member

Choose a reason for hiding this comment

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

i imagine you mean "at least one", right? otherwise this is equivalent to @ is.

@jieyouxu jieyouxu added A-test-suite Area: rust-lang/rust test suites T-rustdoc Relevant to rustdoc team labels May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-test-suite Area: rust-lang/rust test suites T-rustdoc Relevant to rustdoc team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document JsonDocCk and checkmissingitems.py
3 participants