rust/tests/rustdoc-js/generics-trait.js
Michael Howell 4c11822aeb rustdoc: restructure type search engine to pick-and-use IDs
This change makes it so, instead of mixing string distance with
type unification, function signature search works by
mapping names to IDs at the start, reporting to the user any
cases where it had to make corrections, and then matches with
IDs when going through the items.

This only changes function searches. Name searches are left alone,
and corrections are only done when there's a single item in the
search query.
2023-04-17 12:16:54 -07:00

51 lines
987 B
JavaScript

// exact-check
const QUERY = [
'Result<SomeTrait>',
'Result<SomeTraiz>',
'OtherThingxxxxxxxx',
'OtherThingxxxxxxxy',
];
const CORRECTIONS = [
null,
null,
null,
'OtherThingxxxxxxxx',
];
const EXPECTED = [
// Result<SomeTrait>
{
'in_args': [
{ 'path': 'generics_trait', 'name': 'beta' },
],
'returned': [
{ 'path': 'generics_trait', 'name': 'bet' },
],
},
// Result<SomeTraiz>
{
'in_args': [],
'returned': [],
},
// OtherThingxxxxxxxx
{
'in_args': [
{ 'path': 'generics_trait', 'name': 'alpha' },
],
'returned': [
{ 'path': 'generics_trait', 'name': 'alef' },
],
},
// OtherThingxxxxxxxy
{
'in_args': [
{ 'path': 'generics_trait', 'name': 'alpha' },
],
'returned': [
{ 'path': 'generics_trait', 'name': 'alef' },
],
},
];