2024-06-06 16:49:46 -05:00
|
|
|
const PARSED = [
|
|
|
|
{
|
|
|
|
query: '中文',
|
|
|
|
elems: [{
|
|
|
|
name: "中文",
|
|
|
|
fullPath: ["中文"],
|
|
|
|
pathWithoutLast: [],
|
|
|
|
pathLast: "中文",
|
|
|
|
generics: [],
|
|
|
|
typeFilter: -1,
|
|
|
|
}],
|
|
|
|
returned: [],
|
|
|
|
foundElems: 1,
|
|
|
|
userQuery: "中文",
|
|
|
|
error: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
query: '_0Mixed中英文',
|
|
|
|
elems: [{
|
2024-09-24 14:33:09 -05:00
|
|
|
name: "_0Mixed中英文",
|
2024-06-06 16:49:46 -05:00
|
|
|
fullPath: ["_0mixed中英文"],
|
|
|
|
pathWithoutLast: [],
|
|
|
|
pathLast: "_0mixed中英文",
|
2024-09-24 14:33:09 -05:00
|
|
|
normalizedPathLast: "0mixed中英文",
|
2024-06-06 16:49:46 -05:00
|
|
|
generics: [],
|
|
|
|
typeFilter: -1,
|
|
|
|
}],
|
|
|
|
foundElems: 1,
|
2024-09-24 14:33:09 -05:00
|
|
|
userQuery: "_0Mixed中英文",
|
2024-06-06 16:49:46 -05:00
|
|
|
returned: [],
|
|
|
|
error: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
query: 'my_crate::中文API',
|
|
|
|
elems: [{
|
2024-09-24 14:33:09 -05:00
|
|
|
name: "my_crate::中文API",
|
2024-06-06 16:49:46 -05:00
|
|
|
fullPath: ["my_crate", "中文api"],
|
|
|
|
pathWithoutLast: ["my_crate"],
|
|
|
|
pathLast: "中文api",
|
|
|
|
generics: [],
|
|
|
|
typeFilter: -1,
|
|
|
|
}],
|
|
|
|
foundElems: 1,
|
2024-09-24 14:33:09 -05:00
|
|
|
userQuery: "my_crate::中文API",
|
2024-06-06 16:49:46 -05:00
|
|
|
returned: [],
|
|
|
|
error: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
query: '类型A,类型B<约束C>->返回类型<关联类型=路径::约束D>',
|
|
|
|
elems: [{
|
2024-09-24 14:33:09 -05:00
|
|
|
name: "类型A",
|
2024-06-06 16:49:46 -05:00
|
|
|
fullPath: ["类型a"],
|
|
|
|
pathWithoutLast: [],
|
|
|
|
pathLast: "类型a",
|
|
|
|
generics: [],
|
|
|
|
}, {
|
2024-09-24 14:33:09 -05:00
|
|
|
name: "类型B",
|
2024-06-06 16:49:46 -05:00
|
|
|
fullPath: ["类型b"],
|
|
|
|
pathWithoutLast: [],
|
|
|
|
pathLast: "类型b",
|
|
|
|
generics: [{
|
2024-09-24 14:33:09 -05:00
|
|
|
name: "约束C",
|
2024-06-06 16:49:46 -05:00
|
|
|
fullPath: ["约束c"],
|
|
|
|
pathWithoutLast: [],
|
|
|
|
pathLast: "约束c",
|
|
|
|
generics: [],
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
foundElems: 3,
|
|
|
|
totalElems: 5,
|
|
|
|
literalSearch: true,
|
2024-09-24 14:33:09 -05:00
|
|
|
userQuery: "类型A,类型B<约束C>->返回类型<关联类型=路径::约束D>",
|
2024-06-06 16:49:46 -05:00
|
|
|
returned: [{
|
|
|
|
name: "返回类型",
|
|
|
|
fullPath: ["返回类型"],
|
|
|
|
pathWithoutLast: [],
|
|
|
|
pathLast: "返回类型",
|
|
|
|
generics: [],
|
2024-09-24 14:33:09 -05:00
|
|
|
bindings: [["关联类型", [{
|
|
|
|
name: "路径::约束D",
|
|
|
|
fullPath: ["路径", "约束d"],
|
|
|
|
pathWithoutLast: ["路径"],
|
|
|
|
pathLast: "约束d",
|
|
|
|
generics: [],
|
|
|
|
}]]],
|
2024-06-06 16:49:46 -05:00
|
|
|
}],
|
|
|
|
error: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
query: 'my_crate 中文宏!',
|
|
|
|
elems: [{
|
|
|
|
name: "my_crate 中文宏",
|
|
|
|
fullPath: ["my_crate", "中文宏"],
|
|
|
|
pathWithoutLast: ["my_crate"],
|
|
|
|
pathLast: "中文宏",
|
|
|
|
generics: [],
|
|
|
|
typeFilter: 16,
|
|
|
|
}],
|
|
|
|
foundElems: 1,
|
|
|
|
userQuery: "my_crate 中文宏!",
|
2024-09-24 14:33:09 -05:00
|
|
|
returned: [],
|
2024-06-06 16:49:46 -05:00
|
|
|
error: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
query: '非法符号——',
|
|
|
|
elems: [],
|
|
|
|
foundElems: 0,
|
|
|
|
userQuery: "非法符号——",
|
2024-09-24 14:33:09 -05:00
|
|
|
returned: [],
|
2024-06-06 22:42:17 -05:00
|
|
|
error: "Unexpected `—` after `号` (not a valid identifier)",
|
2024-06-06 16:49:46 -05:00
|
|
|
}
|
|
|
|
]
|
|
|
|
const EXPECTED = [
|
|
|
|
{
|
|
|
|
query: '加法',
|
|
|
|
others: [
|
|
|
|
{
|
|
|
|
name: "add",
|
|
|
|
path: "non_english_identifier",
|
|
|
|
is_alias: true,
|
|
|
|
alias: "加法",
|
|
|
|
href: "../non_english_identifier/macro.add.html"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "add",
|
|
|
|
path: "non_english_identifier",
|
|
|
|
is_alias: true,
|
|
|
|
alias: "加法",
|
|
|
|
href: "../non_english_identifier/fn.add.html"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "加法",
|
|
|
|
path: "non_english_identifier",
|
|
|
|
href: "../non_english_identifier/trait.加法.html",
|
|
|
|
desc: "Add"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "中文名称的加法宏",
|
|
|
|
path: "non_english_identifier",
|
|
|
|
href: "../non_english_identifier/macro.中文名称的加法宏.html",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "中文名称的加法API",
|
|
|
|
path: "non_english_identifier",
|
|
|
|
href: "../non_english_identifier/fn.中文名称的加法API.html",
|
|
|
|
}],
|
|
|
|
in_args: [{
|
|
|
|
name: "加上",
|
|
|
|
path: "non_english_identifier::加法",
|
|
|
|
href: "../non_english_identifier/trait.加法.html#tymethod.加上",
|
|
|
|
}],
|
|
|
|
returned: [],
|
|
|
|
},
|
|
|
|
{ // Extensive type-based search is still buggy, experimental & work-in-progress.
|
|
|
|
query: '可迭代->可选',
|
|
|
|
others: [{
|
|
|
|
name: "总计",
|
|
|
|
path: "non_english_identifier",
|
|
|
|
href: "../non_english_identifier/fn.总计.html",
|
|
|
|
desc: "“sum”"
|
|
|
|
}],
|
|
|
|
in_args: [],
|
|
|
|
returned: [],
|
|
|
|
},
|
2024-06-06 17:09:30 -05:00
|
|
|
];
|