-
Notifications
You must be signed in to change notification settings - Fork 546
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
base: master
Are you sure you want to change the base?
Conversation
27c7a0d
to
abd8c05
Compare
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.
thanks! r=me with or without addressing the comments
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.
could you link to here from https://rustc-dev-guide.rust-lang.org/rustdoc.html#tests ?
@@ -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`]. |
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.
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). |
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.
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: |
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.
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. |
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 makes sure their are no dangling [`Id`]s. | |
This makes sure there are no dangling [`Id`]s. |
- `//@ 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. |
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.
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>` |
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.
i imagine you mean "at least one", right? otherwise this is equivalent to @ is
.
Closes rust-lang/rust#100515