Move /src/test to /tests
This commit is contained in:
parent
ca855e6e42
commit
cf2dff2b1e
27592 changed files with 0 additions and 0 deletions
18
tests/rustdoc-json/impls/auto.rs
Normal file
18
tests/rustdoc-json/impls/auto.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
#![feature(no_core, auto_traits, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
|
||||
pub auto trait Bar {}
|
||||
|
||||
/// has span
|
||||
impl Foo {
|
||||
pub fn baz(&self) {}
|
||||
}
|
||||
|
||||
// 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]"
|
||||
pub struct Foo;
|
1
tests/rustdoc-json/impls/auxiliary/foreign_struct.rs
Normal file
1
tests/rustdoc-json/impls/auxiliary/foreign_struct.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub struct ForeignStruct;
|
1
tests/rustdoc-json/impls/auxiliary/foreign_trait.rs
Normal file
1
tests/rustdoc-json/impls/auxiliary/foreign_trait.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub trait ForeignTrait {}
|
18
tests/rustdoc-json/impls/blanket_with_local.rs
Normal file
18
tests/rustdoc-json/impls/blanket_with_local.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Test for the ICE in rust/83718
|
||||
// A blanket impl plus a local type together shouldn't result in mismatched ID issues
|
||||
|
||||
// @has "$.index[*][?(@.name=='Load')]"
|
||||
pub trait Load {
|
||||
// @has "$.index[*][?(@.name=='load')]"
|
||||
fn load() {}
|
||||
// @has "$.index[*][?(@.name=='write')]"
|
||||
fn write(self) {}
|
||||
}
|
||||
|
||||
impl<P> Load for P {
|
||||
fn load() {}
|
||||
fn write(self) {}
|
||||
}
|
||||
|
||||
// @has "$.index[*][?(@.name=='Wrapper')]"
|
||||
pub struct Wrapper {}
|
18
tests/rustdoc-json/impls/foreign_for_local.rs
Normal file
18
tests/rustdoc-json/impls/foreign_for_local.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// aux-build: foreign_trait.rs
|
||||
extern crate foreign_trait;
|
||||
|
||||
/// ForeignTrait id hack
|
||||
pub use foreign_trait::ForeignTrait as _;
|
||||
// @set ForeignTrait = "$.index[*][?(@.docs=='ForeignTrait id hack')].inner.id"
|
||||
|
||||
pub struct LocalStruct;
|
||||
// @set LocalStruct = "$.index[*][?(@.name=='LocalStruct')].id"
|
||||
|
||||
/// foreign for local
|
||||
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
|
||||
|
||||
// @has "$.index[*][?(@.name=='LocalStruct')].inner.impls[*]" $impl
|
22
tests/rustdoc-json/impls/import_from_private.rs
Normal file
22
tests/rustdoc-json/impls/import_from_private.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
// https://github.com/rust-lang/rust/issues/100252
|
||||
|
||||
#![feature(no_core)]
|
||||
#![no_core]
|
||||
|
||||
mod bar {
|
||||
// @set baz = "$.index[*][?(@.kind=='struct')].id"
|
||||
pub struct Baz;
|
||||
// @set impl = "$.index[*][?(@.kind=='impl')].id"
|
||||
impl Baz {
|
||||
// @set doit = "$.index[*][?(@.kind=='function')].id"
|
||||
pub fn doit() {}
|
||||
}
|
||||
}
|
||||
|
||||
// @set import = "$.index[*][?(@.kind=='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
|
18
tests/rustdoc-json/impls/local_for_foreign.rs
Normal file
18
tests/rustdoc-json/impls/local_for_foreign.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// aux-build: foreign_struct.rs
|
||||
extern crate foreign_struct;
|
||||
|
||||
/// ForeignStruct id hack
|
||||
pub use foreign_struct::ForeignStruct as _;
|
||||
// @set ForeignStruct = "$.index[*][?(@.docs=='ForeignStruct id hack')].inner.id"
|
||||
|
||||
pub trait LocalTrait {}
|
||||
// @set LocalTrait = "$.index[*][?(@.name=='LocalTrait')].id"
|
||||
|
||||
/// local for foreign
|
||||
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[*][?(@.name=='LocalTrait')].inner.implementations[*]" $impl
|
15
tests/rustdoc-json/impls/local_for_local.rs
Normal file
15
tests/rustdoc-json/impls/local_for_local.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
#![feature(no_core)]
|
||||
#![no_core]
|
||||
|
||||
// @set struct = "$.index[*][?(@.name=='Struct')].id"
|
||||
pub struct Struct;
|
||||
// @set trait = "$.index[*][?(@.name=='Trait')].id"
|
||||
pub trait Trait {}
|
||||
// @set impl = "$.index[*][?(@.docs=='impl')].id"
|
||||
/// 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
|
21
tests/rustdoc-json/impls/local_for_local_primitive.rs
Normal file
21
tests/rustdoc-json/impls/local_for_local_primitive.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
#![feature(no_core)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![no_core]
|
||||
|
||||
// @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"'
|
||||
/// Local for bool
|
||||
impl Local for bool {}
|
||||
|
||||
// @set impl = "$.index[*][?(@.docs=='Local for bool')].id"
|
||||
// @is "$.index[*][?(@.name=='Local')].inner.implementations[*]" $impl
|
||||
|
||||
// FIXME(#101695): Test bool's `impls` include "Local for bool"
|
||||
// @has "$.index[*][?(@.name=='bool')]"
|
||||
#[doc(primitive = "bool")]
|
||||
/// Boolean docs
|
||||
mod prim_bool {}
|
7
tests/rustdoc-json/impls/local_for_primitive.rs
Normal file
7
tests/rustdoc-json/impls/local_for_primitive.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// @set local = "$.index[*][?(@.name=='Local')]"
|
||||
pub trait Local {}
|
||||
|
||||
// @set impl = "$.index[*][?(@.docs=='local for bool')].id"
|
||||
// @is "$.index[*][?(@.name=='Local')].inner.implementations[*]" $impl
|
||||
/// local for bool
|
||||
impl Local for bool {}
|
Loading…
Add table
Add a link
Reference in a new issue