Skip to content

Commit

Permalink
Add a test to detect overlapping entries in overview tables
Browse files Browse the repository at this point in the history
  • Loading branch information
dns2utf8 authored and Mark-Simulacrum committed Oct 3, 2021
1 parent 2801a77 commit a0cc9bb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/huge-collection-of-constants.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
goto: file://|DOC_PATH|/test_docs/huge_amount_of_consts/index.html

// Make sure that the last two entries are more than 12 pixels apart and not stacked on each other.

compare-elements-position-near-false: ("//*[@class='item-table']//div[last()-1]", "//*[@class='item-table']//div[last()-3]", {"y": 12})
2 changes: 2 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ name = "test_docs"
version = "0.1.0"
edition = "2018"

build = "build.rs"

[lib]
path = "lib.rs"
15 changes: 15 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! generate 2000 constants for testing
use std::{fs::write, path::PathBuf};

fn main() -> std::io::Result<()> {
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR is not defined");

let mut output = String::new();
for i in 0..2000 {
let line = format!("/// Some const A{0}\npub const A{0}: isize = 0;\n", i);
output.push_str(&*line);
};

write(&[&*out_dir, "huge_amount_of_consts.rs"].iter().collect::<PathBuf>(), output)
}
4 changes: 4 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,7 @@ pub mod keyword {}

/// Just some type alias.
pub type SomeType = u32;

pub mod huge_amount_of_consts {
include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
}

0 comments on commit a0cc9bb

Please sign in to comment.