File tree 5 files changed +31
-37
lines changed
5 files changed +31
-37
lines changed Original file line number Diff line number Diff line change 1
1
// https://github.com/rust-lang/rust/issues/100252
2
2
3
- #![ feature( no_core) ]
4
- #![ no_core]
5
-
6
3
mod bar {
7
- // @set baz = "$.index[*][?(@.inner.struct )].id"
4
+ // @set baz = "$.index[*][?(@.name == 'Baz' )].id"
8
5
pub struct Baz ;
9
- // @set impl = "$.index[*][?(@.inner.impl)].id"
6
+ // @set impl = "$.index[*][?(@.docs == 'impl')].id"
7
+ /// impl
10
8
impl Baz {
11
- // @set doit = "$.index[*][?(@.inner.function )].id"
9
+ // @set doit = "$.index[*][?(@.name == 'doit' )].id"
12
10
pub fn doit ( ) { }
13
11
}
14
12
}
@@ -18,5 +16,5 @@ pub use bar::Baz;
18
16
19
17
// @is "$.index[*].inner.module.items[*]" $import
20
18
// @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')]"
5
3
// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
6
4
// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
7
5
// @has "$.index[*][?(@.name=='PubTrait')]"
@@ -11,5 +9,7 @@ pub trait PubTrait {}
11
9
pub struct HiddenPubStruct ;
12
10
pub struct NotHiddenPubStruct ;
13
11
12
+ /// Not Here
14
13
impl PubTrait for HiddenPubStruct { }
14
+ /// Here
15
15
impl 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')]"
7
1
// @has "$.index[*][?(@.name=='PubTrait')]"
8
2
pub trait PubTrait { }
9
3
10
4
#[ doc( hidden) ]
11
5
pub mod hidden {
6
+ // @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
12
7
pub struct HiddenPubStruct ;
13
8
9
+ // @!has "$.index[*][?(@.docs == 'Not Here')]"
10
+ /// Not Here
14
11
impl crate :: PubTrait for HiddenPubStruct { }
15
12
}
16
13
17
14
pub mod not_hidden {
15
+ // @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
18
16
pub struct NotHiddenPubStruct ;
19
17
18
+ // @has "$.index[*][?(@.docs == 'Here')]"
19
+ /// Here
20
20
impl crate :: PubTrait for NotHiddenPubStruct { }
21
21
}
Original file line number Diff line number Diff line change 1
- #![ feature( no_core) ]
2
- #![ no_core]
3
-
4
1
// @set struct = "$.index[*][?(@.name=='Struct')].id"
5
2
pub struct Struct ;
6
3
// @set trait = "$.index[*][?(@.name=='Trait')].id"
@@ -9,7 +6,7 @@ pub trait Trait {}
9
6
/// impl
10
7
impl Trait for Struct { }
11
8
12
- // @is "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
9
+ // @has "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
13
10
// @is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl
14
11
// @is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait
15
12
// @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]"
7
1
pub 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
17
2
pub struct GeorgeMichael { }
18
3
4
+ /// Wham for George Michael
19
5
impl 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