Move /src/test to /tests
This commit is contained in:
parent
ca855e6e42
commit
cf2dff2b1e
27592 changed files with 0 additions and 0 deletions
7
tests/rustdoc-js/basic.js
Normal file
7
tests/rustdoc-js/basic.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const QUERY = 'Fo';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'basic', 'name': 'Foo' },
|
||||
],
|
||||
};
|
2
tests/rustdoc-js/basic.rs
Normal file
2
tests/rustdoc-js/basic.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
/// Docs for Foo
|
||||
pub struct Foo;
|
9
tests/rustdoc-js/doc-alias-filter-out.js
Normal file
9
tests/rustdoc-js/doc-alias-filter-out.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = 'true';
|
||||
|
||||
const FILTER_CRATE = 'some_other_crate';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [],
|
||||
};
|
2
tests/rustdoc-js/doc-alias-filter-out.rs
Normal file
2
tests/rustdoc-js/doc-alias-filter-out.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
#[doc(alias = "true")]
|
||||
pub struct Foo;
|
17
tests/rustdoc-js/doc-alias-filter.js
Normal file
17
tests/rustdoc-js/doc-alias-filter.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = '"true"';
|
||||
|
||||
const FILTER_CRATE = 'doc_alias_filter';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias_filter',
|
||||
'name': 'Foo',
|
||||
'alias': 'true',
|
||||
'href': '../doc_alias_filter/struct.Foo.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
};
|
5
tests/rustdoc-js/doc-alias-filter.rs
Normal file
5
tests/rustdoc-js/doc-alias-filter.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#[doc(alias = "true")]
|
||||
pub struct Foo;
|
||||
|
||||
#[doc(alias = "false")]
|
||||
pub struct Bar;
|
19
tests/rustdoc-js/doc-alias-whitespace.js
Normal file
19
tests/rustdoc-js/doc-alias-whitespace.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = [
|
||||
'Demon Lord',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias_whitespace',
|
||||
'name': 'Struct',
|
||||
'alias': 'Demon Lord',
|
||||
'href': '../doc_alias_whitespace/struct.Struct.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
2
tests/rustdoc-js/doc-alias-whitespace.rs
Normal file
2
tests/rustdoc-js/doc-alias-whitespace.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
#[doc(alias = "Demon Lord")]
|
||||
pub struct Struct;
|
295
tests/rustdoc-js/doc-alias.js
Normal file
295
tests/rustdoc-js/doc-alias.js
Normal file
|
@ -0,0 +1,295 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = [
|
||||
'StructItem',
|
||||
'StructFieldItem',
|
||||
'StructMethodItem',
|
||||
'ImplTraitItem',
|
||||
'StructImplConstItem',
|
||||
'ImplTraitFunction',
|
||||
'EnumItem',
|
||||
'VariantItem',
|
||||
'EnumMethodItem',
|
||||
'TypedefItem',
|
||||
'TraitItem',
|
||||
'TraitTypeItem',
|
||||
'AssociatedConstItem',
|
||||
'TraitFunctionItem',
|
||||
'FunctionItem',
|
||||
'ModuleItem',
|
||||
'ConstItem',
|
||||
'StaticItem',
|
||||
'UnionItem',
|
||||
'UnionFieldItem',
|
||||
'UnionMethodItem',
|
||||
'MacroItem',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
// StructItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Struct',
|
||||
'alias': 'StructItem',
|
||||
'href': '../doc_alias/struct.Struct.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// StructFieldItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Struct',
|
||||
'name': 'field',
|
||||
'alias': 'StructFieldItem',
|
||||
'href': '../doc_alias/struct.Struct.html#structfield.field',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// StructMethodItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Struct',
|
||||
'name': 'method',
|
||||
'alias': 'StructMethodItem',
|
||||
'href': '../doc_alias/struct.Struct.html#method.method',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// ImplTraitItem
|
||||
'others': [],
|
||||
},
|
||||
{
|
||||
// StructImplConstItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Struct',
|
||||
'name': 'ImplConstItem',
|
||||
'alias': 'StructImplConstItem',
|
||||
'href': '../doc_alias/struct.Struct.html#associatedconstant.ImplConstItem',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// ImplTraitFunction
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Struct',
|
||||
'name': 'function',
|
||||
'alias': 'ImplTraitFunction',
|
||||
'href': '../doc_alias/struct.Struct.html#method.function',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// EnumItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Enum',
|
||||
'alias': 'EnumItem',
|
||||
'href': '../doc_alias/enum.Enum.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// VariantItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Enum',
|
||||
'name': 'Variant',
|
||||
'alias': 'VariantItem',
|
||||
'href': '../doc_alias/enum.Enum.html#variant.Variant',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// EnumMethodItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Enum',
|
||||
'name': 'method',
|
||||
'alias': 'EnumMethodItem',
|
||||
'href': '../doc_alias/enum.Enum.html#method.method',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// TypedefItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Typedef',
|
||||
'alias': 'TypedefItem',
|
||||
'href': '../doc_alias/type.Typedef.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// TraitItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Trait',
|
||||
'alias': 'TraitItem',
|
||||
'href': '../doc_alias/trait.Trait.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// TraitTypeItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Trait',
|
||||
'name': 'Target',
|
||||
'alias': 'TraitTypeItem',
|
||||
'href': '../doc_alias/trait.Trait.html#associatedtype.Target',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// AssociatedConstItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Trait',
|
||||
'name': 'AssociatedConst',
|
||||
'alias': 'AssociatedConstItem',
|
||||
'href': '../doc_alias/trait.Trait.html#associatedconstant.AssociatedConst',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// TraitFunctionItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Trait',
|
||||
'name': 'function',
|
||||
'alias': 'TraitFunctionItem',
|
||||
'href': '../doc_alias/trait.Trait.html#tymethod.function',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// FunctionItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'function',
|
||||
'alias': 'FunctionItem',
|
||||
'href': '../doc_alias/fn.function.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// ModuleItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Module',
|
||||
'alias': 'ModuleItem',
|
||||
'href': '../doc_alias/Module/index.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// ConstItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Const',
|
||||
'alias': 'ConstItem',
|
||||
'href': '../doc_alias/constant.Const.html',
|
||||
'is_alias': true
|
||||
},
|
||||
{
|
||||
'path': 'doc_alias::Struct',
|
||||
'name': 'ImplConstItem',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// StaticItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Static',
|
||||
'alias': 'StaticItem',
|
||||
'href': '../doc_alias/static.Static.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// UnionItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Union',
|
||||
'alias': 'UnionItem',
|
||||
'href': '../doc_alias/union.Union.html',
|
||||
'is_alias': true
|
||||
},
|
||||
// Not an alias!
|
||||
{
|
||||
'path': 'doc_alias::Union',
|
||||
'name': 'union_item',
|
||||
'href': '../doc_alias/union.Union.html#structfield.union_item'
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// UnionFieldItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Union',
|
||||
'name': 'union_item',
|
||||
'alias': 'UnionFieldItem',
|
||||
'href': '../doc_alias/union.Union.html#structfield.union_item',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// UnionMethodItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Union',
|
||||
'name': 'method',
|
||||
'alias': 'UnionMethodItem',
|
||||
'href': '../doc_alias/union.Union.html#method.method',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// MacroItem
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Macro',
|
||||
'alias': 'MacroItem',
|
||||
'href': '../doc_alias/macro.Macro.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
75
tests/rustdoc-js/doc-alias.rs
Normal file
75
tests/rustdoc-js/doc-alias.rs
Normal file
|
@ -0,0 +1,75 @@
|
|||
#[doc(alias = "StructItem")]
|
||||
pub struct Struct {
|
||||
#[doc(alias = "StructFieldItem")]
|
||||
pub field: u32,
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
#[doc(alias = "StructImplConstItem")]
|
||||
pub const ImplConstItem: i32 = 0;
|
||||
#[doc(alias = "StructMethodItem")]
|
||||
pub fn method(&self) {}
|
||||
}
|
||||
|
||||
impl Trait for Struct {
|
||||
type Target = u32;
|
||||
const AssociatedConst: i32 = 12;
|
||||
|
||||
#[doc(alias = "ImplTraitFunction")]
|
||||
fn function() -> Self::Target { 0 }
|
||||
}
|
||||
|
||||
#[doc(alias = "EnumItem")]
|
||||
pub enum Enum {
|
||||
#[doc(alias = "VariantItem")]
|
||||
Variant,
|
||||
}
|
||||
|
||||
impl Enum {
|
||||
#[doc(alias = "EnumMethodItem")]
|
||||
pub fn method(&self) {}
|
||||
}
|
||||
|
||||
#[doc(alias = "TypedefItem")]
|
||||
pub type Typedef = i32;
|
||||
|
||||
#[doc(alias = "TraitItem")]
|
||||
pub trait Trait {
|
||||
#[doc(alias = "TraitTypeItem")]
|
||||
type Target;
|
||||
#[doc(alias = "AssociatedConstItem")]
|
||||
const AssociatedConst: i32;
|
||||
|
||||
#[doc(alias = "TraitFunctionItem")]
|
||||
fn function() -> Self::Target;
|
||||
}
|
||||
|
||||
#[doc(alias = "FunctionItem")]
|
||||
pub fn function() {}
|
||||
|
||||
#[doc(alias = "ModuleItem")]
|
||||
pub mod Module {}
|
||||
|
||||
#[doc(alias = "ConstItem")]
|
||||
pub const Const: u32 = 0;
|
||||
|
||||
#[doc(alias = "StaticItem")]
|
||||
pub static Static: u32 = 0;
|
||||
|
||||
#[doc(alias = "UnionItem")]
|
||||
pub union Union {
|
||||
#[doc(alias = "UnionFieldItem")]
|
||||
pub union_item: u32,
|
||||
pub y: f32,
|
||||
}
|
||||
|
||||
impl Union {
|
||||
#[doc(alias = "UnionMethodItem")]
|
||||
pub fn method(&self) {}
|
||||
}
|
||||
|
||||
#[doc(alias = "MacroItem")]
|
||||
#[macro_export]
|
||||
macro_rules! Macro {
|
||||
() => {}
|
||||
}
|
9
tests/rustdoc-js/exact-match.js
Normal file
9
tests/rustdoc-js/exact-match.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
const QUERY = 'si::pc';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'exact_match::Si', 'name': 'pc' },
|
||||
{ 'path': 'exact_match::Psi', 'name': 'pc' },
|
||||
{ 'path': 'exact_match::Si', 'name': 'pa' },
|
||||
],
|
||||
};
|
68
tests/rustdoc-js/exact-match.rs
Normal file
68
tests/rustdoc-js/exact-match.rs
Normal file
|
@ -0,0 +1,68 @@
|
|||
macro_rules! imp {
|
||||
($name:ident) => {
|
||||
pub struct $name {
|
||||
pub op: usize,
|
||||
}
|
||||
impl $name {
|
||||
pub fn op() {}
|
||||
pub fn cmp() {}
|
||||
pub fn map() {}
|
||||
pub fn pop() {}
|
||||
pub fn ptr() {}
|
||||
pub fn rpo() {}
|
||||
pub fn drop() {}
|
||||
pub fn copy() {}
|
||||
pub fn zip() {}
|
||||
pub fn sup() {}
|
||||
pub fn pa() {}
|
||||
pub fn pb() {}
|
||||
pub fn pc() {}
|
||||
pub fn pd() {}
|
||||
pub fn pe() {}
|
||||
pub fn pf() {}
|
||||
pub fn pg() {}
|
||||
pub fn ph() {}
|
||||
pub fn pi() {}
|
||||
pub fn pj() {}
|
||||
pub fn pk() {}
|
||||
pub fn pl() {}
|
||||
pub fn pm() {}
|
||||
pub fn pn() {}
|
||||
pub fn po() {}
|
||||
}
|
||||
};
|
||||
($name:ident, $($names:ident),*) => {
|
||||
imp!($name);
|
||||
imp!($($names),*);
|
||||
};
|
||||
}
|
||||
macro_rules! en {
|
||||
($name:ident) => {
|
||||
pub enum $name {
|
||||
Ptr,
|
||||
Rp,
|
||||
Rpo,
|
||||
Pt,
|
||||
Drop,
|
||||
Dr,
|
||||
Dro,
|
||||
Sup,
|
||||
Op,
|
||||
Cmp,
|
||||
Map,
|
||||
Mp,
|
||||
}
|
||||
};
|
||||
($name:ident, $($names:ident),*) => {
|
||||
en!($name);
|
||||
en!($($names),*);
|
||||
};
|
||||
}
|
||||
|
||||
imp!(Ot, Foo, Cmp, Map, Loc, Lac, Toc, Si, Sig, Sip, Psy, Psi, Py, Pi, Pa, Pb, Pc, Pd);
|
||||
imp!(Pe, Pf, Pg, Ph, Pj, Pk, Pl, Pm, Pn, Po, Pq, Pr, Ps, Pt, Pu, Pv, Pw, Px, Pz, Ap, Bp, Cp);
|
||||
imp!(Dp, Ep, Fp, Gp, Hp, Ip, Jp, Kp, Lp, Mp, Np, Op, Pp, Qp, Rp, Sp, Tp, Up, Vp, Wp, Xp, Yp, Zp);
|
||||
|
||||
en!(Place, Plac, Plae, Plce, Pace, Scalar, Scalr, Scaar, Sclar, Salar);
|
||||
|
||||
pub struct P;
|
9
tests/rustdoc-js/foreign-type-path.js
Normal file
9
tests/rustdoc-js/foreign-type-path.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
const QUERY = 'MyForeignType::my_method';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
// Test case for https://github.com/rust-lang/rust/pull/96887#pullrequestreview-967154358
|
||||
// Validates that the parent path for a foreign type method is correct.
|
||||
{ 'path': 'foreign_type_path::aaaaaaa::MyForeignType', 'name': 'my_method' },
|
||||
],
|
||||
};
|
13
tests/rustdoc-js/foreign-type-path.rs
Normal file
13
tests/rustdoc-js/foreign-type-path.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
#![feature(extern_types)]
|
||||
|
||||
pub mod aaaaaaa {
|
||||
|
||||
extern {
|
||||
pub type MyForeignType;
|
||||
}
|
||||
|
||||
impl MyForeignType {
|
||||
pub fn my_method() {}
|
||||
}
|
||||
|
||||
}
|
57
tests/rustdoc-js/generics-impl.js
Normal file
57
tests/rustdoc-js/generics-impl.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = [
|
||||
'Aaaaaaa -> u32',
|
||||
'Aaaaaaa -> bool',
|
||||
'Aaaaaaa -> usize',
|
||||
'Read -> u64',
|
||||
'bool -> u64',
|
||||
'Ddddddd -> u64',
|
||||
'-> Ddddddd'
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
// Aaaaaaa -> u32
|
||||
'others': [
|
||||
{ 'path': 'generics_impl::Aaaaaaa', 'name': 'bbbbbbb' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Aaaaaaa -> bool
|
||||
'others': [
|
||||
{ 'path': 'generics_impl::Aaaaaaa', 'name': 'ccccccc' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Aaaaaaa -> usize
|
||||
'others': [
|
||||
{ 'path': 'generics_impl::Aaaaaaa', 'name': 'read' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Read -> u64
|
||||
'others': [
|
||||
{ 'path': 'generics_impl::Ddddddd', 'name': 'eeeeeee' },
|
||||
{ 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// bool -> u64
|
||||
'others': [
|
||||
{ 'path': 'generics_impl::Ddddddd', 'name': 'fffffff' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Ddddddd -> u64
|
||||
'others': [
|
||||
{ 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// -> Ddddddd
|
||||
'others': [
|
||||
{ 'path': 'generics_impl::Ddddddd', 'name': 'hhhhhhh' },
|
||||
],
|
||||
},
|
||||
];
|
35
tests/rustdoc-js/generics-impl.rs
Normal file
35
tests/rustdoc-js/generics-impl.rs
Normal file
|
@ -0,0 +1,35 @@
|
|||
use std::io::{Result as IoResult, Read};
|
||||
|
||||
pub struct Aaaaaaa;
|
||||
|
||||
impl Aaaaaaa {
|
||||
pub fn bbbbbbb(self) -> u32 {
|
||||
1
|
||||
}
|
||||
pub fn ccccccc(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl Read for Aaaaaaa {
|
||||
fn read(&mut self, out: &mut [u8]) -> IoResult<usize> {
|
||||
Ok(out.len())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Ddddddd<T>(T);
|
||||
|
||||
impl<T: Read> Ddddddd<T> {
|
||||
pub fn eeeeeee(_: T) -> u64 {
|
||||
1
|
||||
}
|
||||
pub fn fffffff(_: bool) -> u64 {
|
||||
1
|
||||
}
|
||||
pub fn ggggggg(self) -> u64 {
|
||||
1
|
||||
}
|
||||
pub fn hhhhhhh() -> Self where T: Default {
|
||||
Ddddddd(T::default())
|
||||
}
|
||||
}
|
32
tests/rustdoc-js/generics-multi-trait.js
Normal file
32
tests/rustdoc-js/generics-multi-trait.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = [
|
||||
'Result<SomeTrait>',
|
||||
'Zzzzzzzzzzzzzzzzzz',
|
||||
'Nonononononononono',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
// check one of the generic items
|
||||
{
|
||||
'in_args': [
|
||||
{ 'path': 'generics_multi_trait', 'name': 'beta' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'generics_multi_trait', 'name': 'bet' },
|
||||
],
|
||||
},
|
||||
{
|
||||
'in_args': [
|
||||
{ 'path': 'generics_multi_trait', 'name': 'beta' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'generics_multi_trait', 'name': 'bet' },
|
||||
],
|
||||
},
|
||||
// ignore the name of the generic itself
|
||||
{
|
||||
'in_args': [],
|
||||
'returned': [],
|
||||
},
|
||||
];
|
12
tests/rustdoc-js/generics-multi-trait.rs
Normal file
12
tests/rustdoc-js/generics-multi-trait.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
pub trait SomeTrait {}
|
||||
pub trait Zzzzzzzzzzzzzzzzzz {}
|
||||
|
||||
pub fn bet<Nonononononononono: SomeTrait + Zzzzzzzzzzzzzzzzzz>() -> Result<Nonononononononono, ()> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub fn beta<Nonononononononono: SomeTrait + Zzzzzzzzzzzzzzzzzz>(
|
||||
_param: Result<Nonononononononono, ()>,
|
||||
) {
|
||||
loop {}
|
||||
}
|
23
tests/rustdoc-js/generics-trait.js
Normal file
23
tests/rustdoc-js/generics-trait.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const QUERY = [
|
||||
'Result<SomeTrait>',
|
||||
'OtherThingxxxxxxxx',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
'in_args': [
|
||||
{ 'path': 'generics_trait', 'name': 'beta' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'generics_trait', 'name': 'bet' },
|
||||
],
|
||||
},
|
||||
{
|
||||
'in_args': [
|
||||
{ 'path': 'generics_trait', 'name': 'alpha' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'generics_trait', 'name': 'alef' },
|
||||
],
|
||||
},
|
||||
];
|
8
tests/rustdoc-js/generics-trait.rs
Normal file
8
tests/rustdoc-js/generics-trait.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
pub trait SomeTrait {}
|
||||
pub trait OtherThingxxxxxxxx {}
|
||||
|
||||
pub fn alef<T: OtherThingxxxxxxxx>() -> Result<T, ()> { loop {} }
|
||||
pub fn bet<T: SomeTrait>() -> Result<T, ()> { loop {} }
|
||||
|
||||
pub fn alpha<T: OtherThingxxxxxxxx>(_param: Result<T, ()>) { loop {} }
|
||||
pub fn beta<T: SomeTrait>(_param: Result<T, ()>) { loop {} }
|
73
tests/rustdoc-js/generics.js
Normal file
73
tests/rustdoc-js/generics.js
Normal file
|
@ -0,0 +1,73 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = [
|
||||
'R<P>',
|
||||
'"P"',
|
||||
'P',
|
||||
'ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>',
|
||||
'TraitCat',
|
||||
'TraitDog',
|
||||
'Result<String>',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
// R<P>
|
||||
'returned': [
|
||||
{ 'path': 'generics', 'name': 'alef' },
|
||||
],
|
||||
'in_args': [
|
||||
{ 'path': 'generics', 'name': 'alpha' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// "P"
|
||||
'others': [
|
||||
{ 'path': 'generics', 'name': 'P' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'generics', 'name': 'alef' },
|
||||
],
|
||||
'in_args': [
|
||||
{ 'path': 'generics', 'name': 'alpha' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// P
|
||||
'returned': [
|
||||
{ 'path': 'generics', 'name': 'alef' },
|
||||
],
|
||||
'in_args': [
|
||||
{ 'path': 'generics', 'name': 'alpha' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// "ExtraCreditStructMulti"<ExtraCreditInnerMulti, ExtraCreditInnerMulti>
|
||||
'in_args': [
|
||||
{ 'path': 'generics', 'name': 'extracreditlabhomework' },
|
||||
],
|
||||
'returned': [],
|
||||
},
|
||||
{
|
||||
// TraitCat
|
||||
'in_args': [
|
||||
{ 'path': 'generics', 'name': 'gamma' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// TraitDog
|
||||
'in_args': [
|
||||
{ 'path': 'generics', 'name': 'gamma' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Result<String>
|
||||
'others': [],
|
||||
'returned': [
|
||||
{ 'path': 'generics', 'name': 'super_soup' },
|
||||
],
|
||||
'in_args': [
|
||||
{ 'path': 'generics', 'name': 'super_soup' },
|
||||
],
|
||||
},
|
||||
];
|
28
tests/rustdoc-js/generics.rs
Normal file
28
tests/rustdoc-js/generics.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
pub struct P;
|
||||
pub struct Q;
|
||||
pub struct R<T>(T);
|
||||
|
||||
// returns test
|
||||
pub fn alef() -> R<P> { loop {} }
|
||||
pub fn bet() -> R<Q> { loop {} }
|
||||
|
||||
// in_args test
|
||||
pub fn alpha(_x: R<P>) { loop {} }
|
||||
pub fn beta(_x: R<Q>) { loop {} }
|
||||
|
||||
// test case with multiple appearances of the same type
|
||||
pub struct ExtraCreditStructMulti<T, U> { t: T, u: U }
|
||||
pub struct ExtraCreditInnerMulti {}
|
||||
pub fn extracreditlabhomework(
|
||||
_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>
|
||||
) { loop {} }
|
||||
pub fn redherringmatchforextracredit(
|
||||
_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ()>
|
||||
) { loop {} }
|
||||
|
||||
pub trait TraitCat {}
|
||||
pub trait TraitDog {}
|
||||
|
||||
pub fn gamma<T: TraitCat + TraitDog>(t: T) {}
|
||||
|
||||
pub fn super_soup(s: Result<String, i32>) -> Result<String, i32> { s }
|
51
tests/rustdoc-js/impl-trait.js
Normal file
51
tests/rustdoc-js/impl-trait.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = [
|
||||
'Aaaaaaa -> i32',
|
||||
'Aaaaaaa -> Aaaaaaa',
|
||||
'Aaaaaaa -> usize',
|
||||
'-> Aaaaaaa',
|
||||
'Aaaaaaa',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
// Aaaaaaa -> i32
|
||||
'others': [
|
||||
{ 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Aaaaaaa -> Aaaaaaa
|
||||
'others': [
|
||||
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Aaaaaaa -> usize
|
||||
'others': [],
|
||||
},
|
||||
{
|
||||
// -> Aaaaaaa
|
||||
'others': [
|
||||
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
|
||||
{ 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
|
||||
{ 'path': 'impl_trait', 'name': 'bbbbbbb' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Aaaaaaa
|
||||
'others': [
|
||||
{ 'path': 'impl_trait', 'name': 'Aaaaaaa' },
|
||||
],
|
||||
'in_args': [
|
||||
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
|
||||
{ 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
|
||||
{ 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
|
||||
{ 'path': 'impl_trait', 'name': 'bbbbbbb' },
|
||||
],
|
||||
},
|
||||
];
|
21
tests/rustdoc-js/impl-trait.rs
Normal file
21
tests/rustdoc-js/impl-trait.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
pub trait Aaaaaaa {}
|
||||
|
||||
impl Aaaaaaa for () {}
|
||||
|
||||
pub fn bbbbbbb() -> impl Aaaaaaa {
|
||||
()
|
||||
}
|
||||
|
||||
pub struct Ccccccc {}
|
||||
|
||||
impl Ccccccc {
|
||||
pub fn ddddddd(&self) -> impl Aaaaaaa {
|
||||
()
|
||||
}
|
||||
pub fn eeeeeee(&self, _x: impl Aaaaaaa) -> i32 {
|
||||
0
|
||||
}
|
||||
pub fn fffffff(&self, x: impl Aaaaaaa) -> impl Aaaaaaa {
|
||||
x
|
||||
}
|
||||
}
|
9
tests/rustdoc-js/module-substring.js
Normal file
9
tests/rustdoc-js/module-substring.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
const QUERY = 'ig::pc';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'module_substring::Sig', 'name': 'pc' },
|
||||
{ 'path': 'module_substring::Si', 'name': 'pc' },
|
||||
{ 'path': 'module_substring::Si', 'name': 'pa' },
|
||||
],
|
||||
};
|
68
tests/rustdoc-js/module-substring.rs
Normal file
68
tests/rustdoc-js/module-substring.rs
Normal file
|
@ -0,0 +1,68 @@
|
|||
macro_rules! imp {
|
||||
($name:ident) => {
|
||||
pub struct $name {
|
||||
pub op: usize,
|
||||
}
|
||||
impl $name {
|
||||
pub fn op() {}
|
||||
pub fn cmp() {}
|
||||
pub fn map() {}
|
||||
pub fn pop() {}
|
||||
pub fn ptr() {}
|
||||
pub fn rpo() {}
|
||||
pub fn drop() {}
|
||||
pub fn copy() {}
|
||||
pub fn zip() {}
|
||||
pub fn sup() {}
|
||||
pub fn pa() {}
|
||||
pub fn pb() {}
|
||||
pub fn pc() {}
|
||||
pub fn pd() {}
|
||||
pub fn pe() {}
|
||||
pub fn pf() {}
|
||||
pub fn pg() {}
|
||||
pub fn ph() {}
|
||||
pub fn pi() {}
|
||||
pub fn pj() {}
|
||||
pub fn pk() {}
|
||||
pub fn pl() {}
|
||||
pub fn pm() {}
|
||||
pub fn pn() {}
|
||||
pub fn po() {}
|
||||
}
|
||||
};
|
||||
($name:ident, $($names:ident),*) => {
|
||||
imp!($name);
|
||||
imp!($($names),*);
|
||||
};
|
||||
}
|
||||
macro_rules! en {
|
||||
($name:ident) => {
|
||||
pub enum $name {
|
||||
Ptr,
|
||||
Rp,
|
||||
Rpo,
|
||||
Pt,
|
||||
Drop,
|
||||
Dr,
|
||||
Dro,
|
||||
Sup,
|
||||
Op,
|
||||
Cmp,
|
||||
Map,
|
||||
Mp,
|
||||
}
|
||||
};
|
||||
($name:ident, $($names:ident),*) => {
|
||||
en!($name);
|
||||
en!($($names),*);
|
||||
};
|
||||
}
|
||||
|
||||
imp!(Ot, Foo, Cmp, Map, Loc, Lac, Toc, Si, Sig, Sip, Psy, Psi, Py, Pi, Pa, Pb, Pc, Pd);
|
||||
imp!(Pe, Pf, Pg, Ph, Pj, Pk, Pl, Pm, Pn, Po, Pq, Pr, Ps, Pt, Pu, Pv, Pw, Px, Pz, Ap, Bp, Cp);
|
||||
imp!(Dp, Ep, Fp, Gp, Hp, Ip, Jp, Kp, Lp, Mp, Np, Op, Pp, Qp, Rp, Sp, Tp, Up, Vp, Wp, Xp, Yp, Zp);
|
||||
|
||||
en!(Place, Plac, Plae, Plce, Pace, Scalar, Scalr, Scaar, Sclar, Salar);
|
||||
|
||||
pub struct P;
|
14
tests/rustdoc-js/path-ordering.js
Normal file
14
tests/rustdoc-js/path-ordering.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = 'b::ccccccc';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
// `ccccccc` is an exact match for all three of these.
|
||||
// However `b` is a closer match for `bb` than for any
|
||||
// of the others, so it ought to go first.
|
||||
{ 'path': 'path_ordering::bb', 'name': 'Ccccccc' },
|
||||
{ 'path': 'path_ordering::aa', 'name': 'Ccccccc' },
|
||||
{ 'path': 'path_ordering::dd', 'name': 'Ccccccc' },
|
||||
],
|
||||
};
|
9
tests/rustdoc-js/path-ordering.rs
Normal file
9
tests/rustdoc-js/path-ordering.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
pub mod dd {
|
||||
pub struct Ccccccc;
|
||||
}
|
||||
pub mod aa {
|
||||
pub struct Ccccccc;
|
||||
}
|
||||
pub mod bb {
|
||||
pub struct Ccccccc;
|
||||
}
|
25
tests/rustdoc-js/primitive.js
Normal file
25
tests/rustdoc-js/primitive.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = [
|
||||
"i32",
|
||||
"str",
|
||||
"TotoIsSomewhere",
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
'in_args': [
|
||||
{ 'path': 'primitive', 'name': 'foo' },
|
||||
],
|
||||
},
|
||||
{
|
||||
'returned': [
|
||||
{ 'path': 'primitive', 'name': 'foo' },
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [],
|
||||
'in_args': [],
|
||||
'returned': [],
|
||||
},
|
||||
];
|
5
tests/rustdoc-js/primitive.rs
Normal file
5
tests/rustdoc-js/primitive.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
pub fn foo(i: i32) -> &'static str {
|
||||
"hello"
|
||||
}
|
||||
|
||||
pub fn foo2<TotoIsSomewhere>(i: &TotoIsSomewhere, j: TotoIsSomewhere) {}
|
16
tests/rustdoc-js/prototype.js
vendored
Normal file
16
tests/rustdoc-js/prototype.js
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = ['constructor', '__proto__'];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
'others': [],
|
||||
'returned': [],
|
||||
'in_args': [],
|
||||
},
|
||||
{
|
||||
'others': [],
|
||||
'returned': [],
|
||||
'in_args': [],
|
||||
},
|
||||
];
|
4
tests/rustdoc-js/prototype.rs
Normal file
4
tests/rustdoc-js/prototype.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
// The alias needed to be there to reproduce the bug
|
||||
// that used to be here.
|
||||
#[doc(alias="other_alias")]
|
||||
pub fn something_else() {}
|
55
tests/rustdoc-js/raw-pointer.js
Normal file
55
tests/rustdoc-js/raw-pointer.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = [
|
||||
'Aaaaaaa -> i32',
|
||||
'Aaaaaaa -> Aaaaaaa',
|
||||
'Aaaaaaa -> usize',
|
||||
'-> Aaaaaaa',
|
||||
'Aaaaaaa',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
// Aaaaaaa -> i32
|
||||
'others': [
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'eeeeeee' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Aaaaaaa -> Aaaaaaa
|
||||
'others': [
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' },
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Aaaaaaa -> usize
|
||||
'others': [],
|
||||
},
|
||||
{
|
||||
// -> Aaaaaaa
|
||||
'others': [
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' },
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' },
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'ddddddd' },
|
||||
{ 'path': 'raw_pointer', 'name': 'bbbbbbb' },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Aaaaaaa
|
||||
'others': [
|
||||
{ 'path': 'raw_pointer', 'name': 'Aaaaaaa' },
|
||||
],
|
||||
'in_args': [
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' },
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' },
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'eeeeeee' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' },
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' },
|
||||
{ 'path': 'raw_pointer::Ccccccc', 'name': 'ddddddd' },
|
||||
{ 'path': 'raw_pointer', 'name': 'bbbbbbb' },
|
||||
],
|
||||
},
|
||||
];
|
24
tests/rustdoc-js/raw-pointer.rs
Normal file
24
tests/rustdoc-js/raw-pointer.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use std::ptr;
|
||||
|
||||
pub struct Aaaaaaa {}
|
||||
|
||||
pub fn bbbbbbb() -> *const Aaaaaaa {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
pub struct Ccccccc {}
|
||||
|
||||
impl Ccccccc {
|
||||
pub fn ddddddd(&self) -> *const Aaaaaaa {
|
||||
ptr::null()
|
||||
}
|
||||
pub fn eeeeeee(&self, _x: *const Aaaaaaa) -> i32 {
|
||||
0
|
||||
}
|
||||
pub fn fffffff(&self, x: *const Aaaaaaa) -> *const Aaaaaaa {
|
||||
x
|
||||
}
|
||||
pub fn ggggggg(&self, x: *mut Aaaaaaa) -> *mut Aaaaaaa {
|
||||
x
|
||||
}
|
||||
}
|
17
tests/rustdoc-js/reexport.js
Normal file
17
tests/rustdoc-js/reexport.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = ['Subscriber', 'AnotherOne'];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
'others': [
|
||||
{ 'path': 'reexport::fmt', 'name': 'Subscriber' },
|
||||
{ 'path': 'reexport', 'name': 'FmtSubscriber' },
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{ 'path': 'reexport', 'name': 'AnotherOne' },
|
||||
],
|
||||
},
|
||||
];
|
11
tests/rustdoc-js/reexport.rs
Normal file
11
tests/rustdoc-js/reexport.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// This test enforces that the (renamed) reexports are present in the search results.
|
||||
|
||||
pub mod fmt {
|
||||
pub struct Subscriber;
|
||||
}
|
||||
mod foo {
|
||||
pub struct AnotherOne;
|
||||
}
|
||||
|
||||
pub use foo::AnotherOne;
|
||||
pub use fmt::Subscriber as FmtSubscriber;
|
10
tests/rustdoc-js/search-short-types.js
Normal file
10
tests/rustdoc-js/search-short-types.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const QUERY = 'P';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'search_short_types', 'name': 'P' },
|
||||
{ 'path': 'search_short_types::VeryLongTypeName', 'name': 'p' },
|
||||
{ 'path': 'search_short_types', 'name': 'Ap' },
|
||||
{ 'path': 'search_short_types::VeryLongTypeName', 'name': 'ap' },
|
||||
],
|
||||
};
|
74
tests/rustdoc-js/search-short-types.rs
Normal file
74
tests/rustdoc-js/search-short-types.rs
Normal file
|
@ -0,0 +1,74 @@
|
|||
macro_rules! imp {
|
||||
($name:ident) => {
|
||||
pub struct $name {
|
||||
pub op: usize,
|
||||
}
|
||||
impl $name {
|
||||
pub fn op() {}
|
||||
pub fn cmp() {}
|
||||
pub fn map() {}
|
||||
pub fn pop() {}
|
||||
pub fn ptr() {}
|
||||
pub fn rpo() {}
|
||||
pub fn drop() {}
|
||||
pub fn copy() {}
|
||||
pub fn zip() {}
|
||||
pub fn sup() {}
|
||||
pub fn pa() {}
|
||||
pub fn pb() {}
|
||||
pub fn pc() {}
|
||||
pub fn pd() {}
|
||||
pub fn pe() {}
|
||||
pub fn pf() {}
|
||||
pub fn pg() {}
|
||||
pub fn ph() {}
|
||||
pub fn pi() {}
|
||||
pub fn pj() {}
|
||||
pub fn pk() {}
|
||||
pub fn pl() {}
|
||||
pub fn pm() {}
|
||||
pub fn pn() {}
|
||||
pub fn po() {}
|
||||
}
|
||||
};
|
||||
($name:ident, $($names:ident),*) => {
|
||||
imp!($name);
|
||||
imp!($($names),*);
|
||||
};
|
||||
}
|
||||
macro_rules! en {
|
||||
($name:ident) => {
|
||||
pub enum $name {
|
||||
Ptr,
|
||||
Rp,
|
||||
Rpo,
|
||||
Pt,
|
||||
Drop,
|
||||
Dr,
|
||||
Dro,
|
||||
Sup,
|
||||
Op,
|
||||
Cmp,
|
||||
Map,
|
||||
Mp,
|
||||
}
|
||||
};
|
||||
($name:ident, $($names:ident),*) => {
|
||||
en!($name);
|
||||
en!($($names),*);
|
||||
};
|
||||
}
|
||||
|
||||
imp!(Ot, Foo, Cmp, Map, Loc, Lac, Toc, Si, Sig, Sip, Psy, Psi, Py, Pi, Pa, Pb, Pc, Pd);
|
||||
imp!(Pe, Pf, Pg, Ph, Pj, Pk, Pl, Pm, Pn, Po, Pq, Pr, Ps, Pt, Pu, Pv, Pw, Px, Pz, Ap, Bp, Cp);
|
||||
imp!(Dp, Ep, Fp, Gp, Hp, Ip, Jp, Kp, Lp, Mp, Np, Op, Pp, Qp, Rp, Sp, Tp, Up, Vp, Wp, Xp, Yp, Zp);
|
||||
|
||||
en!(Place, Plac, Plae, Plce, Pace, Scalar, Scalr, Scaar, Sclar, Salar);
|
||||
|
||||
pub struct P;
|
||||
|
||||
pub struct VeryLongTypeName;
|
||||
impl VeryLongTypeName {
|
||||
pub fn p() {}
|
||||
pub fn ap() {}
|
||||
}
|
7
tests/rustdoc-js/struct-like-variant.js
Normal file
7
tests/rustdoc-js/struct-like-variant.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const QUERY = 'name';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'struct_like_variant::Enum::Bar', 'name': 'name', 'desc': 'This is a name.' },
|
||||
],
|
||||
};
|
8
tests/rustdoc-js/struct-like-variant.rs
Normal file
8
tests/rustdoc-js/struct-like-variant.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
#![crate_name = "struct_like_variant"]
|
||||
|
||||
pub enum Enum {
|
||||
Bar {
|
||||
/// This is a name.
|
||||
name: String
|
||||
}
|
||||
}
|
8
tests/rustdoc-js/substring.js
Normal file
8
tests/rustdoc-js/substring.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const QUERY = 'waker_from';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'substring::SuperWaker', 'name': 'local_waker_from_nonlocal' },
|
||||
{ 'path': 'substring::SuperWakerTask', 'name': 'local_waker_from_nonlocal' },
|
||||
],
|
||||
};
|
21
tests/rustdoc-js/substring.rs
Normal file
21
tests/rustdoc-js/substring.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
pub struct SuperWaker;
|
||||
|
||||
impl SuperWaker {
|
||||
pub fn local_waker_from_nonlocal() {}
|
||||
pub fn local_waker_frm_nonlocal() {}
|
||||
pub fn some_method() {}
|
||||
pub fn some_other_method() {}
|
||||
pub fn waker_non_local() {}
|
||||
pub fn from_non_local() {}
|
||||
}
|
||||
|
||||
pub struct SuperWakerTask;
|
||||
|
||||
impl SuperWakerTask {
|
||||
pub fn local_waker_from_nonlocal() {}
|
||||
pub fn local_waker_frm_nonlocal() {}
|
||||
pub fn some_method() {}
|
||||
pub fn some_other_method() {}
|
||||
pub fn waker_non_local() {}
|
||||
pub fn from_non_local() {}
|
||||
}
|
21
tests/rustdoc-js/summaries.js
Normal file
21
tests/rustdoc-js/summaries.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
const QUERY = ['summaries', 'summaries::Sidebar', 'summaries::Sidebar2'];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
'others': [
|
||||
{ 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link, [<code>code</code>], and <code>Sidebar2</code> intra-doc.' },
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{ 'path': 'summaries', 'name': 'Sidebar', 'desc': 'This <code>code</code> will be rendered in a code tag.' },
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{ 'path': 'summaries', 'name': 'Sidebar2', 'desc': '' },
|
||||
],
|
||||
},
|
||||
];
|
22
tests/rustdoc-js/summaries.rs
Normal file
22
tests/rustdoc-js/summaries.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
#![crate_type = "lib"]
|
||||
#![crate_name = "summaries"]
|
||||
|
||||
#![allow(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
//! This *summary* has a [link], [`code`], and [`Sidebar2`] intra-doc.
|
||||
//!
|
||||
//! This is the second paragraph. It should not be rendered.
|
||||
//! To test that intra-doc links are resolved properly, [`code`] should render
|
||||
//! the square brackets, and [`Sidebar2`] should not.
|
||||
//!
|
||||
//! [link]: https://example.com
|
||||
|
||||
/// This `code` will be rendered in a code tag.
|
||||
///
|
||||
/// This text should not be rendered.
|
||||
pub struct Sidebar;
|
||||
|
||||
/// ```text
|
||||
/// this block should not be rendered
|
||||
/// ```
|
||||
pub struct Sidebar2;
|
Loading…
Add table
Add a link
Reference in a new issue