approvals / ApprovalTests.cpp

Native ApprovalTests for C++ on Linux, Mac and Windows
https://approvaltestscpp.readthedocs.io/en/latest/
Apache License 2.0
312 stars 51 forks source link

Possible templating mechanism for naming files #149

Closed claremacrae closed 3 years ago

claremacrae commented 3 years ago

Just saving some ideas we were kicking around, so they don't get lost:

{TestFileName}
{TestCaseName}
{TestSourceDirectory}
{ApprovedOrReceived}
{FileExtension}
? {BaseName} = {TestFileName}.{TestCaseName}

TemplatedCustomNamer("{TestSourceDirectory}/{ApprovedOrReceived}/{TestFileName}.{TestCaseName}.{FileExtension}")

Other ideas:

setFileName("CustomName{Approved}.txt")
setFileName((filename, testname, approved, extension) => $"")
claremacrae commented 3 years ago

This is now implemented, and is documented at: https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/Namers.md#templatedcustomnamer

It will be included in the upcoming v.10.9.0 release - later today...

Closing issue.