Skip to content

Commit aa5a0c0

Browse files
committed
rustdoc: add test case for scraped example expand GUI
1 parent ae27c79 commit aa5a0c0

File tree

6 files changed

+63
-0
lines changed

6 files changed

+63
-0
lines changed

src/bootstrap/test.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,8 @@ impl Step for RustdocGUI {
10111011
// instead of hard-coding this test
10121012
if entry.file_name() == "link_to_definition" {
10131013
cargo.env("RUSTDOCFLAGS", "-Zunstable-options --generate-link-to-definition");
1014+
} else if entry.file_name() == "scrape_examples" {
1015+
cargo.arg("-Zrustdoc-scrape-examples=examples");
10141016
}
10151017
builder.run(&mut cargo);
10161018
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
2+
store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
3+
assert-property-false: (".scraped-example-list > .scraped-example pre", {
4+
"scrollHeight": |smallOffsetHeight|
5+
})
6+
focus: ".scraped-example-list > .scraped-example .expand"
7+
press-key: "Enter"
8+
assert-property-false: (".scraped-example-list > .scraped-example pre", {
9+
"offsetHeight": |smallOffsetHeight|
10+
})
11+
store-property: (fullOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
12+
assert-property: (".scraped-example-list > .scraped-example pre", {
13+
"scrollHeight": |fullOffsetHeight|
14+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file is automatically @generated by Cargo.
2+
# It is not intended for manual editing.
3+
version = 3
4+
5+
[[package]]
6+
name = "scrape_examples"
7+
version = "0.1.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "scrape_examples"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
fn main() {
2+
for i in 0..9 {
3+
println!("hello world!");
4+
println!("hello world!");
5+
println!("hello world!");
6+
println!("hello world!");
7+
println!("hello world!");
8+
println!("hello world!");
9+
println!("hello world!");
10+
println!("hello world!");
11+
println!("hello world!");
12+
}
13+
scrape_examples::test();
14+
for i in 0..9 {
15+
println!("hello world!");
16+
println!("hello world!");
17+
println!("hello world!");
18+
println!("hello world!");
19+
println!("hello world!");
20+
println!("hello world!");
21+
println!("hello world!");
22+
println!("hello world!");
23+
println!("hello world!");
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// # Examples
2+
///
3+
/// ```
4+
/// test();
5+
/// test();
6+
/// ```
7+
pub fn test() {}

0 commit comments

Comments
 (0)