ApprovalTests.cpp
ApprovalTests.cpp copied to clipboard
When creating new approved files, of non-text types, try to make them valid empty files
Add integration with Simon Cropp's EmptyFiles tool - see https://github.com/VerifyTests/EmptyFiles#tool-usage
We would have to work out the mechanics of this.
Since we don't have an installer mechanism, there's a variety of ways that users can obtain ApprovalTests.cpp, including:
- via downloading the single header
- via any package managers
- git sub-repo or similar
- CMake's FetchContent
So I think we'll have to train users to install the EmptyFiles tool themselves... (and install dotnet - which won't be standard for pure C++ projects...)
(and install dotnet - which won't be standard for pure C++ projects...)
Simon Cropp pointed to that it's possible to make dotnet exes standalone, so the above wouldn't be needed... https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file
Idea: we could create a seam to generate empty files - and if it detects that empty-file is present, it runs it... We could make the seam, and make it pluggable, and then pick it up later...
The seam/customization point for controlling how new files are created is documented here:
https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/Writers.md#empty-files
There is a simpler seam now, that works well for individual file extensions: https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/Writers.md#customizing-by-file-extension