1
Fork 0

Move /src/test to /tests

This commit is contained in:
Albert Larsan 2023-01-05 09:13:28 +01:00
parent ca855e6e42
commit cf2dff2b1e
No known key found for this signature in database
GPG key ID: 92709B88BB8F13EA
27592 changed files with 0 additions and 0 deletions

View 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;

View file

@ -0,0 +1 @@
pub struct ForeignStruct;

View file

@ -0,0 +1 @@
pub trait ForeignTrait {}

View 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 {}

View 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

View 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

View 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

View 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

View 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 {}

View 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 {}