mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
rustdoc-json: Use @ismany
in tests
This commit is contained in:
parent
64f790f030
commit
760b972672
@ -4,27 +4,28 @@
|
||||
// @is nested.json "$.crate_version" \"1.0.0\"
|
||||
// @is - "$.index[*][?(@.name=='nested')].kind" \"module\"
|
||||
// @is - "$.index[*][?(@.name=='nested')].inner.is_crate" true
|
||||
// @count - "$.index[*][?(@.name=='nested')].inner.items[*]" 1
|
||||
|
||||
// @set l1_id = - "$.index[*][?(@.name=='l1')].id"
|
||||
// @ismany - "$.index[*][?(@.name=='nested')].inner.items[*]" $l1_id
|
||||
|
||||
// @is nested.json "$.index[*][?(@.name=='l1')].kind" \"module\"
|
||||
// @is - "$.index[*][?(@.name=='l1')].inner.is_crate" false
|
||||
// @count - "$.index[*][?(@.name=='l1')].inner.items[*]" 2
|
||||
pub mod l1 {
|
||||
|
||||
// @is nested.json "$.index[*][?(@.name=='l3')].kind" \"module\"
|
||||
// @is - "$.index[*][?(@.name=='l3')].inner.is_crate" false
|
||||
// @count - "$.index[*][?(@.name=='l3')].inner.items[*]" 1
|
||||
// @set l3_id = - "$.index[*][?(@.name=='l3')].id"
|
||||
// @has - "$.index[*][?(@.name=='l1')].inner.items[*]" $l3_id
|
||||
pub mod l3 {
|
||||
|
||||
// @is nested.json "$.index[*][?(@.name=='L4')].kind" \"struct\"
|
||||
// @is - "$.index[*][?(@.name=='L4')].inner.struct_type" \"unit\"
|
||||
// @set l4_id = - "$.index[*][?(@.name=='L4')].id"
|
||||
// @has - "$.index[*][?(@.name=='l3')].inner.items[*]" $l4_id
|
||||
// @ismany - "$.index[*][?(@.name=='l3')].inner.items[*]" $l4_id
|
||||
pub struct L4;
|
||||
}
|
||||
// @is nested.json "$.index[*][?(@.inner.source=='l3::L4')].kind" \"import\"
|
||||
// @is - "$.index[*][?(@.inner.source=='l3::L4')].inner.glob" false
|
||||
// @is - "$.index[*][?(@.inner.source=='l3::L4')].inner.id" $l4_id
|
||||
// @set l4_use_id = - "$.index[*][?(@.inner.source=='l3::L4')].id"
|
||||
pub use l3::L4;
|
||||
}
|
||||
// @ismany - "$.index[*][?(@.name=='l1')].inner.items[*]" $l3_id $l4_use_id
|
||||
|
@ -12,11 +12,12 @@ mod mod1 {
|
||||
// @!has - "$.index[*][?(@.name=='private_fn')]"
|
||||
fn private_fn();
|
||||
}
|
||||
// @count - "$.index[*][?(@.name=='mod1')].inner.items[*]" 1
|
||||
// @has - "$.index[*][?(@.name=='mod1')].inner.items[*]" $public_fn_id
|
||||
// @ismany - "$.index[*][?(@.name=='mod1')].inner.items[*]" $public_fn_id
|
||||
// @set mod1_id = - "$.index[*][?(@.name=='mod1')].id"
|
||||
}
|
||||
|
||||
// @is - "$.index[*][?(@.kind=='import')].inner.glob" true
|
||||
// @is - "$.index[*][?(@.kind=='import')].inner.id" $mod1_id
|
||||
// @set use_id = - "$.index[*][?(@.kind=='import')].id"
|
||||
// @ismany - "$.index[*][?(@.name=='glob_extern')].inner.items[*]" $use_id
|
||||
pub use mod1::*;
|
||||
|
@ -16,7 +16,7 @@ mod mod1 {
|
||||
struct Mod2Private;
|
||||
}
|
||||
|
||||
// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='mod2')]"
|
||||
// @set mod2_use_id = - "$.index[*][?(@.kind=='import' && @.inner.name=='mod2')].id"
|
||||
pub use self::mod2::*;
|
||||
|
||||
// @set m1pub_id = - "$.index[*][?(@.name=='Mod1Public')].id"
|
||||
@ -25,8 +25,9 @@ mod mod1 {
|
||||
struct Mod1Private;
|
||||
}
|
||||
|
||||
// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='mod1')]"
|
||||
// @set mod1_use_id = - "$.index[*][?(@.kind=='import' && @.inner.name=='mod1')].id"
|
||||
pub use mod1::*;
|
||||
|
||||
// @has - "$.index[*][?(@.name=='mod2')].inner.items[*]" $m2pub_id
|
||||
// @has - "$.index[*][?(@.name=='mod1')].inner.items[*]" $m1pub_id
|
||||
// @ismany - "$.index[*][?(@.name=='mod2')].inner.items[*]" $m2pub_id
|
||||
// @ismany - "$.index[*][?(@.name=='mod1')].inner.items[*]" $m1pub_id $mod2_use_id
|
||||
// @ismany - "$.index[*][?(@.name=='glob_private')].inner.items[*]" $mod1_use_id
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
pub mod foo {
|
||||
// @set bar_id = in_root_and_mod_pub.json "$.index[*][?(@.name=='Bar')].id"
|
||||
// @has - "$.index[*][?(@.name=='foo')].inner.items[*]" $bar_id
|
||||
// @ismany - "$.index[*][?(@.name=='foo')].inner.items[*]" $bar_id
|
||||
pub struct Bar;
|
||||
}
|
||||
|
||||
@ -15,6 +15,6 @@ pub use foo::Bar;
|
||||
pub mod baz {
|
||||
// @set baz_import_id = - "$.index[*][?(@.inner.source=='crate::foo::Bar')].id"
|
||||
// @is - "$.index[*][?(@.inner.source=='crate::foo::Bar')].inner.id" $bar_id
|
||||
// @has - "$.index[*][?(@.name=='baz')].inner.items[*]" $baz_import_id
|
||||
// @ismany - "$.index[*][?(@.name=='baz')].inner.items[*]" $baz_import_id
|
||||
pub use crate::foo::Bar;
|
||||
}
|
||||
|
@ -3,15 +3,13 @@
|
||||
#![no_core]
|
||||
#![feature(no_core)]
|
||||
|
||||
// @count macro.json "$.index[*][?(@.name=='macro')].inner.items[*]" 2
|
||||
|
||||
// @set repro_id = macro.json "$.index[*][?(@.name=='repro')].id"
|
||||
// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro_id
|
||||
#[macro_export]
|
||||
macro_rules! repro {
|
||||
() => {};
|
||||
}
|
||||
|
||||
// @set repro2_id = macro.json "$.index[*][?(@.inner.name=='repro2')].id"
|
||||
// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro2_id
|
||||
pub use crate::repro as repro2;
|
||||
|
||||
// @ismany macro.json "$.index[*][?(@.name=='macro')].inner.items[*]" $repro_id $repro2_id
|
||||
|
@ -1,4 +1,5 @@
|
||||
// aux-build:pub-struct.rs
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// Test for the ICE in https://github.com/rust-lang/rust/issues/83057
|
||||
// An external type re-exported with different attributes shouldn't cause an error
|
||||
@ -7,12 +8,21 @@
|
||||
#![feature(no_core)]
|
||||
|
||||
extern crate pub_struct as foo;
|
||||
|
||||
#[doc(inline)]
|
||||
|
||||
// @set crate_use_id = private_twice_one_inline.json "$.index[*][?(@.docs=='Hack A')].id"
|
||||
// @set foo_id = - "$.index[*][?(@.docs=='Hack A')].inner.id"
|
||||
/// Hack A
|
||||
pub use foo::Foo;
|
||||
|
||||
// @set bar_id = - "$.index[*][?(@.name=='bar')].id"
|
||||
pub mod bar {
|
||||
// @is - "$.index[*][?(@.docs=='Hack B')].inner.id" $foo_id
|
||||
// @set bar_use_id = - "$.index[*][?(@.docs=='Hack B')].id"
|
||||
// @ismany - "$.index[*][?(@.name=='bar')].inner.items[*]" $bar_use_id
|
||||
/// Hack B
|
||||
pub use foo::Foo;
|
||||
}
|
||||
|
||||
// @count private_twice_one_inline.json "$.index[*][?(@.kind=='import')]" 2
|
||||
// @ismany - "$.index[*][?(@.kind=='import')].id" $crate_use_id $bar_use_id
|
||||
// @ismany - "$.index[*][?(@.name=='private_twice_one_inline')].inner.items[*]" $bar_id $crate_use_id
|
||||
|
@ -1,3 +1,5 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// Test for the ICE in https://github.com/rust-lang/rust/issues/83720
|
||||
// A pub-in-private type re-exported under two different names shouldn't cause an error
|
||||
|
||||
@ -18,6 +20,4 @@ pub use style::Color;
|
||||
// @set colour_export_id = - "$.index[*][?(@.kind=='import' && @.inner.name=='Colour')].id"
|
||||
pub use style::Color as Colour;
|
||||
|
||||
// @count - "$.index[*][?(@.name=='private_two_names')].inner.items[*]" 2
|
||||
// @has - "$.index[*][?(@.name=='private_two_names')].inner.items[*]" $color_export_id
|
||||
// @has - "$.index[*][?(@.name=='private_two_names')].inner.items[*]" $colour_export_id
|
||||
// @ismany - "$.index[*][?(@.name=='private_two_names')].inner.items[*]" $color_export_id $colour_export_id
|
||||
|
@ -4,14 +4,14 @@
|
||||
#![feature(no_core)]
|
||||
|
||||
// @set inner_id = rename_public.json "$.index[*][?(@.name=='inner')].id"
|
||||
// @has - "$.index[*][?(@.name=='rename_public')].inner.items[*]" $inner_id
|
||||
pub mod inner {
|
||||
// @set public_id = - "$.index[*][?(@.name=='Public')].id"
|
||||
// @has - "$.index[*][?(@.name=='inner')].inner.items[*]" $public_id
|
||||
// @ismany - "$.index[*][?(@.name=='inner')].inner.items[*]" $public_id
|
||||
pub struct Public;
|
||||
}
|
||||
// @set import_id = - "$.index[*][?(@.inner.name=='NewName')].id"
|
||||
// @!has - "$.index[*][?(@.inner.name=='Public')]"
|
||||
// @has - "$.index[*][?(@.name=='rename_public')].inner.items[*]" $import_id
|
||||
// @is - "$.index[*][?(@.inner.name=='NewName')].inner.source" \"inner::Public\"
|
||||
pub use inner::Public as NewName;
|
||||
|
||||
// @ismany - "$.index[*][?(@.name=='rename_public')].inner.items[*]" $inner_id $import_id
|
||||
|
@ -1,3 +1,5 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// Regression test for <https://github.com/rust-lang/rust/issues/97432>.
|
||||
|
||||
#![feature(no_core)]
|
||||
@ -5,11 +7,17 @@
|
||||
#![no_core]
|
||||
|
||||
// @has same_type_reexported_more_than_once.json
|
||||
// @has - "$.index[*][?(@.name=='Trait')]"
|
||||
pub use inner::Trait;
|
||||
// @has - "$.index[*].inner[?(@.name=='Reexport')].id"
|
||||
pub use inner::Trait as Reexport;
|
||||
|
||||
mod inner {
|
||||
// @set trait_id = - "$.index[*][?(@.name=='Trait')].id"
|
||||
pub trait Trait {}
|
||||
}
|
||||
|
||||
// @set export_id = - "$.index[*][?(@.inner.name=='Trait')].id"
|
||||
// @is - "$.index[*][?(@.inner.name=='Trait')].inner.id" $trait_id
|
||||
pub use inner::Trait;
|
||||
// @set reexport_id = - "$.index[*][?(@.inner.name=='Reexport')].id"
|
||||
// @is - "$.index[*][?(@.inner.name=='Reexport')].inner.id" $trait_id
|
||||
pub use inner::Trait as Reexport;
|
||||
|
||||
// @ismany - "$.index[*][?(@.name=='same_type_reexported_more_than_once')].inner.items[*]" $reexport_id $export_id
|
||||
|
@ -10,6 +10,8 @@ mod inner {
|
||||
}
|
||||
|
||||
// @is - "$.index[*][?(@.kind=='import')].inner.name" \"Public\"
|
||||
// @set use_id = - "$.index[*][?(@.kind=='import')].id"
|
||||
pub use inner::Public;
|
||||
|
||||
// @has - "$.index[*][?(@.name=='inner')].inner.items[*]" $pub_id
|
||||
// @ismany - "$.index[*][?(@.name=='inner')].inner.items[*]" $pub_id
|
||||
// @ismany - "$.index[*][?(@.name=='simple_private')].inner.items[*]" $use_id
|
||||
|
@ -4,15 +4,15 @@
|
||||
#![feature(no_core)]
|
||||
|
||||
// @set inner_id = simple_public.json "$.index[*][?(@.name=='inner')].id"
|
||||
// @has - "$.index[*][?(@.name=='simple_public')].inner.items[*]" $inner_id
|
||||
pub mod inner {
|
||||
|
||||
// @set public_id = - "$.index[*][?(@.name=='Public')].id"
|
||||
// @has - "$.index[*][?(@.name=='inner')].inner.items[*]" $public_id
|
||||
// @ismany - "$.index[*][?(@.name=='inner')].inner.items[*]" $public_id
|
||||
pub struct Public;
|
||||
}
|
||||
|
||||
// @set import_id = - "$.index[*][?(@.inner.name=='Public')].id"
|
||||
// @has - "$.index[*][?(@.name=='simple_public')].inner.items[*]" $import_id
|
||||
// @is - "$.index[*][?(@.inner.name=='Public')].inner.source" \"inner::Public\"
|
||||
pub use inner::Public;
|
||||
|
||||
// @ismany - "$.index[*][?(@.name=='simple_public')].inner.items[*]" $import_id $inner_id
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
// @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\"
|
||||
// @ismany - "$.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
|
||||
|
Loading…
Reference in New Issue
Block a user