From 2e0bc33594118179bb4b3e12a86a6d74b7baed4a Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Wed, 24 Nov 2021 13:16:10 -0800 Subject: [PATCH] rustdoc: Add test for mixing doc comments and attrs This is a step toward adding more test coverage to make it easier to remove the distinction between collapsed and uncollapsed doc values. --- .../rustdoc/mixing-doc-comments-and-attrs.rs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/rustdoc/mixing-doc-comments-and-attrs.rs diff --git a/src/test/rustdoc/mixing-doc-comments-and-attrs.rs b/src/test/rustdoc/mixing-doc-comments-and-attrs.rs new file mode 100644 index 000000000000..c26d3a319878 --- /dev/null +++ b/src/test/rustdoc/mixing-doc-comments-and-attrs.rs @@ -0,0 +1,26 @@ +#![crate_name = "foo"] + +// @has 'foo/struct.S1.html' +// @count - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p' \ +// 1 +// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[1]' \ +// 'Hello world! Goodbye! Hello again!' + +#[doc = "Hello world!\n\n"] +/// Goodbye! +#[doc = " Hello again!\n"] +pub struct S1; + +// @has 'foo/struct.S2.html' +// @count - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p' \ +// 2 +// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[1]' \ +// 'Hello world!' +// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[2]' \ +// 'Goodbye! Hello again!' + +/// Hello world! +/// +#[doc = "Goodbye!"] +/// Hello again! +pub struct S2;