about summary refs log tree commit diff
path: root/tests/rustdoc-js
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-09-01 14:31:01 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-09-01 15:16:11 +0200
commit05eda416580ff9be12a6cf87238c8047a1699dd3 (patch)
treeab39169d3ef24474aceca31ab55aaaf1c66e0003 /tests/rustdoc-js
parent09160b3f4583bbd14d62362fd1126a8232f19c8b (diff)
downloadrust-05eda416580ff9be12a6cf87238c8047a1699dd3.tar.gz
rust-05eda416580ff9be12a6cf87238c8047a1699dd3.zip
Add tests for type-based search
Diffstat (limited to 'tests/rustdoc-js')
-rw-r--r--tests/rustdoc-js/full-path-function.js25
-rw-r--r--tests/rustdoc-js/full-path-function.rs16
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/rustdoc-js/full-path-function.js b/tests/rustdoc-js/full-path-function.js
new file mode 100644
index 00000000000..9d3c3a4506c
--- /dev/null
+++ b/tests/rustdoc-js/full-path-function.js
@@ -0,0 +1,25 @@
+// exact-check
+
+const EXPECTED = [
+    {
+        'query': 'sac -> usize',
+        'others': [
+            { 'path': 'full_path_function::b::Sac', 'name': 'bar' },
+            { 'path': 'full_path_function::b::Sac', 'name': 'len' },
+            { 'path': 'full_path_function::sac::Sac', 'name': 'len' },
+        ],
+    },
+    {
+        'query': 'b::sac -> usize',
+        'others': [
+            { 'path': 'full_path_function::b::Sac', 'name': 'bar' },
+            { 'path': 'full_path_function::b::Sac', 'name': 'len' },
+        ],
+    },
+    {
+        'query': 'b::sac -> u32',
+        'others': [
+            { 'path': 'full_path_function::b::Sac', 'name': 'bar2' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js/full-path-function.rs b/tests/rustdoc-js/full-path-function.rs
new file mode 100644
index 00000000000..c1ec1e1731b
--- /dev/null
+++ b/tests/rustdoc-js/full-path-function.rs
@@ -0,0 +1,16 @@
+pub mod sac {
+    pub struct Sac;
+
+    impl Sac {
+        pub fn len(&self) -> usize { 0 }
+    }
+}
+
+pub mod b {
+    pub struct Sac;
+    impl Sac {
+        pub fn len(&self) -> usize { 0 }
+        pub fn bar(&self, w: u32) -> usize { 0 }
+        pub fn bar2(&self, w: u32) -> u32 { 0 }
+    }
+}