about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-07-20 22:28:27 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-07-21 11:52:24 +0200
commite4d701b1d3f1cc04574c9b92abfa33e2a4c0e9c3 (patch)
tree82e62dd543bed59bbe9d1dbaab600044cce1d0fa /tests
parentee034f4912f21291c523b4525d4ecafce8a92cfa (diff)
downloadrust-e4d701b1d3f1cc04574c9b92abfa33e2a4c0e9c3.tar.gz
rust-e4d701b1d3f1cc04574c9b92abfa33e2a4c0e9c3.zip
Add regression test for stab display in doc blocks
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-gui/src/test_docs/lib.rs8
-rw-r--r--tests/rustdoc-gui/stab-in-doc.goml9
2 files changed, 13 insertions, 4 deletions
diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs
index 7e34178e56f..360ad3edefa 100644
--- a/tests/rustdoc-gui/src/test_docs/lib.rs
+++ b/tests/rustdoc-gui/src/test_docs/lib.rs
@@ -20,10 +20,10 @@ Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated
 Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
 Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
 
-Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
-</span>.
-Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
-</span>.
+Finally, you can use `quz` only on <span class="stab portability" data-span="1"><code>Unix or x86-64
+</code></span>.
+Finally, you can use `quz` only on <span class="stab portability" data-span="2"><code>Unix or x86-64
+</code></span>.
 */
 
 use std::convert::AsRef;
diff --git a/tests/rustdoc-gui/stab-in-doc.goml b/tests/rustdoc-gui/stab-in-doc.goml
new file mode 100644
index 00000000000..6a03a51fe9f
--- /dev/null
+++ b/tests/rustdoc-gui/stab-in-doc.goml
@@ -0,0 +1,9 @@
+// This test ensure that `stab` elements if used in doc blocks are not breaking the text layout.
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// We make the window wide enough for the two stabs who are looking into to be on the same line.
+set-window-size: (1100, 600)
+compare-elements-position: (
+    ".top-doc .docblock span[data-span='1']",
+    ".top-doc .docblock span[data-span='2']",
+    ["y"],
+)