Skip to content

Commit 9a68a7d

Browse files
committed
docs: Added assert_file_layout() to testing docs
1 parent af51492 commit 9a68a7d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/doc/contrib/src/tests/writing.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ test.
6464
- See [`support::compare`] for an explanation of the string pattern matching.
6565
Patterns are used to make it easier to match against the expected output.
6666

67+
#### Filesystem layout testing
68+
69+
Tests often to need to verify Cargo created/removed files.
70+
The `CargoPathExt` trait (implemented by `Path` and `PathBuf`) provides a `assert_file_layout()` to verify the files in a directory (including nested directories).
71+
This takes a snapshot of (unordered) file paths for the given directory and asserts that all files are present and no new files have been created.
72+
73+
Files vary across operating systems, for example `.pdb` files on Windows.
74+
Some of these platform specific files are ignored from snapshotting by default.
75+
You can use `assert_file_layout_with_ignored_paths()` to change the file patterns that are ignored.
76+
6777
#### Testing Nightly Features
6878

6979
If you are testing a Cargo feature that only works on "nightly" Cargo, then

0 commit comments

Comments
 (0)