about summary refs log tree commit diff
path: root/src/test/rustdoc-gui
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2021-07-10 21:10:14 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-07-12 19:03:59 +0200
commitbd819493d7780b9b511896b5f1080d8dc419f314 (patch)
treeea6f65517ec9f384f7924da0d959bdbc17e61977 /src/test/rustdoc-gui
parentda6d82e465f94202dd1bacc6f5d61e0dcb1f3e7c (diff)
downloadrust-bd819493d7780b9b511896b5f1080d8dc419f314.tar.gz
rust-bd819493d7780b9b511896b5f1080d8dc419f314.zip
Add test for implementors
Diffstat (limited to 'src/test/rustdoc-gui')
-rw-r--r--src/test/rustdoc-gui/implementors.goml16
-rw-r--r--src/test/rustdoc-gui/src/implementors/Cargo.toml7
-rw-r--r--src/test/rustdoc-gui/src/implementors/lib.rs7
3 files changed, 30 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/implementors.goml b/src/test/rustdoc-gui/implementors.goml
new file mode 100644
index 00000000000..a4db5cee7c7
--- /dev/null
+++ b/src/test/rustdoc-gui/implementors.goml
@@ -0,0 +1,16 @@
+// The goal of this test is to check that the external trait implementors, generated with JS,
+// have the same display than the "local" ones.
+goto: file://|DOC_PATH|/implementors/trait.Whatever.html
+assert: "#implementors-list"
+// There are supposed to be two implementors listed.
+assert-count: ("#implementors-list > .impl", 2)
+// Now we check that both implementors have an anchor, an ID and a similar DOM.
+assert: ("#implementors-list > .impl:nth-child(1) > a.anchor")
+assert-attribute: ("#implementors-list > .impl:nth-child(1)", {"id": "impl-Whatever"})
+assert-attribute: ("#implementors-list > .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"})
+assert: "#implementors-list > .impl:nth-child(1) > code.in-band"
+
+assert: ("#implementors-list > .impl:nth-child(2) > a.anchor")
+assert-attribute: ("#implementors-list > .impl:nth-child(2)", {"id": "impl-Whatever-1"})
+assert-attribute: ("#implementors-list > .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
+assert: "#implementors-list > .impl:nth-child(2) > code.in-band"
diff --git a/src/test/rustdoc-gui/src/implementors/Cargo.toml b/src/test/rustdoc-gui/src/implementors/Cargo.toml
new file mode 100644
index 00000000000..7ef1052c49f
--- /dev/null
+++ b/src/test/rustdoc-gui/src/implementors/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "implementors"
+version = "0.1.0"
+edition = "2018"
+
+[lib]
+path = "lib.rs"
diff --git a/src/test/rustdoc-gui/src/implementors/lib.rs b/src/test/rustdoc-gui/src/implementors/lib.rs
new file mode 100644
index 00000000000..4b2f6962e30
--- /dev/null
+++ b/src/test/rustdoc-gui/src/implementors/lib.rs
@@ -0,0 +1,7 @@
+pub trait Whatever {
+    fn method() {}
+}
+
+pub struct Struct;
+
+impl Whatever for Struct {}