diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2023-12-04 12:13:24 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2023-12-04 12:13:24 +0100 |
| commit | 8e53edb2ece6cc6ab6715fef5b3332ae8ffee8a2 (patch) | |
| tree | e39901ee3db17d30ea0ce1690babcd45f353d321 /tests | |
| parent | 1c556bbed4a02a914c152c96c18c04835338ba83 (diff) | |
| download | rust-8e53edb2ece6cc6ab6715fef5b3332ae8ffee8a2.tar.gz rust-8e53edb2ece6cc6ab6715fef5b3332ae8ffee8a2.zip | |
Add regression test for #118195
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rustdoc/enum-variant-fields-heading.rs | 18 | ||||
| -rw-r--r-- | tests/rustdoc/enum-variant-fields-heading.variants.html | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/rustdoc/enum-variant-fields-heading.rs b/tests/rustdoc/enum-variant-fields-heading.rs new file mode 100644 index 00000000000..8a7c99a8735 --- /dev/null +++ b/tests/rustdoc/enum-variant-fields-heading.rs @@ -0,0 +1,18 @@ +// This is a regression test for <https://github.com/rust-lang/rust/issues/118195>. +// It ensures that the "Fields" heading is not generated if no field is displayed. + +#![crate_name = "foo"] + +// @has 'foo/enum.Foo.html' +// @has - '//*[@id="variant.A"]' 'A' +// @count - '//*[@id="variant.A.fields"]' 0 +// @has - '//*[@id="variant.B"]' 'B' +// @count - '//*[@id="variant.B.fields"]' 0 +// @snapshot variants - '//*[@id="main-content"]/*[@class="variants"]' + +pub enum Foo { + /// A variant with no fields + A {}, + /// A variant with hidden fields + B { #[doc(hidden)] a: u8 }, +} diff --git a/tests/rustdoc/enum-variant-fields-heading.variants.html b/tests/rustdoc/enum-variant-fields-heading.variants.html new file mode 100644 index 00000000000..bcb36f7cf86 --- /dev/null +++ b/tests/rustdoc/enum-variant-fields-heading.variants.html @@ -0,0 +1,3 @@ +<div class="variants"><section id="variant.A" class="variant"><a href="#variant.A" class="anchor">§</a><h3 class="code-header">A</h3></section><div class="docblock"><p>A variant with no fields</p> +</div><section id="variant.B" class="variant"><a href="#variant.B" class="anchor">§</a><h3 class="code-header">B</h3></section><div class="docblock"><p>A variant with hidden fields</p> +</div></div> \ No newline at end of file |
