[rustdoc] Fix handling of stripped enum variant in JSON output format by Guillau...
source link: https://github.com/rust-lang/rust/pull/100582
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
This comment has been minimized.
// @has enum_variant_hidden.json "$.index[*][?(@.name=='ParseError')]" |
||
// @has enum_variant_hidden.json "$.index[*][?(@.name=='UnexpectedEndTag')]" |
||
// @!has enum_variant_hidden.json "$.index[*][?(@.name=='u32')]" |
This doesn't test that the field was hidden, as
// @has enum_variant_hidden.json "$.index[*][?(@.name=='ParseError')]"
// @has enum_variant_hidden.json "$.index[*][?(@.name=='UnexpectedEndTag')]"
// @!has enum_variant_hidden.json "$.index[*][?(@.name=='u32')]"
pub enum ParseError {
UnexpectedEndTag(u32),
}
will also pass the test.
Primitives arn't stored in the index, but in a varient of Type
, so the output of the above is
"inner": {
"variant_inner": [
{"inner": "u32", "kind": "primitive"}
],
"variant_kind": "tuple"
},
Instead, just directly check that the variant doesn't list having any fields.
// @!has enum_variant_hidden.json "$.index[*][?(@.name=='u32')]" | |
// @is - "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_kind" '"tuple"' | |
// @is - "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant_inner" [] |
Thanks for the suggestion!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK