File tree Expand file tree Collapse file tree 5 files changed +31
-37
lines changed Expand file tree Collapse file tree 5 files changed +31
-37
lines changed Original file line number Diff line number Diff line change 11// https://github.com/rust-lang/rust/issues/100252
22
3- #![ feature( no_core) ]
4- #![ no_core]
5-
63mod bar {
7- // @set baz = "$.index[*][?(@.inner.struct )].id"
4+ // @set baz = "$.index[*][?(@.name == 'Baz' )].id"
85 pub struct Baz ;
9- // @set impl = "$.index[*][?(@.inner.impl)].id"
6+ // @set impl = "$.index[*][?(@.docs == 'impl')].id"
7+ /// impl
108 impl Baz {
11- // @set doit = "$.index[*][?(@.inner.function )].id"
9+ // @set doit = "$.index[*][?(@.name == 'doit' )].id"
1210 pub fn doit ( ) { }
1311 }
1412}
@@ -18,5 +16,5 @@ pub use bar::Baz;
1816
1917// @is "$.index[*].inner.module.items[*]" $import
2018// @is "$.index[*].inner.import.id" $baz
21- // @is "$.index[*].inner.struct.impls[*]" $impl
22- // @is "$.index[*].inner.impl.items[*]" $doit
19+ // @has "$.index[*][?(@.name == 'Baz') ].inner.struct.impls[*]" $impl
20+ // @is "$.index[*][?(@.docs=='impl')] .inner.impl.items[*]" $doit
Original file line number Diff line number Diff line change 1- #![ feature( no_core) ]
2- #![ no_core]
3-
4- // @count "$.index[*][?(@.inner.impl)]" 1
1+ // @has "$.index[*][?(@.docs=='Here')]"
2+ // @!has "$.index[*][?(@.docs=='Not Here')]"
53// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
64// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
75// @has "$.index[*][?(@.name=='PubTrait')]"
@@ -11,5 +9,7 @@ pub trait PubTrait {}
119pub struct HiddenPubStruct ;
1210pub struct NotHiddenPubStruct ;
1311
12+ /// Not Here
1413impl PubTrait for HiddenPubStruct { }
14+ /// Here
1515impl PubTrait for NotHiddenPubStruct { }
Original file line number Diff line number Diff line change 1- #![ feature( no_core) ]
2- #![ no_core]
3-
4- // @count "$.index[*][?(@.inner.impl)]" 1
5- // @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
6- // @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
71// @has "$.index[*][?(@.name=='PubTrait')]"
82pub trait PubTrait { }
93
104#[ doc( hidden) ]
115pub mod hidden {
6+ // @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
127 pub struct HiddenPubStruct ;
138
9+ // @!has "$.index[*][?(@.docs == 'Not Here')]"
10+ /// Not Here
1411 impl crate :: PubTrait for HiddenPubStruct { }
1512}
1613
1714pub mod not_hidden {
15+ // @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
1816 pub struct NotHiddenPubStruct ;
1917
18+ // @has "$.index[*][?(@.docs == 'Here')]"
19+ /// Here
2020 impl crate :: PubTrait for NotHiddenPubStruct { }
2121}
Original file line number Diff line number Diff line change 1- #![ feature( no_core) ]
2- #![ no_core]
3-
41// @set struct = "$.index[*][?(@.name=='Struct')].id"
52pub struct Struct ;
63// @set trait = "$.index[*][?(@.name=='Trait')].id"
@@ -9,7 +6,7 @@ pub trait Trait {}
96/// impl
107impl Trait for Struct { }
118
12- // @is "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
9+ // @has "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
1310// @is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl
1411// @is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait
1512// @is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct
Original file line number Diff line number Diff line change 1- #![ feature( no_core) ]
2- #![ no_core]
3-
4- // @set wham = "$.index[*][?(@.name=='Wham')].id"
5- // @count "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" 1
6- // @set gmWham = "$.index[*][?(@.name=='Wham')].inner.trait.implementations[0]"
71pub trait Wham { }
8-
9- // @count "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" 1
10- // @is "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[0]" $gmWham
11- // @set gm = "$.index[*][?(@.name=='Wham')].id"
12-
13- // jsonpath_lib isnt expressive enough (for now) to get the "impl" item, so we
14- // just check it isn't pointing to the type, but when you port to jsondocck-ng
15- // check what the impl item is
16- // @!is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[0]" $gm
172pub struct GeorgeMichael { }
183
4+ /// Wham for George Michael
195impl Wham for GeorgeMichael { }
6+
7+ // Find IDs.
8+ // @set wham = "$.index[*][?(@.name=='Wham')].id"
9+ // @set gmWham = "$.index[*][?(@.docs=='Wham for George Michael')].id"
10+ // @set gm = "$.index[*][?(@.name=='GeorgeMichael')].id"
11+
12+ // Both struct and trait point to impl.
13+ // @has "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" $gmWham
14+ // @is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" $gmWham
15+
16+ // Impl points to both struct and trait.
17+ // @is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.trait.id" $wham
18+ // @is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.for.resolved_path.id" $gm
You can’t perform that action at this time.
0 commit comments