From c4e00f7bd525dd480341c1790d10276274eed9a6 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 24 Apr 2023 12:14:35 -0700 Subject: rustdoc-search: add slices and arrays to index This indexes them as primitives with generics, so `slice` is how you search for `[u32]`, and `array` for `[u32; 1]`. A future commit will desugar the square bracket syntax to search both arrays and slices at once. --- tests/rustdoc-js/slice-array.js | 65 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/rustdoc-js/slice-array.js (limited to 'tests/rustdoc-js/slice-array.js') 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>', + 'R>', + 'primitive:slice>', + 'R>', + 'primitive:array>', + 'primitive:array', + 'primitive:array', +]; + +const EXPECTED = [ + { + // R> + 'returned': [], + 'in_args': [ + { 'path': 'slice_array', 'name': 'alpha' }, + ], + }, + { + // primitive:slice> + 'returned': [ + { 'path': 'slice_array', 'name': 'alef' }, + ], + 'in_args': [], + }, + { + // R> + 'returned': [], + 'in_args': [], + }, + { + // primitive:slice> + 'returned': [], + 'in_args': [], + }, + { + // R> + 'returned': [ + { 'path': 'slice_array', 'name': 'bet' }, + ], + 'in_args': [], + }, + { + // primitive:array> + 'returned': [], + 'in_args': [ + { 'path': 'slice_array', 'name': 'beta' }, + ], + }, + { + // primitive::array + 'in_args': [ + { 'path': 'slice_array', 'name': 'gamma' }, + ], + }, + { + // primitive::array + 'in_args': [ + { 'path': 'slice_array', 'name': 'gamma' }, + ], + }, +]; -- cgit 1.4.1-3-g733a5