diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-03-20 15:03:17 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-04-18 20:59:09 +0200 |
| commit | 699ae365dfadabb3d26f957341a9f176d73bc8af (patch) | |
| tree | 1dbb52f4b0a7990602b1577142b7d36b750cad7f /src/test/rustdoc-js-std | |
| parent | c7de1a16f89b9aa3205f50c9cf2b9f6792ac6e4b (diff) | |
| download | rust-699ae365dfadabb3d26f957341a9f176d73bc8af.tar.gz rust-699ae365dfadabb3d26f957341a9f176d73bc8af.zip | |
Apply suggestions:
* Forbid generics without a path (so "<p>" is forbidden). * Change `handleSingleArg` so that it takes `results_others`, `results_in_args` and `results_returned` as arguments instead of using the "global" variables. * Change `createQueryElement` so that it returns the newly created element instead of taking `elems` as argument. * Improve documentation
Diffstat (limited to 'src/test/rustdoc-js-std')
| -rw-r--r-- | src/test/rustdoc-js-std/parser-errors.js | 40 | ||||
| -rw-r--r-- | src/test/rustdoc-js-std/parser-generics.js | 25 | ||||
| -rw-r--r-- | src/test/rustdoc-js-std/parser-returned.js | 12 | ||||
| -rw-r--r-- | src/test/rustdoc-js-std/parser-weird-queries.js (renamed from src/test/rustdoc-js-std/parser-invalid.js) | 0 |
4 files changed, 47 insertions, 30 deletions
diff --git a/src/test/rustdoc-js-std/parser-errors.js b/src/test/rustdoc-js-std/parser-errors.js index d4cd9facf17..080f82b41ec 100644 --- a/src/test/rustdoc-js-std/parser-errors.js +++ b/src/test/rustdoc-js-std/parser-errors.js @@ -1,4 +1,6 @@ const QUERY = [ + '<P>', + '-> <P>', '<"P">', '"P" "P"', 'P "P"', @@ -16,12 +18,32 @@ const QUERY = [ "a b:", "a (b:", "{:", + "a-bb", + "a>bb", ]; 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: "<\"P\">", returned: [], typeFilter: -1, @@ -172,4 +194,22 @@ const PARSED = [ 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 `->`?)", + }, ]; diff --git a/src/test/rustdoc-js-std/parser-generics.js b/src/test/rustdoc-js-std/parser-generics.js index cf8d99ef22a..cc92f2333d2 100644 --- a/src/test/rustdoc-js-std/parser-generics.js +++ b/src/test/rustdoc-js-std/parser-generics.js @@ -1,30 +1,7 @@ -const QUERY = ['<P>', 'A<B<C<D>, E>', 'p<> u8']; +const QUERY = ['A<B<C<D>, E>', 'p<> u8']; const PARSED = [ { - elems: [{ - name: "", - fullPath: [""], - pathWithoutLast: [], - pathLast: "", - generics: [ - { - name: "p", - fullPath: ["p"], - pathWithoutLast: [], - pathLast: "p", - generics: [], - }, - ], - }], - foundElems: 1, - original: "<P>", - returned: [], - typeFilter: -1, - userQuery: "<p>", - error: null, - }, - { elems: [], foundElems: 0, original: 'A<B<C<D>, E>', diff --git a/src/test/rustdoc-js-std/parser-returned.js b/src/test/rustdoc-js-std/parser-returned.js index db64b03c0b3..8910275c91e 100644 --- a/src/test/rustdoc-js-std/parser-returned.js +++ b/src/test/rustdoc-js-std/parser-returned.js @@ -1,15 +1,15 @@ -const QUERY = ['-> <P>', '-> P']; +const QUERY = ['-> F<P>', '-> P']; const PARSED = [ { elems: [], foundElems: 1, - original: "-> <P>", + original: "-> F<P>", returned: [{ - name: "", - fullPath: [""], + name: "f", + fullPath: ["f"], pathWithoutLast: [], - pathLast: "", + pathLast: "f", generics: [ { name: "p", @@ -21,7 +21,7 @@ const PARSED = [ ], }], typeFilter: -1, - userQuery: "-> <p>", + userQuery: "-> f<p>", error: null, }, { diff --git a/src/test/rustdoc-js-std/parser-invalid.js b/src/test/rustdoc-js-std/parser-weird-queries.js index 87ebe21c49b..87ebe21c49b 100644 --- a/src/test/rustdoc-js-std/parser-invalid.js +++ b/src/test/rustdoc-js-std/parser-weird-queries.js |
