forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#93660 - aDotInTheVoid:rustdoc-type-tests, r…
…=CraftSpider rustdoc-json: Add some tests for typealias item r? ```@CraftSpider``` Improves rust-lang#81359 The test's arn't pretty, and I think eventually we need a better way of doing repeated tests on a deeply nested path, without repeating the way to get to that path ```@rustbot``` modify labels: +A-rustdoc-json +T-rustdoc +A-rustdoc +A-testsuite
- Loading branch information
Showing
4 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// ignore-tidy-linelength | ||
|
||
// @count dyn.json "$.index[*][?(@.name=='dyn')].inner.items" 1 | ||
// @set sync_int_gen = - "$.index[*][?(@.name=='SyncIntGen')].id" | ||
// @is - "$.index[*][?(@.name=='dyn')].inner.items[0]" $sync_int_gen | ||
|
||
// @is - "$.index[*][?(@.name=='SyncIntGen')].kind" \"typedef\" | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.generics" '{"params": [], "where_predicates": []}' | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.kind" \"resolved_path\" | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.name" \"Box\" | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.bindings" [] | ||
// @count - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args" 1 | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args[0].type.kind" \"resolved_path\" | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args[0].type.kind" \"resolved_path\" | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args[0].type.inner.name" \"Fn\" | ||
// @count - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args[0].type.inner.param_names[*]" 3 | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args[0].type.inner.param_names[0].trait_bound.trait.inner.name" \"Send\" | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args[0].type.inner.param_names[1].trait_bound.trait.inner.name" \"Sync\" | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args[0].type.inner.param_names[2]" "{\"outlives\": \"'static\"}" | ||
// @is - "$.index[*][?(@.name=='SyncIntGen')].inner.type.inner.args.angle_bracketed.args[0].type.inner.args" '{"parenthesized": {"inputs": [],"output": {"inner": "i32","kind": "primitive"}}}' | ||
pub type SyncIntGen = Box<dyn Fn() -> i32 + Send + Sync + 'static>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// ignore-tidy-linelength | ||
|
||
// @is fn_lifetime.json "$.index[*][?(@.name=='GenericFn')].kind" \"typedef\" | ||
|
||
// @count - "$.index[*][?(@.name=='GenericFn')].inner.generics.params[*]" 1 | ||
// @is - "$.index[*][?(@.name=='GenericFn')].inner.generics.params[*].name" \"\'a\" | ||
// @has - "$.index[*][?(@.name=='GenericFn')].inner.generics.params[*].kind.lifetime" | ||
// @count - "$.index[*][?(@.name=='GenericFn')].inner.generics.params[*].kind.lifetime.outlives[*]" 0 | ||
// @count - "$.index[*][?(@.name=='GenericFn')].inner.generics.where_predicates[*]" 0 | ||
// @is - "$.index[*][?(@.name=='GenericFn')].inner.type.kind" \"function_pointer\" | ||
// @count - "$.index[*][?(@.name=='GenericFn')].inner.type.inner.generic_params[*]" 0 | ||
// @count - "$.index[*][?(@.name=='GenericFn')].inner.type.inner.decl.inputs[*]" 1 | ||
// @is - "$.index[*][?(@.name=='GenericFn')].inner.type.inner.decl.inputs[*][1].inner.lifetime" \"\'a\" | ||
// @is - "$.index[*][?(@.name=='GenericFn')].inner.type.inner.decl.output.inner.lifetime" \"\'a\" | ||
|
||
pub type GenericFn<'a> = fn(&'a i32) -> &'a i32; | ||
|
||
// @is fn_lifetime.json "$.index[*][?(@.name=='ForAll')].kind" \"typedef\" | ||
// @count - "$.index[*][?(@.name=='ForAll')].inner.generics.params[*]" 0 | ||
// @count - "$.index[*][?(@.name=='ForAll')].inner.generics.where_predicates[*]" 0 | ||
// @count - "$.index[*][?(@.name=='ForAll')].inner.type.inner.generic_params[*]" 1 | ||
// @is - "$.index[*][?(@.name=='ForAll')].inner.type.inner.generic_params[*].name" \"\'a\" | ||
// @has - "$.index[*][?(@.name=='ForAll')].inner.type.inner.generic_params[*].kind.lifetime" | ||
// @count - "$.index[*][?(@.name=='ForAll')].inner.type.inner.generic_params[*].kind.lifetime.outlives[*]" 0 | ||
// @count - "$.index[*][?(@.name=='ForAll')].inner.type.inner.decl.inputs[*]" 1 | ||
// @is - "$.index[*][?(@.name=='ForAll')].inner.type.inner.decl.inputs[*][1].inner.lifetime" \"\'a\" | ||
// @is - "$.index[*][?(@.name=='ForAll')].inner.type.inner.decl.output.inner.lifetime" \"\'a\" | ||
pub type ForAll = for<'a> fn(&'a i32) -> &'a i32; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// ignore-tidy-linelength | ||
|
||
// @set result = generic_default.json "$.index[*][?(@.name=='Result')].id" | ||
pub enum Result<T, E> { | ||
Ok(T), | ||
Err(E), | ||
} | ||
|
||
// @set my_error = - "$.index[*][?(@.name=='MyError')].id" | ||
pub struct MyError {} | ||
|
||
// @is - "$.index[*][?(@.name=='MyResult')].kind" \"typedef\" | ||
// @count - "$.index[*][?(@.name=='MyResult')].inner.generics.where_predicates[*]" 0 | ||
// @count - "$.index[*][?(@.name=='MyResult')].inner.generics.params[*]" 2 | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.generics.params[0].name" \"T\" | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.generics.params[1].name" \"E\" | ||
// @has - "$.index[*][?(@.name=='MyResult')].inner.generics.params[0].kind.type" | ||
// @has - "$.index[*][?(@.name=='MyResult')].inner.generics.params[1].kind.type" | ||
// @count - "$.index[*][?(@.name=='MyResult')].inner.generics.params[0].kind.type.bounds[*]" 0 | ||
// @count - "$.index[*][?(@.name=='MyResult')].inner.generics.params[1].kind.type.bounds[*]" 0 | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.generics.params[0].kind.type.default" null | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.generics.params[1].kind.type.default.kind" \"resolved_path\" | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.generics.params[1].kind.type.default.inner.id" $my_error | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.generics.params[1].kind.type.default.inner.name" \"MyError\" | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.type.kind" \"resolved_path\" | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.type.inner.id" $result | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.type.inner.name" \"Result\" | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.type.inner.args.angle_bracketed.bindings" [] | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.type.inner.args.angle_bracketed.args[0].type.kind" \"generic\" | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.type.inner.args.angle_bracketed.args[1].type.kind" \"generic\" | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.type.inner.args.angle_bracketed.args[0].type.inner" \"T\" | ||
// @is - "$.index[*][?(@.name=='MyResult')].inner.type.inner.args.angle_bracketed.args[1].type.inner" \"E\" | ||
pub type MyResult<T, E = MyError> = Result<T, E>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters