diff options
author | Michael Howell <michael@notriddle.com> | 2023-04-24 12:14:35 -0700 |
---|---|---|
committer | Michael Howell <michael@notriddle.com> | 2023-04-24 12:14:35 -0700 |
commit | c4e00f7bd525dd480341c1790d10276274eed9a6 (patch) | |
tree | 55d4de701b8cc56fb5c173f907d044b4615df9eb /tests/rustdoc-js/slice-array.js | |
parent | b72460fe46a873da0c40582636c26e7675e92288 (diff) | |
download | rust-c4e00f7bd525dd480341c1790d10276274eed9a6.tar.gz |
rustdoc-search: add slices and arrays to index
This indexes them as primitives with generics, so `slice<u32>` is
how you search for `[u32]`, and `array<u32>` for `[u32; 1]`.
A future commit will desugar the square bracket syntax to search
both arrays and slices at once.
Diffstat (limited to 'tests/rustdoc-js/slice-array.js')
-rw-r--r-- | tests/rustdoc-js/slice-array.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/rustdoc-js/slice-array.js b/tests/rustdoc-js/slice-array.js new file mode 100644 index 00000000000..8c21e06dc4e --- /dev/null +++ b/tests/rustdoc-js/slice-array.js @@ -0,0 +1,65 @@ +// exact-check + +const QUERY = [ + 'R<primitive:slice<P>>', + 'primitive:slice<R<P>>', + 'R<primitive:slice<Q>>', + 'primitive:slice<R<Q>>', + 'R<primitive:array<Q>>', + 'primitive:array<R<Q>>', + 'primitive:array<TraitCat>', + 'primitive:array<TraitDog>', +]; + +const EXPECTED = [ + { + // R<primitive:slice<P>> + 'returned': [], + 'in_args': [ + { 'path': 'slice_array', 'name': 'alpha' }, + ], + }, + { + // primitive:slice<R<P>> + 'returned': [ + { 'path': 'slice_array', 'name': 'alef' }, + ], + 'in_args': [], + }, + { + // R<primitive:slice<Q>> + 'returned': [], + 'in_args': [], + }, + { + // primitive:slice<R<Q>> + 'returned': [], + 'in_args': [], + }, + { + // R<primitive:array<Q>> + 'returned': [ + { 'path': 'slice_array', 'name': 'bet' }, + ], + 'in_args': [], + }, + { + // primitive:array<R<Q>> + 'returned': [], + 'in_args': [ + { 'path': 'slice_array', 'name': 'beta' }, + ], + }, + { + // primitive::array<TraitCat> + 'in_args': [ + { 'path': 'slice_array', 'name': 'gamma' }, + ], + }, + { + // primitive::array<TraitDog> + 'in_args': [ + { 'path': 'slice_array', 'name': 'gamma' }, + ], + }, +]; |