Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Jan 14, 2025
1 parent 3c14430 commit 1c2e81e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/mdsource/verify-directory.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@ snippet: VerifyDirectoryWithInfoXunitV3

snippet: VerifyDirectoryWithFileScrubberXunitV3

This applies to files where the extensions is a known text file as defined by [FileExtensions.IsText](https://github.com/VerifyTests/EmptyFiles#istext).
This applies to files where the extensions is a known text file as defined by [FileExtensions.IsText](https://github.com/VerifyTests/EmptyFiles#istext).


## Files with no extension

Any files in the target directory that have no extension will have `.noextension` added to the resulting `.verified` file. This is to avoid `.verified` being treated as the extension of that file.

These files are treated as unknown binaries by default. Given the lack of an extension, no diff tool will be launched.

Files with no extension can optionally be treated as text, with the associated diff tool being launched. This is done by using the [AddTextFileConvention](https://github.com/VerifyTests/EmptyFiles?tab=readme-ov-file#addtextfileconvention) of EmptyFiles:

snippet: AddTextFileConvention
24 changes: 24 additions & 0 deletions docs/verify-directory.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,27 @@ public Task VerifyDirectoryWithFileScrubber() =>
<!-- endSnippet -->

This applies to files where the extensions is a known text file as defined by [FileExtensions.IsText](https://github.com/VerifyTests/EmptyFiles#istext).


## Files with no extension

Any files in the target directory that have no extension will have `.noextension` added to the resulting `.verified` file. This is to avoid `.verified` being treated as the extension of that file.

These files are treated as unknown binaries by default. Given the lack of an extension, no diff tool will be launched.

Files with no extension can optionally be treated as text, with the associated diff tool being launched. This is done by using the [AddTextFileConvention](https://github.com/VerifyTests/EmptyFiles?tab=readme-ov-file#addtextfileconvention) of EmptyFiles:

<!-- snippet: AddTextFileConvention -->
<a id='snippet-AddTextFileConvention'></a>
```cs
[ModuleInitializer]
public static void InitTextFileConvention() =>
FileExtensions.AddTextFileConvention(
path =>
{
var name = Path.GetFileName(path);
return name.Equals("TextDocWithoutExtension", StringComparison.OrdinalIgnoreCase);
});
```
<sup><a href='/src/Verify.Tests/VerifyDirectoryTests.cs#L6-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddTextFileConvention' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

0 comments on commit 1c2e81e

Please sign in to comment.