about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-08-31 18:13:59 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-08-31 18:13:59 +0200
commitb112bfeda9dba77c6d7e8eef92125e7002c43e68 (patch)
tree8f42427f230fb2a6f648a141ae5da94cc9856455 /src
parent4304d1d1e6ea31ca45b722047f516322af4305c4 (diff)
downloadrust-b112bfeda9dba77c6d7e8eef92125e7002c43e68.tar.gz
rust-b112bfeda9dba77c6d7e8eef92125e7002c43e68.zip
Add rustdoc GUI test
Diffstat (limited to 'src')
-rw-r--r--src/test/rustdoc-gui/where-whitespace.goml27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/where-whitespace.goml b/src/test/rustdoc-gui/where-whitespace.goml
new file mode 100644
index 00000000000..1a3ff1f491c
--- /dev/null
+++ b/src/test/rustdoc-gui/where-whitespace.goml
@@ -0,0 +1,27 @@
+// This test ensures that the where conditions are correctly displayed.
+goto: file://|DOC_PATH|/lib2/trait.Whitespace.html
+show-text: true
+// First, we check in the trait definition if the where clause is "on its own" (not on the same
+// line than "pub trait Whitespace<Idx>").
+compare-elements-position-false: (".item-decl code", ".where.fmt-newline", ("y"))
+// And that the code following it isn't on the same line either.
+compare-elements-position-false: (".item-decl .fnname", ".where.fmt-newline", ("y"))
+
+goto: file://|DOC_PATH|/lib2/struct.WhereWhitespace.html
+// We make the screen a bit wider to ensure that the trait impl is on one line.
+size: (915, 915)
+
+compare-elements-position-false: ("#method\.new .fnname", "#method\.new .where.fmt-newline", ("y"))
+// We ensure that both the trait name and the struct name are on the same line in
+// "impl<K, T> Whitespace<&K> for WhereWhitespace<T>".
+compare-elements-position: (
+    "#trait-implementations-list .impl h3 .trait",
+    "#trait-implementations-list .impl h3 .struct",
+    ("y"),
+)
+// And we now check that the where condition isn't on the same line.
+compare-elements-position-false: (
+    "#trait-implementations-list .impl h3 .trait",
+    "#trait-implementations-list .impl h3 .where.fmt-newline",
+    ("y"),
+)