diff options
| author | bors <bors@rust-lang.org> | 2023-07-02 18:49:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-02 18:49:29 +0000 |
| commit | bf0e22b298e282dec3589f70c67e401588d6c693 (patch) | |
| tree | e9235bd74701ccb4b34cc30a87dd4c9058824688 /tests/rustdoc-js-std/parser-errors.js | |
| parent | 32d81eccd64513bacef9dfa1574543ada6b45d85 (diff) | |
| parent | e4ee3298656b74dd6be810862b5dd4cb8d2825b8 (diff) | |
| download | rust-bf0e22b298e282dec3589f70c67e401588d6c693.tar.gz rust-bf0e22b298e282dec3589f70c67e401588d6c693.zip | |
Auto merge of #108537 - GuillaumeGomez:rustdoc-search-whitespace-as-separator, r=notriddle
rustdoc: Allow whitespace as path separator like double colon Fixes https://github.com/rust-lang/rust/issues/108447. I think it makes sense since it allows more common cases, however it also makes the syntax heavier. Not sure what the rest of the team thinks about it. In any case we'll need to go through FCP. Full explanation for the changes is available [here](https://github.com/rust-lang/rust/pull/108537#issuecomment-1589480564). r? `@notriddle`
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
| -rw-r--r-- | tests/rustdoc-js-std/parser-errors.js | 200 |
1 files changed, 179 insertions, 21 deletions
diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index af7f63f99cb..b32bfea5439 100644 --- a/tests/rustdoc-js-std/parser-errors.js +++ b/tests/rustdoc-js-std/parser-errors.js @@ -33,15 +33,24 @@ const PARSED = [ original: "\"P\" \"P\"", returned: [], userQuery: "\"p\" \"p\"", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"P","P"', + elems: [], + foundElems: 0, + original: "\"P\",\"P\"", + returned: [], + userQuery: "\"p\",\"p\"", error: "Cannot have more than one literal search element", }, { - query: 'P "P"', + query: "P,\"P\"", elems: [], foundElems: 0, - original: "P \"P\"", + original: "P,\"P\"", returned: [], - userQuery: "p \"p\"", + userQuery: "p,\"p\"", error: "Cannot use literal search when there is more than one element", }, { @@ -51,7 +60,16 @@ const PARSED = [ original: "\"p\" p", returned: [], userQuery: "\"p\" p", - error: "You cannot have more than one element if you use quotes", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",p', + elems: [], + foundElems: 0, + original: "\"p\",p", + returned: [], + userQuery: "\"p\",p", + error: "Cannot have more than one element if you use quotes", }, { query: '"const": p', @@ -60,7 +78,7 @@ const PARSED = [ original: "\"const\": p", returned: [], userQuery: "\"const\": p", - error: "You cannot use quotes on type filter", + error: "Cannot use quotes on type filter", }, { query: "a<:a>", @@ -108,6 +126,15 @@ const PARSED = [ error: "Paths cannot start with `::`", }, { + query: " ::a::b", + elems: [], + foundElems: 0, + original: "::a::b", + returned: [], + userQuery: "::a::b", + error: "Paths cannot start with `::`", + }, + { query: "a::::b", elems: [], foundElems: 0, @@ -135,13 +162,13 @@ const PARSED = [ error: "Expected type filter before `:`", }, { - query: "a b:", + query: "a,b:", elems: [], foundElems: 0, - original: "a b:", + original: "a,b:", returned: [], - userQuery: "a b:", - error: "Unexpected `:` (expected path after type filter)", + userQuery: "a,b:", + error: "Unexpected `:` (expected path after type filter `b:`)", }, { query: "a (b:", @@ -159,7 +186,7 @@ const PARSED = [ original: "_:", returned: [], userQuery: "_:", - error: "Unexpected `:` (expected path after type filter)", + error: "Unexpected `:` (expected path after type filter `_:`)", }, { query: "_:a", @@ -213,6 +240,15 @@ const PARSED = [ original: '"p" <a>', returned: [], userQuery: '"p" <a>', + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",<a>', + elems: [], + foundElems: 0, + original: '"p",<a>', + returned: [], + userQuery: '"p",<a>', error: "Found generics without a path", }, { @@ -222,7 +258,16 @@ const PARSED = [ original: '"p" a<a>', returned: [], userQuery: '"p" a<a>', - error: "You cannot have more than one element if you use quotes", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",a<a>', + elems: [], + foundElems: 0, + original: '"p",a<a>', + returned: [], + userQuery: '"p",a<a>', + error: "Cannot have more than one element if you use quotes", }, { query: "a,<", @@ -240,7 +285,7 @@ const PARSED = [ original: 'aaaaa<>b', returned: [], userQuery: 'aaaaa<>b', - error: 'Expected `,`, ` `, `:` or `->`, found `b`', + error: 'Expected `,`, `:` or `->` after `>`, found `b`', }, { query: "fn:aaaaa<>b", @@ -249,7 +294,7 @@ const PARSED = [ original: 'fn:aaaaa<>b', returned: [], userQuery: 'fn:aaaaa<>b', - error: 'Expected `,`, ` `, `:` or `->`, found `b`', + error: 'Expected `,`, `:` or `->` after `>`, found `b`', }, { query: "->a<>b", @@ -258,7 +303,7 @@ const PARSED = [ original: '->a<>b', returned: [], userQuery: '->a<>b', - error: 'Expected `,` or ` `, found `b`', + error: 'Expected `,` after `>`, found `b`', }, { query: "a<->", @@ -276,7 +321,7 @@ const PARSED = [ original: 'a:: a', returned: [], userQuery: 'a:: a', - error: 'Paths cannot end with `::`', + error: 'Unexpected `:: `', }, { query: "a ::a", @@ -285,7 +330,7 @@ const PARSED = [ original: 'a ::a', returned: [], userQuery: 'a ::a', - error: 'Paths cannot start with `::`', + error: 'Unexpected ` ::`', }, { query: "a<a>:", @@ -294,7 +339,7 @@ const PARSED = [ original: "a<a>:", returned: [], userQuery: "a<a>:", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { query: "a<>:", @@ -303,7 +348,7 @@ const PARSED = [ original: "a<>:", returned: [], userQuery: "a<>:", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { query: "a,:", @@ -312,7 +357,7 @@ const PARSED = [ original: "a,:", returned: [], userQuery: "a,:", - error: 'Unexpected `,` in type filter', + error: 'Unexpected `,` in type filter (before `:`)', }, { query: " a<> :", @@ -321,7 +366,7 @@ const PARSED = [ original: "a<> :", returned: [], userQuery: "a<> :", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { query: "mod : :", @@ -330,7 +375,16 @@ const PARSED = [ original: "mod : :", returned: [], userQuery: "mod : :", - error: 'Unexpected `:`', + error: 'Unexpected `:` (expected path after type filter `mod:`)', + }, + { + query: "mod: :", + elems: [], + foundElems: 0, + original: "mod: :", + returned: [], + userQuery: "mod: :", + error: 'Unexpected `:` (expected path after type filter `mod:`)', }, { query: "a!a", @@ -386,4 +440,108 @@ const PARSED = [ userQuery: "a<", error: "Unclosed `<`", }, + { + query: "p<x> , y", + elems: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [ + { + name: "x", + fullPath: ["x"], + pathWithoutLast: [], + pathLast: "x", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + { + name: "y", + fullPath: ["y"], + pathWithoutLast: [], + pathLast: "y", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 2, + original: "p<x> , y", + returned: [], + userQuery: "p<x> , y", + error: null, + }, + { + query: "p<x , y>", + elems: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [ + { + name: "x", + fullPath: ["x"], + pathWithoutLast: [], + pathLast: "x", + generics: [], + typeFilter: -1, + }, + { + name: "y", + fullPath: ["y"], + pathWithoutLast: [], + pathLast: "y", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "p<x , y>", + returned: [], + userQuery: "p<x , y>", + error: null, + }, + { + query: "p ,x , y", + elems: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [], + typeFilter: -1, + }, + { + name: "x", + fullPath: ["x"], + pathWithoutLast: [], + pathLast: "x", + generics: [], + typeFilter: -1, + }, + { + name: "y", + fullPath: ["y"], + pathWithoutLast: [], + pathLast: "y", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 3, + original: "p ,x , y", + returned: [], + userQuery: "p ,x , y", + error: null, + }, ]; |
