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-std/alias-1.js
Normal file
7
tests/rustdoc-js-std/alias-1.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const QUERY = '&';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'reference' },
|
||||
],
|
||||
};
|
10
tests/rustdoc-js-std/alias-2.js
Normal file
10
tests/rustdoc-js-std/alias-2.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const QUERY = '+';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::ops', 'name': 'AddAssign' },
|
||||
{ 'path': 'std::ops', 'name': 'Add' },
|
||||
{ 'path': 'core::ops', 'name': 'AddAssign' },
|
||||
{ 'path': 'core::ops', 'name': 'Add' },
|
||||
],
|
||||
};
|
7
tests/rustdoc-js-std/alias-3.js
Normal file
7
tests/rustdoc-js-std/alias-3.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const QUERY = '!';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'never' },
|
||||
],
|
||||
};
|
7
tests/rustdoc-js-std/alias-4.js
Normal file
7
tests/rustdoc-js-std/alias-4.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const QUERY = '<';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'name': 'Ord' },
|
||||
],
|
||||
};
|
11
tests/rustdoc-js-std/alias.js
Normal file
11
tests/rustdoc-js-std/alias.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = '[';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'slice' },
|
||||
{ 'path': 'std::ops', 'name': 'IndexMut' },
|
||||
{ 'path': 'std::ops', 'name': 'Index' },
|
||||
],
|
||||
};
|
14
tests/rustdoc-js-std/asrawfd.js
Normal file
14
tests/rustdoc-js-std/asrawfd.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = 'RawFd::as_raw_fd';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
// Reproduction test for https://github.com/rust-lang/rust/issues/78724
|
||||
// Validate that type alias methods get the correct path.
|
||||
{ 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
|
||||
{ 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
|
||||
{ 'path': 'std::os::linux::process::PidFd', 'name': 'as_raw_fd' },
|
||||
{ 'path': 'std::os::fd::RawFd', 'name': 'as_raw_fd' },
|
||||
],
|
||||
};
|
15
tests/rustdoc-js-std/basic.js
Normal file
15
tests/rustdoc-js-std/basic.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
const QUERY = 'String';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::string', 'name': 'String' },
|
||||
{ 'path': 'std::ffi', 'name': 'CString' },
|
||||
{ 'path': 'std::ffi', 'name': 'OsString' },
|
||||
],
|
||||
'in_args': [
|
||||
{ 'path': 'std::str', 'name': 'eq' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'std::string::String', 'name': 'add' },
|
||||
],
|
||||
};
|
11
tests/rustdoc-js-std/deduplication.js
Normal file
11
tests/rustdoc-js-std/deduplication.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = 'is_nan';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::f32', 'name': 'is_nan' },
|
||||
{ 'path': 'std::f64', 'name': 'is_nan' },
|
||||
{ 'path': 'std::option::Option', 'name': 'is_none' },
|
||||
],
|
||||
};
|
7
tests/rustdoc-js-std/enum-option.js
Normal file
7
tests/rustdoc-js-std/enum-option.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const QUERY = 'enum:Option';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::option', 'name': 'Option' },
|
||||
],
|
||||
};
|
9
tests/rustdoc-js-std/filter-crate.js
Normal file
9
tests/rustdoc-js-std/filter-crate.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = '"hashmap"';
|
||||
const FILTER_CRATE = 'core';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
],
|
||||
};
|
8
tests/rustdoc-js-std/fn-forget.js
Normal file
8
tests/rustdoc-js-std/fn-forget.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const QUERY = 'fn:forget';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::mem', 'name': 'forget' },
|
||||
{ 'path': 'std::fmt', 'name': 'format' },
|
||||
],
|
||||
};
|
9
tests/rustdoc-js-std/from_u.js
Normal file
9
tests/rustdoc-js-std/from_u.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
const QUERY = 'from_u';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::char', 'name': 'from_u32' },
|
||||
{ 'path': 'std::str', 'name': 'from_utf8' },
|
||||
{ 'path': 'std::string::String', 'name': 'from_utf8' },
|
||||
],
|
||||
};
|
10
tests/rustdoc-js-std/keyword.js
Normal file
10
tests/rustdoc-js-std/keyword.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = 'fn';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'fn', ty: 15 }, // 15 is for primitive types
|
||||
{ 'path': 'std', 'name': 'fn', ty: 21 }, // 21 is for keywords
|
||||
],
|
||||
};
|
10
tests/rustdoc-js-std/macro-check.js
Normal file
10
tests/rustdoc-js-std/macro-check.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = 'panic';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'panic', ty: 14 }, // 15 is for macros
|
||||
{ 'path': 'std', 'name': 'panic', ty: 0 }, // 0 is for modules
|
||||
],
|
||||
};
|
10
tests/rustdoc-js-std/macro-print.js
Normal file
10
tests/rustdoc-js-std/macro-print.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const QUERY = 'macro:print';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'print' },
|
||||
{ 'path': 'std', 'name': 'eprint' },
|
||||
{ 'path': 'std', 'name': 'println' },
|
||||
{ 'path': 'std', 'name': 'eprintln' },
|
||||
],
|
||||
};
|
7
tests/rustdoc-js-std/never.js
Normal file
7
tests/rustdoc-js-std/never.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const QUERY = '!';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'never' },
|
||||
],
|
||||
};
|
385
tests/rustdoc-js-std/parser-errors.js
Normal file
385
tests/rustdoc-js-std/parser-errors.js
Normal file
|
@ -0,0 +1,385 @@
|
|||
const QUERY = [
|
||||
'<P>',
|
||||
'-> <P>',
|
||||
'a<"P">',
|
||||
'"P" "P"',
|
||||
'P "P"',
|
||||
'"p" p',
|
||||
'"const": p',
|
||||
"a<:a>",
|
||||
"a<::a>",
|
||||
"((a))",
|
||||
"(p -> p",
|
||||
"::a::b",
|
||||
"a::::b",
|
||||
"a::b::",
|
||||
":a",
|
||||
"a b:",
|
||||
"a (b:",
|
||||
"_:",
|
||||
"a-bb",
|
||||
"a>bb",
|
||||
"ab'",
|
||||
"a->",
|
||||
'"p" <a>',
|
||||
'"p" a<a>',
|
||||
"a,<",
|
||||
"aaaaa<>b",
|
||||
"fn:aaaaa<>b",
|
||||
"->a<>b",
|
||||
"a<->",
|
||||
"a:: a",
|
||||
"a ::a",
|
||||
"a<a>:",
|
||||
"a<>:",
|
||||
"a,:",
|
||||
" a<> :",
|
||||
"mod : :",
|
||||
"a!a",
|
||||
"a!!",
|
||||
];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "<P>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "<p>",
|
||||
error: "Found generics without a path",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "-> <P>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "-> <p>",
|
||||
error: "Found generics without a path",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a<\"P\">",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<\"p\">",
|
||||
error: "`\"` cannot be used in generics",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "\"P\" \"P\"",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "\"p\" \"p\"",
|
||||
error: "Cannot have more than one literal search element",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "P \"P\"",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "p \"p\"",
|
||||
error: "Cannot use literal search when there is more than one element",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "\"p\" p",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "\"p\" p",
|
||||
error: "You cannot have more than one element if you use quotes",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "\"const\": p",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "\"const\": p",
|
||||
error: "You cannot use quotes on type filter",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a<:a>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<:a>",
|
||||
error: "Unexpected `:` after `<`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a<::a>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<::a>",
|
||||
error: "Unexpected `::`: paths cannot start with `::`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "((a))",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "((a))",
|
||||
error: "Unexpected `(`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "(p -> p",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "(p -> p",
|
||||
error: "Unexpected `(`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "::a::b",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "::a::b",
|
||||
error: "Paths cannot start with `::`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a::::b",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a::::b",
|
||||
error: "Unexpected `::::`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a::b::",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a::b::",
|
||||
error: "Paths cannot end with `::`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: ":a",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: ":a",
|
||||
error: "Expected type filter before `:`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a b:",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a b:",
|
||||
error: "Unexpected `:`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a (b:",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a (b:",
|
||||
error: "Unexpected `(`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "_:",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "_:",
|
||||
error: "Unknown type filter `_`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a-bb",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a-bb",
|
||||
error: "Unexpected `-` (did you mean `->`?)",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a>bb",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a>bb",
|
||||
error: "Unexpected `>` (did you mean `->`?)",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "ab'",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "ab'",
|
||||
error: "Unexpected `'`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a->",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a->",
|
||||
error: "Expected at least one item after `->`",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '"p" <a>',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '"p" <a>',
|
||||
error: "Found generics without a path",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '"p" a<a>',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '"p" a<a>',
|
||||
error: "You cannot have more than one element if you use quotes",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'a,<',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'a,<',
|
||||
error: 'Found generics without a path',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'aaaaa<>b',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'aaaaa<>b',
|
||||
error: 'Expected `,`, ` `, `:` or `->`, found `b`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'fn:aaaaa<>b',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'fn:aaaaa<>b',
|
||||
error: 'Expected `,`, ` ` or `->`, found `b`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '->a<>b',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '->a<>b',
|
||||
error: 'Expected `,` or ` `, found `b`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'a<->',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'a<->',
|
||||
error: 'Unexpected `-` after `<`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'a:: a',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'a:: a',
|
||||
error: 'Paths cannot end with `::`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'a ::a',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'a ::a',
|
||||
error: 'Paths cannot start with `::`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a<a>:",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<a>:",
|
||||
error: 'Unexpected `:`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a<>:",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<>:",
|
||||
error: 'Unexpected `<` in type filter',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a,:",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a,:",
|
||||
error: 'Unexpected `,` in type filter',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a<> :",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<> :",
|
||||
error: 'Unexpected `<` in type filter',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "mod : :",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "mod : :",
|
||||
error: 'Unexpected `:`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a!a",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a!a",
|
||||
error: '`!` can only be at the end of an ident',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a!!",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a!!",
|
||||
error: 'Cannot have more than one `!` in an ident',
|
||||
},
|
||||
];
|
43
tests/rustdoc-js-std/parser-filter.js
Normal file
43
tests/rustdoc-js-std/parser-filter.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
const QUERY = ['fn:foo', 'enum : foo', 'macro<f>:foo'];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [{
|
||||
name: "foo",
|
||||
fullPath: ["foo"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "foo",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "fn:foo",
|
||||
returned: [],
|
||||
typeFilter: 5,
|
||||
userQuery: "fn:foo",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [{
|
||||
name: "foo",
|
||||
fullPath: ["foo"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "foo",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "enum : foo",
|
||||
returned: [],
|
||||
typeFilter: 4,
|
||||
userQuery: "enum : foo",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "macro<f>:foo",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "macro<f>:foo",
|
||||
error: "Unexpected `:`",
|
||||
},
|
||||
];
|
62
tests/rustdoc-js-std/parser-generics.js
Normal file
62
tests/rustdoc-js-std/parser-generics.js
Normal file
|
@ -0,0 +1,62 @@
|
|||
const QUERY = ['A<B<C<D>, E>', 'p<> u8', '"p"<a>'];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'A<B<C<D>, E>',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'a<b<c<d>, e>',
|
||||
error: 'Unexpected `<` after `<`',
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: "p",
|
||||
fullPath: ["p"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "p",
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: "u8",
|
||||
fullPath: ["u8"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "u8",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "p<> u8",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "p<> u8",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: "p",
|
||||
fullPath: ["p"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "p",
|
||||
generics: [
|
||||
{
|
||||
name: "a",
|
||||
fullPath: ["a"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "a",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: '"p"<a>',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '"p"<a>',
|
||||
error: null,
|
||||
},
|
||||
];
|
93
tests/rustdoc-js-std/parser-ident.js
Normal file
93
tests/rustdoc-js-std/parser-ident.js
Normal file
|
@ -0,0 +1,93 @@
|
|||
const QUERY = [
|
||||
"R<!>",
|
||||
"!",
|
||||
"a!",
|
||||
"a!::b",
|
||||
"a!::b!",
|
||||
];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [{
|
||||
name: "r",
|
||||
fullPath: ["r"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "r",
|
||||
generics: [
|
||||
{
|
||||
name: "!",
|
||||
fullPath: ["!"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "!",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "R<!>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "r<!>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [{
|
||||
name: "!",
|
||||
fullPath: ["!"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "!",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "!",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "!",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [{
|
||||
name: "a!",
|
||||
fullPath: ["a!"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "a!",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "a!",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a!",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [{
|
||||
name: "a!::b",
|
||||
fullPath: ["a!", "b"],
|
||||
pathWithoutLast: ["a!"],
|
||||
pathLast: "b",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "a!::b",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a!::b",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [{
|
||||
name: "a!::b!",
|
||||
fullPath: ["a!", "b!"],
|
||||
pathWithoutLast: ["a!"],
|
||||
pathLast: "b!",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "a!::b!",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a!::b!",
|
||||
error: null,
|
||||
},
|
||||
];
|
27
tests/rustdoc-js-std/parser-literal.js
Normal file
27
tests/rustdoc-js-std/parser-literal.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const QUERY = ['R<P>'];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [{
|
||||
name: "r",
|
||||
fullPath: ["r"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "r",
|
||||
generics: [
|
||||
{
|
||||
name: "p",
|
||||
fullPath: ["p"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "p",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "R<P>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "r<p>",
|
||||
error: null,
|
||||
}
|
||||
];
|
90
tests/rustdoc-js-std/parser-paths.js
Normal file
90
tests/rustdoc-js-std/parser-paths.js
Normal file
|
@ -0,0 +1,90 @@
|
|||
const QUERY = ['A::B', 'A::B,C', 'A::B<f>,C', 'mod::a'];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [{
|
||||
name: "a::b",
|
||||
fullPath: ["a", "b"],
|
||||
pathWithoutLast: ["a"],
|
||||
pathLast: "b",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "A::B",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a::b",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: "a::b",
|
||||
fullPath: ["a", "b"],
|
||||
pathWithoutLast: ["a"],
|
||||
pathLast: "b",
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: "c",
|
||||
fullPath: ["c"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "c",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: 'A::B,C',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'a::b,c',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: "a::b",
|
||||
fullPath: ["a", "b"],
|
||||
pathWithoutLast: ["a"],
|
||||
pathLast: "b",
|
||||
generics: [
|
||||
{
|
||||
name: "f",
|
||||
fullPath: ["f"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "f",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "c",
|
||||
fullPath: ["c"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "c",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: 'A::B<f>,C',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: 'a::b<f>,c',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [{
|
||||
name: "mod::a",
|
||||
fullPath: ["mod", "a"],
|
||||
pathWithoutLast: ["mod"],
|
||||
pathLast: "a",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: "mod::a",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "mod::a",
|
||||
error: null,
|
||||
},
|
||||
];
|
87
tests/rustdoc-js-std/parser-quote.js
Normal file
87
tests/rustdoc-js-std/parser-quote.js
Normal file
|
@ -0,0 +1,87 @@
|
|||
const QUERY = [
|
||||
'-> "p"',
|
||||
'"p",',
|
||||
'"p" -> a',
|
||||
'"a" -> "p"',
|
||||
'->"-"',
|
||||
'"a',
|
||||
'""',
|
||||
];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 1,
|
||||
original: '-> "p"',
|
||||
returned: [{
|
||||
name: "p",
|
||||
fullPath: ["p"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "p",
|
||||
generics: [],
|
||||
}],
|
||||
typeFilter: -1,
|
||||
userQuery: '-> "p"',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [{
|
||||
name: "p",
|
||||
fullPath: ["p"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "p",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 1,
|
||||
original: '"p",',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '"p",',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '"p" -> a',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '"p" -> a',
|
||||
error: "You cannot have more than one element if you use quotes",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '"a" -> "p"',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '"a" -> "p"',
|
||||
error: "Cannot have more than one literal search element",
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '->"-"',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '->"-"',
|
||||
error: 'Unexpected `-` in a string element',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '"a',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '"a',
|
||||
error: 'Unclosed `"`',
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: '""',
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: '""',
|
||||
error: 'Cannot have empty string element',
|
||||
},
|
||||
];
|
99
tests/rustdoc-js-std/parser-returned.js
Normal file
99
tests/rustdoc-js-std/parser-returned.js
Normal file
|
@ -0,0 +1,99 @@
|
|||
const QUERY = [
|
||||
"-> F<P>",
|
||||
"-> P",
|
||||
"->,a",
|
||||
"aaaaa->a",
|
||||
"-> !",
|
||||
];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 1,
|
||||
original: "-> F<P>",
|
||||
returned: [{
|
||||
name: "f",
|
||||
fullPath: ["f"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "f",
|
||||
generics: [
|
||||
{
|
||||
name: "p",
|
||||
fullPath: ["p"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "p",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
}],
|
||||
typeFilter: -1,
|
||||
userQuery: "-> f<p>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 1,
|
||||
original: "-> P",
|
||||
returned: [{
|
||||
name: "p",
|
||||
fullPath: ["p"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "p",
|
||||
generics: [],
|
||||
}],
|
||||
typeFilter: -1,
|
||||
userQuery: "-> p",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 1,
|
||||
original: "->,a",
|
||||
returned: [{
|
||||
name: "a",
|
||||
fullPath: ["a"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "a",
|
||||
generics: [],
|
||||
}],
|
||||
typeFilter: -1,
|
||||
userQuery: "->,a",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [{
|
||||
name: "aaaaa",
|
||||
fullPath: ["aaaaa"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "aaaaa",
|
||||
generics: [],
|
||||
}],
|
||||
foundElems: 2,
|
||||
original: "aaaaa->a",
|
||||
returned: [{
|
||||
name: "a",
|
||||
fullPath: ["a"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "a",
|
||||
generics: [],
|
||||
}],
|
||||
typeFilter: -1,
|
||||
userQuery: "aaaaa->a",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 1,
|
||||
original: "-> !",
|
||||
returned: [{
|
||||
name: "!",
|
||||
fullPath: ["!"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "!",
|
||||
generics: [],
|
||||
}],
|
||||
typeFilter: -1,
|
||||
userQuery: "-> !",
|
||||
error: null,
|
||||
},
|
||||
];
|
206
tests/rustdoc-js-std/parser-separators.js
Normal file
206
tests/rustdoc-js-std/parser-separators.js
Normal file
|
@ -0,0 +1,206 @@
|
|||
// ignore-tidy-tab
|
||||
|
||||
const QUERY = [
|
||||
'aaaaaa b',
|
||||
'a b',
|
||||
'a,b',
|
||||
'a\tb',
|
||||
'a<b c>',
|
||||
'a<b,c>',
|
||||
'a<b\tc>',
|
||||
];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: 'aaaaaa',
|
||||
fullPath: ['aaaaaa'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'aaaaaa',
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: 'b',
|
||||
fullPath: ['b'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'b',
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "aaaaaa b",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "aaaaaa b",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: 'a',
|
||||
fullPath: ['a'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'a',
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: 'b',
|
||||
fullPath: ['b'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'b',
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "a b",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a b",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: 'a',
|
||||
fullPath: ['a'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'a',
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: 'b',
|
||||
fullPath: ['b'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'b',
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "a,b",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a,b",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: 'a',
|
||||
fullPath: ['a'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'a',
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: 'b',
|
||||
fullPath: ['b'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'b',
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "a\tb",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a\tb",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: 'a',
|
||||
fullPath: ['a'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'a',
|
||||
generics: [
|
||||
{
|
||||
name: 'b',
|
||||
fullPath: ['b'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'b',
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: 'c',
|
||||
fullPath: ['c'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'c',
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "a<b c>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<b c>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: 'a',
|
||||
fullPath: ['a'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'a',
|
||||
generics: [
|
||||
{
|
||||
name: 'b',
|
||||
fullPath: ['b'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'b',
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: 'c',
|
||||
fullPath: ['c'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'c',
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "a<b,c>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<b,c>",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: 'a',
|
||||
fullPath: ['a'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'a',
|
||||
generics: [
|
||||
{
|
||||
name: 'b',
|
||||
fullPath: ['b'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'b',
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: 'c',
|
||||
fullPath: ['c'],
|
||||
pathWithoutLast: [],
|
||||
pathLast: 'c',
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
foundElems: 1,
|
||||
original: "a<b\tc>",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a<b\tc>",
|
||||
error: null,
|
||||
},
|
||||
];
|
123
tests/rustdoc-js-std/parser-weird-queries.js
Normal file
123
tests/rustdoc-js-std/parser-weird-queries.js
Normal file
|
@ -0,0 +1,123 @@
|
|||
// This test is mostly to check that the parser still kinda outputs something
|
||||
// (and doesn't enter an infinite loop!) even though the query is completely
|
||||
// invalid.
|
||||
const QUERY = [
|
||||
'a b',
|
||||
'a b',
|
||||
'a,b(c)',
|
||||
'aaa,a',
|
||||
',,,,',
|
||||
'mod :',
|
||||
'mod\t:',
|
||||
];
|
||||
|
||||
const PARSED = [
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: "a",
|
||||
fullPath: ["a"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "a",
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: "b",
|
||||
fullPath: ["b"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "b",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "a b",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a b",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: "a",
|
||||
fullPath: ["a"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "a",
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: "b",
|
||||
fullPath: ["b"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "b",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "a b",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a b",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: "a,b(c)",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "a,b(c)",
|
||||
error: "Unexpected `(`",
|
||||
},
|
||||
{
|
||||
elems: [
|
||||
{
|
||||
name: "aaa",
|
||||
fullPath: ["aaa"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "aaa",
|
||||
generics: [],
|
||||
},
|
||||
{
|
||||
name: "a",
|
||||
fullPath: ["a"],
|
||||
pathWithoutLast: [],
|
||||
pathLast: "a",
|
||||
generics: [],
|
||||
},
|
||||
],
|
||||
foundElems: 2,
|
||||
original: "aaa,a",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: "aaa,a",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: ",,,,",
|
||||
returned: [],
|
||||
typeFilter: -1,
|
||||
userQuery: ",,,,",
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'mod :',
|
||||
returned: [],
|
||||
typeFilter: 0,
|
||||
userQuery: 'mod :',
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
elems: [],
|
||||
foundElems: 0,
|
||||
original: 'mod\t:',
|
||||
returned: [],
|
||||
typeFilter: 0,
|
||||
userQuery: 'mod\t:',
|
||||
error: null,
|
||||
},
|
||||
];
|
12
tests/rustdoc-js-std/path-ordering.js
Normal file
12
tests/rustdoc-js-std/path-ordering.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
const QUERY = 'hashset::insert';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
// ensure hashset::insert comes first
|
||||
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
|
||||
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
|
||||
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
|
||||
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
|
||||
{ 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' },
|
||||
],
|
||||
};
|
75
tests/rustdoc-js-std/primitive.js
Normal file
75
tests/rustdoc-js-std/primitive.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
const QUERY = [
|
||||
'i8',
|
||||
'u32',
|
||||
'str',
|
||||
'char',
|
||||
'unit',
|
||||
'tuple',
|
||||
'fn',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'std',
|
||||
'name': 'i8',
|
||||
'href': '../std/primitive.i8.html',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'std',
|
||||
'name': 'u32',
|
||||
'href': '../std/primitive.u32.html',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'std',
|
||||
'name': 'str',
|
||||
'href': '../std/primitive.str.html',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'std',
|
||||
'name': 'char',
|
||||
'href': '../std/primitive.char.html',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'std',
|
||||
'name': 'unit',
|
||||
'href': '../std/primitive.unit.html',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'std',
|
||||
'name': 'tuple',
|
||||
'href': '../std/primitive.tuple.html',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'std',
|
||||
'name': 'fn',
|
||||
'href': '../std/primitive.fn.html',
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
21
tests/rustdoc-js-std/quoted.js
Normal file
21
tests/rustdoc-js-std/quoted.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = '"error"';
|
||||
const FILTER_CRATE = 'std';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'error' },
|
||||
{ 'path': 'std::fmt', 'name': 'Error' },
|
||||
{ 'path': 'std::io', 'name': 'Error' },
|
||||
],
|
||||
'in_args': [
|
||||
{ 'path': 'std::fmt::Error', 'name': 'eq' },
|
||||
{ 'path': 'std::fmt::Error', 'name': 'cmp' },
|
||||
{ 'path': 'std::fmt::Error', 'name': 'partial_cmp' },
|
||||
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'std::fmt::LowerExp', 'name': 'fmt' },
|
||||
],
|
||||
};
|
10
tests/rustdoc-js-std/return-specific-literal.js
Normal file
10
tests/rustdoc-js-std/return-specific-literal.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const QUERY = 'struct:"string"';
|
||||
|
||||
const EXPECTED = {
|
||||
'in_args': [
|
||||
{ 'path': 'std::string::String', 'name': 'ne' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'std::string::String', 'name': 'add' },
|
||||
],
|
||||
};
|
10
tests/rustdoc-js-std/return-specific.js
Normal file
10
tests/rustdoc-js-std/return-specific.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const QUERY = 'struct:string';
|
||||
|
||||
const EXPECTED = {
|
||||
'in_args': [
|
||||
{ 'path': 'std::string::String', 'name': 'ne' },
|
||||
],
|
||||
'returned': [
|
||||
{ 'path': 'std::string::String', 'name': 'add' },
|
||||
],
|
||||
};
|
9
tests/rustdoc-js-std/should-fail.js
Normal file
9
tests/rustdoc-js-std/should-fail.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
// should-fail
|
||||
|
||||
const QUERY = 'fn';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'fn', ty: 14 },
|
||||
],
|
||||
};
|
11
tests/rustdoc-js-std/string-from_ut.js
Normal file
11
tests/rustdoc-js-std/string-from_ut.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const QUERY = 'String::from_ut';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::string::String', 'name': 'from_utf8' },
|
||||
{ 'path': 'std::string::String', 'name': 'from_utf8' },
|
||||
{ 'path': 'std::string::String', 'name': 'from_utf8_lossy' },
|
||||
{ 'path': 'std::string::String', 'name': 'from_utf16_lossy' },
|
||||
{ 'path': 'std::string::String', 'name': 'from_utf8_unchecked' },
|
||||
],
|
||||
};
|
8
tests/rustdoc-js-std/struct-vec.js
Normal file
8
tests/rustdoc-js-std/struct-vec.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
const QUERY = 'struct:VecD';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::collections', 'name': 'VecDeque' },
|
||||
{ 'path': 'std::vec', 'name': 'Vec' },
|
||||
],
|
||||
};
|
17
tests/rustdoc-js-std/typed-query.js
Normal file
17
tests/rustdoc-js-std/typed-query.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = 'macro:print';
|
||||
const FILTER_CRATE = 'std';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'print' },
|
||||
{ 'path': 'std', 'name': 'eprint' },
|
||||
{ 'path': 'std', 'name': 'println' },
|
||||
{ 'path': 'std', 'name': 'eprintln' },
|
||||
{ 'path': 'std::pin', 'name': 'pin' },
|
||||
{ 'path': 'std::future', 'name': 'join' },
|
||||
{ 'path': 'std', 'name': 'line' },
|
||||
{ 'path': 'std', 'name': 'write' },
|
||||
],
|
||||
};
|
9
tests/rustdoc-js-std/vec-new.js
Normal file
9
tests/rustdoc-js-std/vec-new.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
const QUERY = 'Vec::new';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::vec::Vec', 'name': 'new' },
|
||||
{ 'path': 'std::vec::Vec', 'name': 'ne' },
|
||||
{ 'path': 'alloc::vec::Vec', 'name': 'ne' },
|
||||
],
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue