Skip to content

Commit

Permalink
rustdoc: Add test for mixing doc comments and attrs
Browse files Browse the repository at this point in the history
This is a step toward adding more test coverage to make it easier to
remove the distinction between collapsed and uncollapsed doc values.
  • Loading branch information
camelid committed Nov 24, 2021
1 parent 8a48b37 commit 2e0bc33
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/test/rustdoc/mixing-doc-comments-and-attrs.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 2e0bc33

Please sign in to comment.