From fe88fcfa3909219ab537a6de9213a48fffcce75e Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Wed, 24 Nov 2021 19:35:18 -0800 Subject: [PATCH] Migrate a test to use `@snapshot` I'd been thinking about implementing snapshot testing for a while, but This test is what finally made me do it. It really benefits from using snapshot testing, so it's a good initial place to use `@snapshot`. --- .../mixing-doc-comments-and-attrs.S1_top-doc.html | 4 ++++ .../mixing-doc-comments-and-attrs.S2_top-doc.html | 4 ++++ src/test/rustdoc/mixing-doc-comments-and-attrs.rs | 12 ++---------- 3 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 src/test/rustdoc/mixing-doc-comments-and-attrs.S1_top-doc.html create mode 100644 src/test/rustdoc/mixing-doc-comments-and-attrs.S2_top-doc.html diff --git a/src/test/rustdoc/mixing-doc-comments-and-attrs.S1_top-doc.html b/src/test/rustdoc/mixing-doc-comments-and-attrs.S1_top-doc.html new file mode 100644 index 00000000000..69d647a92e8 --- /dev/null +++ b/src/test/rustdoc/mixing-doc-comments-and-attrs.S1_top-doc.html @@ -0,0 +1,4 @@ +

Hello world! +Goodbye! +Hello again!

+
\ No newline at end of file diff --git a/src/test/rustdoc/mixing-doc-comments-and-attrs.S2_top-doc.html b/src/test/rustdoc/mixing-doc-comments-and-attrs.S2_top-doc.html new file mode 100644 index 00000000000..8ff114b993e --- /dev/null +++ b/src/test/rustdoc/mixing-doc-comments-and-attrs.S2_top-doc.html @@ -0,0 +1,4 @@ +

Hello world!

+

Goodbye! +Hello again!

+
\ No newline at end of file diff --git a/src/test/rustdoc/mixing-doc-comments-and-attrs.rs b/src/test/rustdoc/mixing-doc-comments-and-attrs.rs index c26d3a31987..1aedd4d107c 100644 --- a/src/test/rustdoc/mixing-doc-comments-and-attrs.rs +++ b/src/test/rustdoc/mixing-doc-comments-and-attrs.rs @@ -1,10 +1,7 @@ #![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!' +// @snapshot S1_top-doc - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]' #[doc = "Hello world!\n\n"] /// Goodbye! @@ -12,12 +9,7 @@ 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!' +// @snapshot S2_top-doc - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]' /// Hello world! ///