Skip to content

Commit fe88fcf

Browse files
committed
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`.
1 parent e2846a7 commit fe88fcf

3 files changed

+10
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="docblock"><p>Hello world!
2+
Goodbye!
3+
Hello again!</p>
4+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="docblock"><p>Hello world!</p>
2+
<p>Goodbye!
3+
Hello again!</p>
4+
</div>

src/test/rustdoc/mixing-doc-comments-and-attrs.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
#![crate_name = "foo"]
22

33
// @has 'foo/struct.S1.html'
4-
// @count - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p' \
5-
// 1
6-
// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[1]' \
7-
// 'Hello world! Goodbye! Hello again!'
4+
// @snapshot S1_top-doc - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]'
85

96
#[doc = "Hello world!\n\n"]
107
/// Goodbye!
118
#[doc = " Hello again!\n"]
129
pub struct S1;
1310

1411
// @has 'foo/struct.S2.html'
15-
// @count - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p' \
16-
// 2
17-
// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[1]' \
18-
// 'Hello world!'
19-
// @has - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]/p[2]' \
20-
// 'Goodbye! Hello again!'
12+
// @snapshot S2_top-doc - '//details[@class="rustdoc-toggle top-doc"]/div[@class="docblock"]'
2113

2214
/// Hello world!
2315
///

0 commit comments

Comments
 (0)