rustdoc-json: add trait/type alias tests
This commit is contained in:
parent
8a8ad3433e
commit
8e7314f6e0
18
tests/rustdoc-json/trait_alias.rs
Normal file
18
tests/rustdoc-json/trait_alias.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// ignore-tidy-linelength
|
||||
#![feature(trait_alias)]
|
||||
|
||||
// @set StrLike = "$.index[*][?(@.name=='StrLike')].id"
|
||||
// @is "$.index[*][?(@.name=='StrLike')].visibility" \"public\"
|
||||
// @has "$.index[*][?(@.name=='StrLike')].inner.trait_alias"
|
||||
// @is "$.index[*][?(@.name=='StrLike')].span.filename" $FILE
|
||||
pub trait StrLike = AsRef<str>;
|
||||
|
||||
// @is "$.index[*][?(@.name=='f')].inner.function.decl.output.impl_trait[0].trait_bound.trait.id" $StrLike
|
||||
pub fn f() -> impl StrLike {
|
||||
"heya"
|
||||
}
|
||||
|
||||
// @!is "$.index[*][?(@.name=='g')].inner.function.decl.output.impl_trait[0].trait_bound.trait.id" $StrLike
|
||||
pub fn g() -> impl AsRef<str> {
|
||||
"heya"
|
||||
}
|
15
tests/rustdoc-json/type_alias.rs
Normal file
15
tests/rustdoc-json/type_alias.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// @set IntVec = "$.index[*][?(@.name=='IntVec')].id"
|
||||
// @is "$.index[*][?(@.name=='IntVec')].visibility" \"public\"
|
||||
// @has "$.index[*][?(@.name=='IntVec')].inner.type_alias"
|
||||
// @is "$.index[*][?(@.name=='IntVec')].span.filename" $FILE
|
||||
pub type IntVec = Vec<u32>;
|
||||
|
||||
// @is "$.index[*][?(@.name=='f')].inner.function.decl.output.resolved_path.id" $IntVec
|
||||
pub fn f() -> IntVec {
|
||||
vec![0; 32]
|
||||
}
|
||||
|
||||
// @!is "$.index[*][?(@.name=='g')].inner.function.decl.output.resolved_path.id" $IntVec
|
||||
pub fn g() -> Vec<u32> {
|
||||
vec![0; 32]
|
||||
}
|
Loading…
Reference in New Issue
Block a user