diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-05-11 00:09:35 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-11 00:09:35 +0900 |
| commit | d34915f691ca78596f57fcb73bbc9de08675d65a (patch) | |
| tree | 427f33b804831917de064889cf9cbe7477b04a4b /src/test | |
| parent | 7274447c36949bb63bef0a78bc23f8842d8c7320 (diff) | |
| parent | a9a90d450d11a06dff8bc49a89352e733e904fcf (diff) | |
Rollup merge of #96879 - notriddle:notriddle/search-ranking, r=GuillaumeGomez
rustdoc: search result ranking fix # Before  # After 
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc-js-std/path-ordering.js | 12 | ||||
| -rw-r--r-- | src/test/rustdoc-js/path-ordering.js | 14 | ||||
| -rw-r--r-- | src/test/rustdoc-js/path-ordering.rs | 9 |
3 files changed, 35 insertions, 0 deletions
diff --git a/src/test/rustdoc-js-std/path-ordering.js b/src/test/rustdoc-js-std/path-ordering.js new file mode 100644 index 00000000000..7dcdd402312 --- /dev/null +++ b/src/test/rustdoc-js-std/path-ordering.js @@ -0,0 +1,12 @@ +const QUERY = 'hashset::insert'; + +const EXPECTED = { + 'others': [ + // ensure hashset::insert comes first + { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' }, + { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' }, + ], +}; diff --git a/src/test/rustdoc-js/path-ordering.js b/src/test/rustdoc-js/path-ordering.js new file mode 100644 index 00000000000..4aee569b0f4 --- /dev/null +++ b/src/test/rustdoc-js/path-ordering.js @@ -0,0 +1,14 @@ +// exact-check + +const QUERY = 'b::ccccccc'; + +const EXPECTED = { + 'others': [ + // `ccccccc` is an exact match for all three of these. + // However `b` is a closer match for `bb` than for any + // of the others, so it ought to go first. + { 'path': 'path_ordering::bb', 'name': 'Ccccccc' }, + { 'path': 'path_ordering::aa', 'name': 'Ccccccc' }, + { 'path': 'path_ordering::dd', 'name': 'Ccccccc' }, + ], +}; diff --git a/src/test/rustdoc-js/path-ordering.rs b/src/test/rustdoc-js/path-ordering.rs new file mode 100644 index 00000000000..7843cf7f9dc --- /dev/null +++ b/src/test/rustdoc-js/path-ordering.rs @@ -0,0 +1,9 @@ +pub mod dd { + pub struct Ccccccc; +} +pub mod aa { + pub struct Ccccccc; +} +pub mod bb { + pub struct Ccccccc; +} |
