rustdoc: add test case for scraped example expand GUI
This commit is contained in:
parent
ae27c790ff
commit
aa5a0c0d88
@ -1011,6 +1011,8 @@ impl Step for RustdocGUI {
|
|||||||
// instead of hard-coding this test
|
// instead of hard-coding this test
|
||||||
if entry.file_name() == "link_to_definition" {
|
if entry.file_name() == "link_to_definition" {
|
||||||
cargo.env("RUSTDOCFLAGS", "-Zunstable-options --generate-link-to-definition");
|
cargo.env("RUSTDOCFLAGS", "-Zunstable-options --generate-link-to-definition");
|
||||||
|
} else if entry.file_name() == "scrape_examples" {
|
||||||
|
cargo.arg("-Zrustdoc-scrape-examples=examples");
|
||||||
}
|
}
|
||||||
builder.run(&mut cargo);
|
builder.run(&mut cargo);
|
||||||
}
|
}
|
||||||
|
14
src/test/rustdoc-gui/scrape-examples-button-focus.goml
Normal file
14
src/test/rustdoc-gui/scrape-examples-button-focus.goml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
|
||||||
|
store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
|
||||||
|
assert-property-false: (".scraped-example-list > .scraped-example pre", {
|
||||||
|
"scrollHeight": |smallOffsetHeight|
|
||||||
|
})
|
||||||
|
focus: ".scraped-example-list > .scraped-example .expand"
|
||||||
|
press-key: "Enter"
|
||||||
|
assert-property-false: (".scraped-example-list > .scraped-example pre", {
|
||||||
|
"offsetHeight": |smallOffsetHeight|
|
||||||
|
})
|
||||||
|
store-property: (fullOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
|
||||||
|
assert-property: (".scraped-example-list > .scraped-example pre", {
|
||||||
|
"scrollHeight": |fullOffsetHeight|
|
||||||
|
})
|
7
src/test/rustdoc-gui/src/scrape_examples/Cargo.lock
Normal file
7
src/test/rustdoc-gui/src/scrape_examples/Cargo.lock
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scrape_examples"
|
||||||
|
version = "0.1.0"
|
8
src/test/rustdoc-gui/src/scrape_examples/Cargo.toml
Normal file
8
src/test/rustdoc-gui/src/scrape_examples/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "scrape_examples"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
25
src/test/rustdoc-gui/src/scrape_examples/examples/check.rs
Normal file
25
src/test/rustdoc-gui/src/scrape_examples/examples/check.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
fn main() {
|
||||||
|
for i in 0..9 {
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
}
|
||||||
|
scrape_examples::test();
|
||||||
|
for i in 0..9 {
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
println!("hello world!");
|
||||||
|
}
|
||||||
|
}
|
7
src/test/rustdoc-gui/src/scrape_examples/src/lib.rs
Normal file
7
src/test/rustdoc-gui/src/scrape_examples/src/lib.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// test();
|
||||||
|
/// test();
|
||||||
|
/// ```
|
||||||
|
pub fn test() {}
|
Loading…
x
Reference in New Issue
Block a user