about summary refs log tree commit diff
path: root/tests/rustdoc-js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-js')
-rw-r--r--tests/rustdoc-js/doc-alias-after-other-items.js38
-rw-r--r--tests/rustdoc-js/doc-alias-after-other-items.rs9
-rw-r--r--tests/rustdoc-js/sort-stability.js9
-rw-r--r--tests/rustdoc-js/sort-stability.rs16
4 files changed, 72 insertions, 0 deletions
diff --git a/tests/rustdoc-js/doc-alias-after-other-items.js b/tests/rustdoc-js/doc-alias-after-other-items.js
new file mode 100644
index 00000000000..5b22ef67698
--- /dev/null
+++ b/tests/rustdoc-js/doc-alias-after-other-items.js
@@ -0,0 +1,38 @@
+// exact-check
+
+// Checking that doc aliases are always listed after items with equivalent matching.
+
+const EXPECTED = [
+    {
+        'query': 'coo',
+        'others': [
+            {
+                'path': 'doc_alias_after_other_items',
+                'name': 'Foo',
+                'href': '../doc_alias_after_other_items/struct.Foo.html',
+            },
+            {
+                'path': 'doc_alias_after_other_items',
+                'name': 'bar',
+                'alias': 'Boo',
+                'is_alias': true
+            },
+        ],
+    },
+    {
+        'query': '"confiture"',
+        'others': [
+            {
+                'path': 'doc_alias_after_other_items',
+                'name': 'Confiture',
+                'href': '../doc_alias_after_other_items/struct.Confiture.html',
+            },
+            {
+                'path': 'doc_alias_after_other_items',
+                'name': 'this_is_a_long_name',
+                'alias': 'Confiture',
+                'is_alias': true
+            },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js/doc-alias-after-other-items.rs b/tests/rustdoc-js/doc-alias-after-other-items.rs
new file mode 100644
index 00000000000..2ed555c8e2f
--- /dev/null
+++ b/tests/rustdoc-js/doc-alias-after-other-items.rs
@@ -0,0 +1,9 @@
+pub struct Foo;
+
+#[doc(alias = "Boo")]
+pub fn bar() {}
+
+pub struct Confiture;
+
+#[doc(alias = "Confiture")]
+pub fn this_is_a_long_name() {}
diff --git a/tests/rustdoc-js/sort-stability.js b/tests/rustdoc-js/sort-stability.js
new file mode 100644
index 00000000000..8c095619a08
--- /dev/null
+++ b/tests/rustdoc-js/sort-stability.js
@@ -0,0 +1,9 @@
+const EXPECTED = [
+    {
+        'query': 'foo',
+        'others': [
+            {"path": "sort_stability::old", "name": "foo"},
+            {"path": "sort_stability::new", "name": "foo"},
+        ],
+    },
+];
diff --git a/tests/rustdoc-js/sort-stability.rs b/tests/rustdoc-js/sort-stability.rs
new file mode 100644
index 00000000000..68662bb3aab
--- /dev/null
+++ b/tests/rustdoc-js/sort-stability.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+#![stable(feature = "foo_lib", since = "1.0.0")]
+
+#[stable(feature = "old_foo", since = "1.0.1")]
+pub mod old {
+    /// Old, stable foo
+    #[stable(feature = "old_foo", since = "1.0.1")]
+    pub fn foo() {}
+}
+
+#[unstable(feature = "new_foo", issue = "none")]
+pub mod new {
+    /// New, unstable foo
+    #[unstable(feature = "new_foo", issue = "none")]
+    pub fn foo() {}
+}