about summary refs log tree commit diff
path: root/tests/rustdoc-ui/2024-doctests-crate-attribute.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-07-11 22:53:30 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-08-13 20:14:57 +0200
commit7dcb841de040c85cf8e53e533917d6eade2c1777 (patch)
tree67a267cf47769cb32973f8e8131bcce3a53faa4b /tests/rustdoc-ui/2024-doctests-crate-attribute.rs
parentcbf6fe05e78c59e98d09a21bc90a7559b0cd8d5a (diff)
downloadrust-7dcb841de040c85cf8e53e533917d6eade2c1777.tar.gz
rust-7dcb841de040c85cf8e53e533917d6eade2c1777.zip
Add doctest to ensure that doctests with crate-level attributes are not part of merged doctest
Diffstat (limited to 'tests/rustdoc-ui/2024-doctests-crate-attribute.rs')
-rw-r--r--tests/rustdoc-ui/2024-doctests-crate-attribute.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/2024-doctests-crate-attribute.rs b/tests/rustdoc-ui/2024-doctests-crate-attribute.rs
new file mode 100644
index 00000000000..781a773d952
--- /dev/null
+++ b/tests/rustdoc-ui/2024-doctests-crate-attribute.rs
@@ -0,0 +1,22 @@
+//@ check-pass
+//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024
+//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
+//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ normalize-stdout-test ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
+
+/// This doctest is used to ensure that if a crate attribute is present,
+/// it will not be part of the merged doctests.
+///
+/// ```
+/// #![doc(html_playground_url = "foo")]
+///
+/// pub struct Bar;
+/// ```
+///
+/// This one will allow us to confirm that the doctest above will be a
+/// standalone one (there will be two separate doctests passes).
+///
+/// ```
+/// let x = 12;
+/// ```
+pub struct Foo;