diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-02-21 14:25:12 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-02-21 14:25:12 +0100 |
| commit | 8005092cf0dcb05665c7e7f06fa29dfb45d3c529 (patch) | |
| tree | 5dd524dee434eecd9aeef9bc0f4b9627c4aaa90b | |
| parent | fa131845bc668e5a8535882a03eab2ec8d2e23aa (diff) | |
| download | rust-8005092cf0dcb05665c7e7f06fa29dfb45d3c529.tar.gz rust-8005092cf0dcb05665c7e7f06fa29dfb45d3c529.zip | |
Add rustdoc gui tests
| -rw-r--r-- | src/test/rustdoc-gui/basic-code.goml | 3 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/basic.goml | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/code-sidebar-toggle.goml | 6 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/lib.rs | 67 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/list_code_block.goml | 3 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/theme-change.goml | 10 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/toggle-docs.goml | 7 |
7 files changed, 100 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/basic-code.goml b/src/test/rustdoc-gui/basic-code.goml new file mode 100644 index 00000000000..8da46566254 --- /dev/null +++ b/src/test/rustdoc-gui/basic-code.goml @@ -0,0 +1,3 @@ +goto: file://|DOC_PATH|/index.html +click: ".srclink" +assert: (".line-numbers", 1) diff --git a/src/test/rustdoc-gui/basic.goml b/src/test/rustdoc-gui/basic.goml new file mode 100644 index 00000000000..ed23300860b --- /dev/null +++ b/src/test/rustdoc-gui/basic.goml @@ -0,0 +1,4 @@ +goto: file://|DOC_PATH|/index.html +assert: ("#functions") +goto: ./struct.Foo.html +assert: ("div.type-decl") diff --git a/src/test/rustdoc-gui/code-sidebar-toggle.goml b/src/test/rustdoc-gui/code-sidebar-toggle.goml new file mode 100644 index 00000000000..69fc860244b --- /dev/null +++ b/src/test/rustdoc-gui/code-sidebar-toggle.goml @@ -0,0 +1,6 @@ +goto: file://|DOC_PATH|/index.html +click: ".srclink" +click: "#sidebar-toggle" +wait-for: 500 +fail: true +assert: ("#source-sidebar", { "left": "-300px" }) diff --git a/src/test/rustdoc-gui/lib.rs b/src/test/rustdoc-gui/lib.rs new file mode 100644 index 00000000000..3c996f5b65c --- /dev/null +++ b/src/test/rustdoc-gui/lib.rs @@ -0,0 +1,67 @@ +//! The point of this crate is to be able to have enough different "kinds" of +//! documentation generated so we can test each different features. + +#![crate_name = "test_docs"] + +use std::fmt; + +/// Basic function with some code examples: +/// +/// ``` +/// println!("nothing fancy"); +/// ``` +/// +/// A failing to compile one: +/// +/// ```compile_fail +/// println!("where did my argument {} go? :'("); +/// ``` +/// +/// An ignored one: +/// +/// ```ignore (it's a test) +/// Let's say I'm just some text will ya? +/// ``` +pub fn foo() {} + +/// Just a normal struct. +pub struct Foo; + +/// Just a normal enum. +pub enum WhoLetTheDogOut { + /// Woof! + Woof, + /// Meoooooooow... + Meow, +} + +/// Who doesn't love to wrap a `format!` call? +pub fn some_more_function<T: fmt::Debug>(t: &T) -> String { + format!("{:?}", t) +} + +/// Woohoo! A trait! +pub trait AnotherOne { + /// Some func 1. + fn func1(); + + /// Some func 2. + fn func2(); + + /// Some func 3. + fn func3(); +} + +/// Check for "i" signs in lists! +/// +/// 1. elem 1 +/// 2.test 1 +/// ```compile_fail +/// fn foo() {} +/// ``` +/// 3. elem 3 +/// 4. ```ignore (it's a test) +/// fn foo() {} +/// ``` +/// 5. elem 5 +pub fn check_list_code_block() {} diff --git a/src/test/rustdoc-gui/list_code_block.goml b/src/test/rustdoc-gui/list_code_block.goml new file mode 100644 index 00000000000..6f2465a5587 --- /dev/null +++ b/src/test/rustdoc-gui/list_code_block.goml @@ -0,0 +1,3 @@ +goto: file://|DOC_PATH|/index.html +goto: ./fn.check_list_code_block.html +assert: ("pre.rust.fn") diff --git a/src/test/rustdoc-gui/theme-change.goml b/src/test/rustdoc-gui/theme-change.goml new file mode 100644 index 00000000000..5bd65f61f49 --- /dev/null +++ b/src/test/rustdoc-gui/theme-change.goml @@ -0,0 +1,10 @@ +goto: file://|DOC_PATH|/index.html +click: "#theme-picker" +click: "#theme-choices > button:first-child" +wait-for: 500 +// should be the ayu theme so let's check the color +assert: ("body", { "background-color": "rgb(15, 20, 25)" }) +click: "#theme-choices > button:last-child" +wait-for: 500 +// should be the light theme so let's check the color +assert: ("body", { "background-color": "rgb(255, 255, 255)" }) diff --git a/src/test/rustdoc-gui/toggle-docs.goml b/src/test/rustdoc-gui/toggle-docs.goml new file mode 100644 index 00000000000..1ded33f659d --- /dev/null +++ b/src/test/rustdoc-gui/toggle-docs.goml @@ -0,0 +1,7 @@ +goto: file://|DOC_PATH|/index.html +click: "#toggle-all-docs" +wait-for: 5000 +assert: ("#main > div.docblock.hidden-by-usual-hider") +click: "#toggle-all-docs" +wait-for: 5000 +assert: ("#main > div.docblock.hidden-by-usual-hider", 0) |
