diff options
Diffstat (limited to 'tests/rustdoc-json/impls')
-rw-r--r-- | tests/rustdoc-json/impls/auto.rs | 3 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/foreign_for_local.rs | 8 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/impl_item_visibility.rs | 26 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs | 28 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/impl_item_visibility_show_private.rs | 27 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/import_from_private.rs | 16 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/local_for_foreign.rs | 8 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/local_for_local.rs | 8 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/local_for_local_primitive.rs | 7 | ||||
-rw-r--r-- | tests/rustdoc-json/impls/local_for_primitive.rs | 2 |
10 files changed, 107 insertions, 26 deletions
diff --git a/tests/rustdoc-json/impls/auto.rs b/tests/rustdoc-json/impls/auto.rs index 50d852414..ace37e5b3 100644 --- a/tests/rustdoc-json/impls/auto.rs +++ b/tests/rustdoc-json/impls/auto.rs @@ -12,7 +12,8 @@ impl Foo { } // Testing spans, so all tests below code -// @is "$.index[*][?(@.kind=='impl' && @.inner.synthetic==true)].span" null // @is "$.index[*][?(@.docs=='has span')].span.begin" "[10, 0]" // @is "$.index[*][?(@.docs=='has span')].span.end" "[12, 1]" +// FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91 +// is "$.index[*][?(@.inner.impl.synthetic==true)].span" null pub struct Foo; diff --git a/tests/rustdoc-json/impls/foreign_for_local.rs b/tests/rustdoc-json/impls/foreign_for_local.rs index 290c2d571..20e1cecd7 100644 --- a/tests/rustdoc-json/impls/foreign_for_local.rs +++ b/tests/rustdoc-json/impls/foreign_for_local.rs @@ -3,7 +3,7 @@ extern crate foreign_trait; /// ForeignTrait id hack pub use foreign_trait::ForeignTrait as _; -// @set ForeignTrait = "$.index[*][?(@.docs=='ForeignTrait id hack')].inner.id" +// @set ForeignTrait = "$.index[*][?(@.docs=='ForeignTrait id hack')].inner.import.id" pub struct LocalStruct; // @set LocalStruct = "$.index[*][?(@.name=='LocalStruct')].id" @@ -12,7 +12,7 @@ pub struct LocalStruct; impl foreign_trait::ForeignTrait for LocalStruct {} // @set impl = "$.index[*][?(@.docs=='foreign for local')].id" -// @is "$.index[*][?(@.docs=='foreign for local')].inner.for.inner.id" $LocalStruct -// @is "$.index[*][?(@.docs=='foreign for local')].inner.trait.id" $ForeignTrait +// @is "$.index[*][?(@.docs=='foreign for local')].inner.impl.for.resolved_path.id" $LocalStruct +// @is "$.index[*][?(@.docs=='foreign for local')].inner.impl.trait.id" $ForeignTrait -// @has "$.index[*][?(@.name=='LocalStruct')].inner.impls[*]" $impl +// @has "$.index[*][?(@.name=='LocalStruct')].inner.struct.impls[*]" $impl diff --git a/tests/rustdoc-json/impls/impl_item_visibility.rs b/tests/rustdoc-json/impls/impl_item_visibility.rs new file mode 100644 index 000000000..efa54d91d --- /dev/null +++ b/tests/rustdoc-json/impls/impl_item_visibility.rs @@ -0,0 +1,26 @@ +#![feature(no_core)] +#![no_core] + +pub struct Foo; + +/// impl Foo priv +impl Foo { + fn baz() {} +} +// @!has '$.index[*][?(@.docs=="impl Foo priv")]' + + +/// impl Foo pub +impl Foo { + pub fn qux() {} +} +// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' + + +/// impl Foo hidden +impl Foo { + #[doc(hidden)] + pub fn __quazl(){} +} +// FIXME(#111564): Is this the right behaviour? +// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs new file mode 100644 index 000000000..3c6fefc4c --- /dev/null +++ b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs @@ -0,0 +1,28 @@ +// compile-flags: --document-hidden-items +#![feature(no_core)] +#![no_core] + +pub struct Foo; + +/// impl Foo priv +impl Foo { + fn baz() {} +} +// FIXME(#111564): Is this the right behaviour? +// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"' + + +/// impl Foo pub +impl Foo { + pub fn qux() {} +} +// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' + + +/// impl Foo hidden +impl Foo { + #[doc(hidden)] + pub fn __quazl(){} +} +// FIXME(#111564): Is this the right behaviour? +// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs new file mode 100644 index 000000000..b98d1e416 --- /dev/null +++ b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs @@ -0,0 +1,27 @@ +// compile-flags: --document-private-items +#![feature(no_core)] +#![no_core] + +pub struct Foo; + +/// impl Foo priv +impl Foo { + fn baz() {} +} +// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"' + + +/// impl Foo pub +impl Foo { + pub fn qux() {} +} +// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' + + +/// impl Foo hidden +impl Foo { + #[doc(hidden)] + pub fn __quazl(){} +} +// FIXME(#111564): Is this the right behaviour? +// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' diff --git a/tests/rustdoc-json/impls/import_from_private.rs b/tests/rustdoc-json/impls/import_from_private.rs index fa88b6113..d2b0665dc 100644 --- a/tests/rustdoc-json/impls/import_from_private.rs +++ b/tests/rustdoc-json/impls/import_from_private.rs @@ -4,19 +4,19 @@ #![no_core] mod bar { - // @set baz = "$.index[*][?(@.kind=='struct')].id" + // @set baz = "$.index[*][?(@.inner.struct)].id" pub struct Baz; - // @set impl = "$.index[*][?(@.kind=='impl')].id" + // @set impl = "$.index[*][?(@.inner.impl)].id" impl Baz { - // @set doit = "$.index[*][?(@.kind=='function')].id" + // @set doit = "$.index[*][?(@.inner.function)].id" pub fn doit() {} } } -// @set import = "$.index[*][?(@.kind=='import')].id" +// @set import = "$.index[*][?(@.inner.import)].id" pub use bar::Baz; -// @is "$.index[*][?(@.kind=='module')].inner.items[*]" $import -// @is "$.index[*][?(@.kind=='import')].inner.id" $baz -// @is "$.index[*][?(@.kind=='struct')].inner.impls[*]" $impl -// @is "$.index[*][?(@.kind=='impl')].inner.items[*]" $doit +// @is "$.index[*].inner.module.items[*]" $import +// @is "$.index[*].inner.import.id" $baz +// @is "$.index[*].inner.struct.impls[*]" $impl +// @is "$.index[*].inner.impl.items[*]" $doit diff --git a/tests/rustdoc-json/impls/local_for_foreign.rs b/tests/rustdoc-json/impls/local_for_foreign.rs index 74f2f08b5..72352ce88 100644 --- a/tests/rustdoc-json/impls/local_for_foreign.rs +++ b/tests/rustdoc-json/impls/local_for_foreign.rs @@ -3,7 +3,7 @@ extern crate foreign_struct; /// ForeignStruct id hack pub use foreign_struct::ForeignStruct as _; -// @set ForeignStruct = "$.index[*][?(@.docs=='ForeignStruct id hack')].inner.id" +// @set ForeignStruct = "$.index[*][?(@.docs=='ForeignStruct id hack')].inner.import.id" pub trait LocalTrait {} // @set LocalTrait = "$.index[*][?(@.name=='LocalTrait')].id" @@ -12,7 +12,7 @@ pub trait LocalTrait {} impl LocalTrait for foreign_struct::ForeignStruct {} // @set impl = "$.index[*][?(@.docs=='local for foreign')].id" -// @is "$.index[*][?(@.docs=='local for foreign')].inner.trait.id" $LocalTrait -// @is "$.index[*][?(@.docs=='local for foreign')].inner.for.inner.id" $ForeignStruct +// @is "$.index[*][?(@.docs=='local for foreign')].inner.impl.trait.id" $LocalTrait +// @is "$.index[*][?(@.docs=='local for foreign')].inner.impl.for.resolved_path.id" $ForeignStruct -// @is "$.index[*][?(@.name=='LocalTrait')].inner.implementations[*]" $impl +// @is "$.index[*][?(@.name=='LocalTrait')].inner.trait.implementations[*]" $impl diff --git a/tests/rustdoc-json/impls/local_for_local.rs b/tests/rustdoc-json/impls/local_for_local.rs index 93dedb7ec..37a720003 100644 --- a/tests/rustdoc-json/impls/local_for_local.rs +++ b/tests/rustdoc-json/impls/local_for_local.rs @@ -9,7 +9,7 @@ pub trait Trait {} /// impl impl Trait for Struct {} -// @is "$.index[*][?(@.name=='Struct')].inner.impls[*]" $impl -// @is "$.index[*][?(@.name=='Trait')].inner.implementations[*]" $impl -// @is "$.index[*][?(@.docs=='impl')].inner.trait.id" $trait -// @is "$.index[*][?(@.docs=='impl')].inner.for.inner.id" $struct +// @is "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl +// @is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl +// @is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait +// @is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct diff --git a/tests/rustdoc-json/impls/local_for_local_primitive.rs b/tests/rustdoc-json/impls/local_for_local_primitive.rs index 8383dcc04..769dd3f0a 100644 --- a/tests/rustdoc-json/impls/local_for_local_primitive.rs +++ b/tests/rustdoc-json/impls/local_for_local_primitive.rs @@ -5,14 +5,13 @@ // @set Local = "$.index[*][?(@.name=='Local')].id" pub trait Local {} -// @is "$.index[*][?(@.docs=='Local for bool')].inner.trait.id" $Local -// @is "$.index[*][?(@.docs=='Local for bool')].inner.for.kind" '"primitive"' -// @is "$.index[*][?(@.docs=='Local for bool')].inner.for.inner" '"bool"' +// @is "$.index[*][?(@.docs=='Local for bool')].inner.impl.trait.id" $Local +// @is "$.index[*][?(@.docs=='Local for bool')].inner.impl.for.primitive" '"bool"' /// Local for bool impl Local for bool {} // @set impl = "$.index[*][?(@.docs=='Local for bool')].id" -// @is "$.index[*][?(@.name=='Local')].inner.implementations[*]" $impl +// @is "$.index[*][?(@.name=='Local')].inner.trait.implementations[*]" $impl // FIXME(#101695): Test bool's `impls` include "Local for bool" // @has "$.index[*][?(@.name=='bool')]" diff --git a/tests/rustdoc-json/impls/local_for_primitive.rs b/tests/rustdoc-json/impls/local_for_primitive.rs index 7702a526f..85278c0e0 100644 --- a/tests/rustdoc-json/impls/local_for_primitive.rs +++ b/tests/rustdoc-json/impls/local_for_primitive.rs @@ -2,6 +2,6 @@ pub trait Local {} // @set impl = "$.index[*][?(@.docs=='local for bool')].id" -// @is "$.index[*][?(@.name=='Local')].inner.implementations[*]" $impl +// @is "$.index[*][?(@.name=='Local')].inner.trait.implementations[*]" $impl /// local for bool impl Local for bool {} |