mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
930cba8061
This way, most of the parsing code doesn't need to be designed to handle it, since they should always be treated exactly the same anyhow.
101 lines
2.3 KiB
JavaScript
101 lines
2.3 KiB
JavaScript
// 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 PARSED = [
|
|
{
|
|
query: 'a b',
|
|
elems: [
|
|
{
|
|
name: "a b",
|
|
fullPath: ["a", "b"],
|
|
pathWithoutLast: ["a"],
|
|
pathLast: "b",
|
|
generics: [],
|
|
},
|
|
],
|
|
foundElems: 1,
|
|
original: "a b",
|
|
returned: [],
|
|
userQuery: "a b",
|
|
error: null,
|
|
},
|
|
{
|
|
query: 'a b',
|
|
elems: [
|
|
{
|
|
name: "a b",
|
|
fullPath: ["a", "b"],
|
|
pathWithoutLast: ["a"],
|
|
pathLast: "b",
|
|
generics: [],
|
|
},
|
|
],
|
|
foundElems: 1,
|
|
original: "a b",
|
|
returned: [],
|
|
userQuery: "a b",
|
|
error: null,
|
|
},
|
|
{
|
|
query: 'a,b(c)',
|
|
elems: [],
|
|
foundElems: 0,
|
|
original: "a,b(c)",
|
|
returned: [],
|
|
userQuery: "a,b(c)",
|
|
error: "Unexpected `(`",
|
|
},
|
|
{
|
|
query: 'aaa,a',
|
|
elems: [
|
|
{
|
|
name: "aaa",
|
|
fullPath: ["aaa"],
|
|
pathWithoutLast: [],
|
|
pathLast: "aaa",
|
|
generics: [],
|
|
},
|
|
{
|
|
name: "a",
|
|
fullPath: ["a"],
|
|
pathWithoutLast: [],
|
|
pathLast: "a",
|
|
generics: [],
|
|
},
|
|
],
|
|
foundElems: 2,
|
|
original: "aaa,a",
|
|
returned: [],
|
|
userQuery: "aaa,a",
|
|
error: null,
|
|
},
|
|
{
|
|
query: ',,,,',
|
|
elems: [],
|
|
foundElems: 0,
|
|
original: ",,,,",
|
|
returned: [],
|
|
userQuery: ",,,,",
|
|
error: null,
|
|
},
|
|
{
|
|
query: 'mod :',
|
|
elems: [],
|
|
foundElems: 0,
|
|
original: 'mod :',
|
|
returned: [],
|
|
userQuery: 'mod :',
|
|
error: "Unexpected `:` (expected path after type filter `mod:`)",
|
|
},
|
|
{
|
|
query: 'mod\t:',
|
|
elems: [],
|
|
foundElems: 0,
|
|
original: 'mod :',
|
|
returned: [],
|
|
userQuery: 'mod :',
|
|
error: "Unexpected `:` (expected path after type filter `mod:`)",
|
|
},
|
|
];
|