mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 13:36:49 +00:00
tests/rustdoc-json: change assertions to use RFC 9535 jsonpath
This commit is contained in:
parent
42631d8027
commit
13335e313c
@ -2,7 +2,7 @@
|
||||
|
||||
extern crate color;
|
||||
|
||||
//@ has "$.index[*].inner.use[?(@.name == 'Red')]"
|
||||
//@ has "$.index[?(@.inner.use.name == 'Red')]"
|
||||
pub use color::Color::Red;
|
||||
|
||||
//@ !has "$.index[?(@.name == 'Red')]"
|
||||
|
@ -13,7 +13,7 @@ mod usize {}
|
||||
//@ !is "$.index[?(@.name=='checked_add')]" $local_crate_id
|
||||
//@ !has "$.index[?(@.name=='is_ascii_uppercase')]"
|
||||
|
||||
//@ is "$.index[*].inner.use[?(@.name=='my_i32')].id" null
|
||||
//@ is "$.index[?(@.inner.use.name=='my_i32')].inner.use.id" null
|
||||
pub use i32 as my_i32;
|
||||
//@ is "$.index[*].inner.use[?(@.name=='u32')].id" null
|
||||
//@ is "$.index[?(@.inner.use.name=='u32')].inner.use.id" null
|
||||
pub use u32;
|
||||
|
@ -14,14 +14,14 @@ mod m2 {
|
||||
}
|
||||
|
||||
//@ set m1_use = "$.index[?(@.docs=='m1 re-export')].id"
|
||||
//@ is "$.index[*].inner.use[?(@.name=='m1')].id" $m1
|
||||
//@ is "$.index[*].inner.use[?(@.name=='m1')].is_glob" true
|
||||
//@ is "$.index[?(@.inner.use.name=='m1')].inner.use.id" $m1
|
||||
//@ is "$.index[?(@.inner.use.name=='m1')].inner.use.is_glob" true
|
||||
/// m1 re-export
|
||||
pub use m1::*;
|
||||
//@ set m2_use = "$.index[?(@.docs=='m2 re-export')].id"
|
||||
//@ is "$.index[*].inner.use[?(@.name=='m2')].id" $m2
|
||||
//@ is "$.index[*].inner.use[?(@.name=='m2')].is_glob" true
|
||||
//@ is "$.index[?(@.inner.use.name=='m2')].inner.use.id" $m2
|
||||
//@ is "$.index[?(@.inner.use.name=='m2')].inner.use.is_glob" true
|
||||
/// m2 re-export
|
||||
pub use m2::*;
|
||||
|
||||
//@ ismany "$.index[*].inner.module[?(@.is_crate==true)].items[*]" $m1_use $m2_use
|
||||
//@ ismany "$.index[?(@.name=='glob_collision')].inner.module.items[*]" $m1_use $m2_use
|
||||
|
@ -1,13 +1,13 @@
|
||||
//@ !has "$.index[?(@.name=='foo')]"
|
||||
//@ !has "$.index[*].name" '"foo"'
|
||||
mod foo {
|
||||
//@ has "$.index[?(@.name=='Foo')]"
|
||||
//@ has "$.index[*].name" '"Foo"'
|
||||
pub struct Foo;
|
||||
}
|
||||
|
||||
//@ has "$.index[*].inner[?(@.use.source=='foo::Foo')]"
|
||||
//@ has "$.index[*].inner.use.source" '"foo::Foo"'
|
||||
pub use foo::Foo;
|
||||
|
||||
pub mod bar {
|
||||
//@ has "$.index[*].inner[?(@.use.source=='crate::foo::Foo')]"
|
||||
//@ has "$.index[*].inner.use.source" '"crate::foo::Foo"'
|
||||
pub use crate::foo::Foo;
|
||||
}
|
||||
|
@ -5,14 +5,14 @@ pub mod foo {
|
||||
}
|
||||
|
||||
//@ set root_import_id = "$.index[?(@.docs=='Outer re-export')].id"
|
||||
//@ is "$.index[*].inner[?(@.use.source=='foo::Bar')].use.id" $bar_id
|
||||
//@ is "$.index[?(@.inner.use.source=='foo::Bar')].inner.use.id" $bar_id
|
||||
//@ has "$.index[?(@.name=='in_root_and_mod_pub')].inner.module.items[*]" $root_import_id
|
||||
/// Outer re-export
|
||||
pub use foo::Bar;
|
||||
|
||||
pub mod baz {
|
||||
//@ set baz_import_id = "$.index[?(@.docs=='Inner re-export')].id"
|
||||
//@ is "$.index[*].inner[?(@.use.source=='crate::foo::Bar')].use.id" $bar_id
|
||||
//@ is "$.index[?(@.inner.use.source=='crate::foo::Bar')].inner.use.id" $bar_id
|
||||
//@ ismany "$.index[?(@.name=='baz')].inner.module.items[*]" $baz_import_id
|
||||
/// Inner re-export
|
||||
pub use crate::foo::Bar;
|
||||
|
@ -7,5 +7,5 @@ mod m1 {
|
||||
pub use m1::x;
|
||||
|
||||
//@ has "$.index[?(@.name=='x' && @.inner.function)]"
|
||||
//@ has "$.index[*].inner[?(@.use.name=='x')].use.source" '"m1::x"'
|
||||
//@ has "$.index[?(@.inner.use.name=='x')].inner.use.source" '"m1::x"'
|
||||
//@ !has "$.index[?(@.name=='m1')]"
|
||||
|
@ -1,7 +1,7 @@
|
||||
//@ compile-flags: --document-hidden-items
|
||||
|
||||
//@ has "$.index[*].inner[?(@.use.name=='UsedHidden')]"
|
||||
//@ has "$.index[?(@.name=='Hidden')]"
|
||||
//@ has "$.index[*].inner.use.name" '"UsedHidden"'
|
||||
//@ has "$.index[*].name" '"Hidden"'
|
||||
pub mod submodule {
|
||||
#[doc(hidden)]
|
||||
pub struct Hidden {}
|
||||
|
@ -7,8 +7,8 @@ pub mod inner {
|
||||
pub struct Public;
|
||||
}
|
||||
//@ set import_id = "$.index[?(@.docs=='Re-export')].id"
|
||||
//@ !has "$.index[*].inner[?(@.use.name=='Public')]"
|
||||
//@ is "$.index[*].inner[?(@.use.name=='NewName')].use.source" \"inner::Public\"
|
||||
//@ !has "$.index[?(@.inner.use.name=='Public')]"
|
||||
//@ is "$.index[?(@.inner.use.name=='NewName')].inner.use.source" \"inner::Public\"
|
||||
/// Re-export
|
||||
pub use inner::Public as NewName;
|
||||
|
||||
|
@ -13,10 +13,10 @@ pub mod nested {
|
||||
pub fn Foo() {}
|
||||
}
|
||||
|
||||
//@ ismany "$.index[*].inner[?(@.use.name == 'Foo')].use.id" $foo_fn $foo_struct
|
||||
//@ ismany "$.index[*].inner[?(@.use.name == 'Bar')].use.id" $foo_fn $foo_struct
|
||||
//@ ismany "$.index[?(@.inner.use.name == 'Foo')].inner.use.id" $foo_fn $foo_struct
|
||||
//@ ismany "$.index[?(@.inner.use.name == 'Bar')].inner.use.id" $foo_fn $foo_struct
|
||||
|
||||
//@ count "$.index[*].inner[?(@.use.name == 'Foo')]" 2
|
||||
//@ count "$.index[*].inner[?(@.use.name == 'Bar')]" 2
|
||||
//@ count "$.index[?(@.inner.use.name == 'Foo')]" 2
|
||||
//@ count "$.index[?(@.inner.use.name == 'Bar')]" 2
|
||||
pub use Foo as Bar;
|
||||
pub use nested::Foo;
|
||||
|
@ -8,11 +8,11 @@ mod inner {
|
||||
}
|
||||
|
||||
//@ set export_id = "$.index[?(@.docs=='First re-export')].id"
|
||||
//@ is "$.index[*].inner[?(@.use.name=='Trait')].use.id" $trait_id
|
||||
//@ is "$.index[?(@.inner.use.name=='Trait')].inner.use.id" $trait_id
|
||||
/// First re-export
|
||||
pub use inner::Trait;
|
||||
//@ set reexport_id = "$.index[?(@.docs=='Second re-export')].id"
|
||||
//@ is "$.index[*].inner[?(@.use.name=='Reexport')].use.id" $trait_id
|
||||
//@ is "$.index[?(@.inner.use.name=='Reexport')].inner.use.id" $trait_id
|
||||
/// Second re-export
|
||||
pub use inner::Trait as Reexport;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user