-
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
Rustdoc json tests: New @ismany test command #99474
Rustdoc json tests: New @ismany test command #99474
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
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 skimmed it over and it looks like a nice simplification/improvement. I left some comments. Mostly nit-picks I'm afraid (as in: I probably should not have bothered to comment at all)
@@ -4,15 +4,20 @@ | |||
#![feature(no_core)] | |||
|
|||
// @is glob_extern.json "$.index[*][?(@.name=='mod1')].kind" \"module\" | |||
// @is glob_extern.json "$.index[*][?(@.name=='mod1')].inner.is_stripped" "true" | |||
// @is - "$.index[*][?(@.name=='mod1')].inner.is_stripped" "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.
Sorry to nit-pick, but I wonder: Is it worth to use -
instead of the whole filename? That messes up the alignment and makes the code harder to read, IMHO.
Edit: Well, if all other lines use -
then the alignment becomes good for them at least...
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.
Yeah, most of the tests use -
for all but the first item. (Side note, I should add a feature to set the -
to the obvious value initialy, because I don't think this is ever used, but just a hold over from the HTML side)
src/tools/jsondocck/src/main.rs
Outdated
@@ -50,13 +50,15 @@ pub enum CommandKind { | |||
Has, | |||
Count, | |||
Is, | |||
HasExact, |
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.
Bikeshedding: Maybe call it "HasOnly"? That makes more semantic sense to me, but not sure it makes more sense to others.
feff909
to
6d2104b
Compare
This comment has been minimized.
This comment has been minimized.
6d2104b
to
09d080e
Compare
|
||
// Serde json doesn't implement Ord or Hash for Value, so we must | ||
// use a Vec here. While in theory that makes setwize equality | ||
// O(n^2), in practice n will never be large enought to matter. |
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 feel like a 'hasexact' would make me expect that it would check the order too, not just presence -- and that would avoid any question of n^2 comparison time. I agree that n^2 comparison time isn't itself an issue, though, so maybe this is fine as-is.
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.
It needs to not check order, as that's not a property that's stable, so the intension is to a setwise comparison.
HasExact
should definatly be renamed, as it's been confusing twice now.
r? rust-lang/rustdoc |
r? @CraftSpider |
Looked it over, and the code looks good to me, aside from the mention of |
I suggested the name |
I see today that it looks like |
09d080e
to
0e563c8
Compare
0e563c8
to
5b5c1fa
Compare
Renamed to @rustbot ready |
This comment has been minimized.
This comment has been minimized.
5b5c1fa
to
760b972
Compare
@bors r+ |
…-test-cleanup, r=CraftSpider Rustdoc json tests: New @hasexact test command Alot of the time, we wanted to assert that a module had an exact set of items. Most of the time this was done by asserting that the ``@count`` of the module was `n`, and then doing `n` ``@has`` checks on the module. This was tedious, so often shortcuts were done. This PR adds a new command to jsondocck to allow consistently expressing this behavior, and then uses it to clean up the tests. `@rustbot` modify labels: +A-rustdoc-json +A-testsuite
…iaskrgr Rollup of 15 pull requests Successful merges: - rust-lang#99474 (Rustdoc json tests: New `@hasexact` test command) - rust-lang#99972 (interpret: only consider 1-ZST when searching for receiver) - rust-lang#100018 (Clean up `LitKind`) - rust-lang#100379 (triagebot: add translation-related mention groups) - rust-lang#100389 (Do not report cycle error when inferring return type for suggestion) - rust-lang#100489 (`is_knowable` use `Result` instead of `Option`) - rust-lang#100532 (unwind: don't build dependency when building for Miri) - rust-lang#100608 (needless separation of impl blocks) - rust-lang#100621 (Pass +atomics-32 feature for {arm,thumb}v4t-none-eabi) - rust-lang#100646 (Migrate emoji identifier diagnostics to `SessionDiagnostic` in rustc_interface) - rust-lang#100652 (Remove deferred sized checks (make them eager)) - rust-lang#100655 (Update books) - rust-lang#100656 (Update cargo) - rust-lang#100660 (Fixed a few documentation errors) - rust-lang#100661 (Fixed a few documentation errors) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Alot of the time, we wanted to assert that a module had an exact set of items. Most of the time this was done by asserting that the
@count
of the module wasn
, and then doingn
@has
checks on the module.This was tedious, so often shortcuts were done.
This PR adds a new command to jsondocck to allow consistently expressing this behavior, and then uses it to clean up the tests.
@rustbot modify labels: +A-rustdoc-json +A-testsuite