Move /src/test to /tests
This commit is contained in:
parent
ca855e6e42
commit
cf2dff2b1e
27592 changed files with 0 additions and 0 deletions
21
tests/rustdoc-json/primitives/local_primitive.rs
Normal file
21
tests/rustdoc-json/primitives/local_primitive.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Regression test for <https://github.com/rust-lang/rust/issues/104064>.
|
||||
|
||||
#![feature(no_core)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![no_core]
|
||||
#![rustc_coherence_is_core]
|
||||
|
||||
//! Link to [i32][prim@i32] [i64][prim@i64]
|
||||
|
||||
#[doc(primitive = "i32")]
|
||||
mod prim_i32 {}
|
||||
|
||||
// @set local_i32 = "$.index[*][?(@.name=='i32')].id"
|
||||
|
||||
// @has "$.index[*][?(@.name=='local_primitive')]"
|
||||
// @ismany "$.index[*][?(@.name=='local_primitive')].inner.items[*]" $local_i32
|
||||
// @is "$.index[*][?(@.name=='local_primitive')].links['prim@i32']" $local_i32
|
||||
|
||||
// Let's ensure the `prim_i32` module isn't present in the output JSON:
|
||||
// @!has "$.index[*][?(@.name=='prim_i32')]"
|
34
tests/rustdoc-json/primitives/primitive_impls.rs
Normal file
34
tests/rustdoc-json/primitives/primitive_impls.rs
Normal file
|
@ -0,0 +1,34 @@
|
|||
#![feature(no_core)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![no_core]
|
||||
#![rustc_coherence_is_core]
|
||||
|
||||
// @set impl_i32 = "$.index[*][?(@.docs=='Only core can do this')].id"
|
||||
|
||||
/// Only core can do this
|
||||
impl i32 {
|
||||
// @set identity = "$.index[*][?(@.docs=='Do Nothing')].id"
|
||||
|
||||
/// Do Nothing
|
||||
pub fn identity(self) -> Self {
|
||||
self
|
||||
}
|
||||
|
||||
// @is "$.index[*][?(@.docs=='Only core can do this')].inner.items[*]" $identity
|
||||
}
|
||||
|
||||
// @set Trait = "$.index[*][?(@.name=='Trait')].id"
|
||||
pub trait Trait {}
|
||||
// @set impl_trait_for_i32 = "$.index[*][?(@.docs=='impl Trait for i32')].id"
|
||||
/// impl Trait for i32
|
||||
impl Trait for i32 {}
|
||||
|
||||
/// i32
|
||||
#[doc(primitive = "i32")]
|
||||
mod prim_i32 {}
|
||||
|
||||
// @set i32 = "$.index[*][?(@.docs=='i32')].id"
|
||||
// @is "$.index[*][?(@.docs=='i32')].name" '"i32"'
|
||||
// @is "$.index[*][?(@.docs=='i32')].inner.name" '"i32"'
|
||||
// @ismany "$.index[*][?(@.docs=='i32')].inner.impls[*]" $impl_i32 $impl_trait_for_i32
|
16
tests/rustdoc-json/primitives/primitive_overloading.rs
Normal file
16
tests/rustdoc-json/primitives/primitive_overloading.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// compile-flags: --document-private-items
|
||||
|
||||
// Regression test for <https://github.com/rust-lang/rust/issues/98006>.
|
||||
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(no_core)]
|
||||
|
||||
#![no_core]
|
||||
|
||||
// @has "$.index[*][?(@.name=='usize')]"
|
||||
// @has "$.index[*][?(@.name=='prim')]"
|
||||
|
||||
#[doc(primitive = "usize")]
|
||||
/// This is the built-in type `usize`.
|
||||
mod prim {
|
||||
}
|
22
tests/rustdoc-json/primitives/primitive_type.rs
Normal file
22
tests/rustdoc-json/primitives/primitive_type.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
// @is "$.index[*][?(@.name=='PrimNever')].visibility" \"public\"
|
||||
// @is "$.index[*][?(@.name=='PrimNever')].inner.type.kind" \"primitive\"
|
||||
// @is "$.index[*][?(@.name=='PrimNever')].inner.type.inner" \"never\"
|
||||
pub type PrimNever = !;
|
||||
|
||||
// @is "$.index[*][?(@.name=='PrimStr')].inner.type.kind" \"primitive\"
|
||||
// @is "$.index[*][?(@.name=='PrimStr')].inner.type.inner" \"str\"
|
||||
pub type PrimStr = str;
|
||||
|
||||
// @is "$.index[*][?(@.name=='PrimBool')].inner.type.kind" \"primitive\"
|
||||
// @is "$.index[*][?(@.name=='PrimBool')].inner.type.inner" \"bool\"
|
||||
pub type PrimBool = bool;
|
||||
|
||||
// @is "$.index[*][?(@.name=='PrimChar')].inner.type.kind" \"primitive\"
|
||||
// @is "$.index[*][?(@.name=='PrimChar')].inner.type.inner" \"char\"
|
||||
pub type PrimChar = char;
|
||||
|
||||
// @is "$.index[*][?(@.name=='PrimU8')].inner.type.kind" \"primitive\"
|
||||
// @is "$.index[*][?(@.name=='PrimU8')].inner.type.inner" \"u8\"
|
||||
pub type PrimU8 = u8;
|
20
tests/rustdoc-json/primitives/use_primitive.rs
Normal file
20
tests/rustdoc-json/primitives/use_primitive.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(rustdoc_internals)]
|
||||
|
||||
#[doc(primitive = "usize")]
|
||||
mod usize {}
|
||||
|
||||
// @set local_crate_id = "$.index[*][?(@.name=='use_primitive')].crate_id"
|
||||
|
||||
// @has "$.index[*][?(@.name=='ilog10')]"
|
||||
// @!is "$.index[*][?(@.name=='ilog10')].crate_id" $local_crate_id
|
||||
// @has "$.index[*][?(@.name=='checked_add')]"
|
||||
// @!is "$.index[*][?(@.name=='checked_add')]" $local_crate_id
|
||||
// @!has "$.index[*][?(@.name=='is_ascii_uppercase')]"
|
||||
|
||||
// @is "$.index[*][?(@.kind=='import' && @.inner.name=='my_i32')].inner.id" null
|
||||
pub use i32 as my_i32;
|
||||
|
||||
// @is "$.index[*][?(@.kind=='import' && @.inner.name=='u32')].inner.id" null
|
||||
pub use u32;
|
Loading…
Add table
Add a link
Reference in a new issue