diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-01-20 14:12:41 +0100 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2025-01-20 14:12:41 +0100 |
| commit | 1e0204beae7c0ebc5cddc64d1375bc7ee95f41db (patch) | |
| tree | 35fe35cfae96730b99e09b4dd97fdff8ab3e3a64 /tests/rustdoc-js-std | |
| parent | 808bd955862a48f604f1b227c7ca0bbb7ae2a8e8 (diff) | |
| parent | ecda83b30f0f68cf5692855dddc0bc38ee8863fc (diff) | |
| download | rust-1e0204beae7c0ebc5cddc64d1375bc7ee95f41db.tar.gz rust-1e0204beae7c0ebc5cddc64d1375bc7ee95f41db.zip | |
Merge from rustc
Diffstat (limited to 'tests/rustdoc-js-std')
| -rw-r--r-- | tests/rustdoc-js-std/const-is-nullary-func.js | 7 | ||||
| -rw-r--r-- | tests/rustdoc-js-std/field-is-unary-func.js | 7 | ||||
| -rw-r--r-- | tests/rustdoc-js-std/return-based-sort.js | 30 |
3 files changed, 44 insertions, 0 deletions
diff --git a/tests/rustdoc-js-std/const-is-nullary-func.js b/tests/rustdoc-js-std/const-is-nullary-func.js new file mode 100644 index 00000000000..e929741b038 --- /dev/null +++ b/tests/rustdoc-js-std/const-is-nullary-func.js @@ -0,0 +1,7 @@ +const EXPECTED = { + 'query': '-> char', + 'others': [ + { 'path': 'std::char', 'name': 'from_digit' }, + { 'path': 'std::char', 'name': 'MAX' }, + ], +} diff --git a/tests/rustdoc-js-std/field-is-unary-func.js b/tests/rustdoc-js-std/field-is-unary-func.js new file mode 100644 index 00000000000..09ce8a0dde0 --- /dev/null +++ b/tests/rustdoc-js-std/field-is-unary-func.js @@ -0,0 +1,7 @@ +const EXPECTED = { + // one of the only non-generic structs with public fields + 'query': 'CpuidResult -> u32', + 'others': [ + { 'path': 'core::arch::x86::CpuidResult', 'name': 'eax' }, + ], +} diff --git a/tests/rustdoc-js-std/return-based-sort.js b/tests/rustdoc-js-std/return-based-sort.js new file mode 100644 index 00000000000..30baf1cd36e --- /dev/null +++ b/tests/rustdoc-js-std/return-based-sort.js @@ -0,0 +1,30 @@ +// test that `clone`-like functions are sorted lower when +// a search is based soley on return type + +const FILTER_CRATE = "core"; + +const EXPECTED = [ + { + 'query': '-> AllocError', + 'others': [ + { 'path': 'core::alloc::Allocator', 'name': 'allocate' }, + { 'path': 'core::alloc::AllocError', 'name': 'clone' }, + ], + }, + { + 'query': 'AllocError', + 'returned': [ + { 'path': 'core::alloc::Allocator', 'name': 'allocate' }, + { 'path': 'core::alloc::AllocError', 'name': 'clone' }, + ], + }, + { + 'query': '-> &str', + 'others': [ + // type_name_of_val should not be consider clone-like + { 'path': 'core::any', 'name': 'type_name_of_val' }, + // this returns `Option<&str>`, and thus should be sorted lower + { 'path': 'core::str::Split', 'name': 'next' }, + ], + }, +] |
