Skip to content

Commit 1c2e81e

Browse files
committed
docs
1 parent 3c14430 commit 1c2e81e

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

docs/mdsource/verify-directory.source.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,15 @@ snippet: VerifyDirectoryWithInfoXunitV3
2323

2424
snippet: VerifyDirectoryWithFileScrubberXunitV3
2525

26-
This applies to files where the extensions is a known text file as defined by [FileExtensions.IsText](https://github.com/VerifyTests/EmptyFiles#istext).
26+
This applies to files where the extensions is a known text file as defined by [FileExtensions.IsText](https://github.com/VerifyTests/EmptyFiles#istext).
27+
28+
29+
## Files with no extension
30+
31+
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.
32+
33+
These files are treated as unknown binaries by default. Given the lack of an extension, no diff tool will be launched.
34+
35+
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:
36+
37+
snippet: AddTextFileConvention

docs/verify-directory.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,27 @@ public Task VerifyDirectoryWithFileScrubber() =>
8181
<!-- endSnippet -->
8282

8383
This applies to files where the extensions is a known text file as defined by [FileExtensions.IsText](https://github.com/VerifyTests/EmptyFiles#istext).
84+
85+
86+
## Files with no extension
87+
88+
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.
89+
90+
These files are treated as unknown binaries by default. Given the lack of an extension, no diff tool will be launched.
91+
92+
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:
93+
94+
<!-- snippet: AddTextFileConvention -->
95+
<a id='snippet-AddTextFileConvention'></a>
96+
```cs
97+
[ModuleInitializer]
98+
public static void InitTextFileConvention() =>
99+
FileExtensions.AddTextFileConvention(
100+
path =>
101+
{
102+
var name = Path.GetFileName(path);
103+
return name.Equals("TextDocWithoutExtension", StringComparison.OrdinalIgnoreCase);
104+
});
105+
```
106+
<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>
107+
<!-- endSnippet -->

0 commit comments

Comments
 (0)