summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-js/big-result.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-js/big-result.rs')
-rw-r--r--tests/rustdoc-js/big-result.rs61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/rustdoc-js/big-result.rs b/tests/rustdoc-js/big-result.rs
new file mode 100644
index 000000000..4dfecd6aa
--- /dev/null
+++ b/tests/rustdoc-js/big-result.rs
@@ -0,0 +1,61 @@
+#![feature(concat_idents)]
+#![allow(nonstandard_style)]
+/// Generate 250 items that all match the query, starting with the longest.
+/// Those long items should be dropped from the result set, and the short ones
+/// should be shown instead.
+macro_rules! generate {
+ ([$($x:ident),+], $y:tt, $z:tt) => {
+ $(
+ generate!(@ $x, $y, $z);
+ )+
+ };
+ (@ $x:ident , [$($y:ident),+], $z:tt) => {
+ pub struct $x;
+ $(
+ generate!(@@ $x, $y, $z);
+ )+
+ };
+ (@@ $x:ident , $y:ident, [$($z:ident: $zt:ident),+]) => {
+ impl $y {
+ pub fn $x($($z: $zt,)+) {}
+ }
+ }
+}
+
+pub struct First;
+pub struct Second;
+pub struct Third;
+pub struct Fourth;
+pub struct Fifth;
+
+generate!(
+ [a, b, c, d, e],
+ [a, b, c, d, e, f, g, h, i, j],
+ [a: First, b: Second, c: Third, d: Fourth, e: Fifth]
+);
+
+generate!(
+ [f, g, h, i, j],
+ [a, b, c, d, e, f, g, h, i, j],
+ [a: First, b: Second, c: Third, d: Fourth]
+);
+
+generate!(
+ [k, l, m, n, o],
+ [a, b, c, d, e, f, g, h, i, j],
+ [a: First, b: Second, c: Third]
+);
+
+generate!(
+ // reverse it, just to make sure they're alphabetized
+ // in the result set when all else is equal
+ [t, s, r, q, p],
+ [a, b, c, d, e, f, g, h, i, j],
+ [a: First, b: Second]
+);
+
+generate!(
+ [u, v, w, x, y],
+ [a, b, c, d, e, f, g, h, i, j],
+ [a: First]
+);