Skip to content

Commit 38c2d6f

Browse files
authored
Document "description" strategy (#146)
1 parent 71b1252 commit 38c2d6f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Documentation/Available-Snapshot-Strategies.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ If you'd like to submit your own custom strategy, see [Contributing](../CONTRIBU
77
## List of Available Snapshot Strategies
88

99
- [`Any`](#any)
10+
- [`.description`](#description)
1011
- [`.dump`](#dump)
1112
- [`CALayer`](#calayer)
1213
- [`.image`](#image)
@@ -44,6 +45,26 @@ If you'd like to submit your own custom strategy, see [Contributing](../CONTRIBU
4445

4546
**Platforms:** All
4647

48+
### `.description`
49+
50+
A snapshot strategy that captures a value's textual description from `String`'s `init(description:)` initializer.
51+
52+
**Format:** `String`
53+
54+
#### Example:
55+
56+
``` swift
57+
assertSnapshot(matching: user, as: .description)
58+
```
59+
60+
Records:
61+
62+
```
63+
User(bio: "Blobbed around the world.", id: 1, name: "Blobby")
64+
```
65+
66+
**See also**: [`.dump`](#dump).
67+
4768
### `.dump`
4869

4970
A snapshot strategy for comparing _any_ structure based on a sanitized text dump.
@@ -69,6 +90,8 @@ Records:
6990
- name: "Blobby"
7091
```
7192

93+
**See also**: [`.description`](#description).
94+
7295
## CALayer
7396

7497
**Platforms:** iOS, macOS, tvOS

0 commit comments

Comments
 (0)