Skip to content

Commit a0cc9bb

Browse files
dns2utf8Mark-Simulacrum
authored andcommitted
Add a test to detect overlapping entries in overview tables
Detects rust-lang#88545
1 parent 2801a77 commit a0cc9bb

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
goto: file://|DOC_PATH|/test_docs/huge_amount_of_consts/index.html
2+
3+
// Make sure that the last two entries are more than 12 pixels apart and not stacked on each other.
4+
5+
compare-elements-position-near-false: ("//*[@class='item-table']//div[last()-1]", "//*[@class='item-table']//div[last()-3]", {"y": 12})

src/test/rustdoc-gui/src/test_docs/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ name = "test_docs"
33
version = "0.1.0"
44
edition = "2018"
55

6+
build = "build.rs"
7+
68
[lib]
79
path = "lib.rs"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! generate 2000 constants for testing
2+
3+
use std::{fs::write, path::PathBuf};
4+
5+
fn main() -> std::io::Result<()> {
6+
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR is not defined");
7+
8+
let mut output = String::new();
9+
for i in 0..2000 {
10+
let line = format!("/// Some const A{0}\npub const A{0}: isize = 0;\n", i);
11+
output.push_str(&*line);
12+
};
13+
14+
write(&[&*out_dir, "huge_amount_of_consts.rs"].iter().collect::<PathBuf>(), output)
15+
}

src/test/rustdoc-gui/src/test_docs/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,7 @@ pub mod keyword {}
116116

117117
/// Just some type alias.
118118
pub type SomeType = u32;
119+
120+
pub mod huge_amount_of_consts {
121+
include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
122+
}

0 commit comments

Comments
 (0)