testers.testEqualContents: add checkMetadata option

Allows ignoring file metadata differences (permissions, ownership)
when comparing files.

This is especially useful on darwin, where we often run into subtle
issues like:

    -Device: 1,23 Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ wheel)
    +Device: 1,23 Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 350/ nixbld)
This commit is contained in:
Matt Sturgeon
2025-10-17 16:09:51 +01:00
parent e62b610ac9
commit 237b3cb5ce
2 changed files with 8 additions and 1 deletions

View File

@@ -421,6 +421,11 @@ Check that two paths have the same contents.
: A message that is printed last if the file system object contents at the two paths don't match exactly.
`checkMetadata` (boolean)
: Whether to fail on metadata differences, such as permissions or ownership.
Defaults to `true`.
:::{.example #ex-testEqualContents-toyexample}
# Check that two paths have the same contents