Description
I was just reviewing my testscripts and noticed that one of them had a duplicate file:
# test ...
exec command
-- filename --
# contents of filename
-- some/other/file --
# contents of some/other/file
-- filename --
# different contents of filename --
testscript did not warn about the duplication, and the duplication was not easy to spot as the files were out of order. If the files had been in order the duplicate files would have been easier to spot. Long story short, I ended up writing a very simple txtar linter and formater in twpayne/chezmoi#2387.
Rather than adding a formatter and linter to testscript, I propose to add a mechanism similar to #164 and add two extra parameters:
RequireUniqueFilenames bool
, default false
, which will return an error if there are any duplicate filenames in the txtar archive.
RequiredSortedFilenames bool
, default false
, which will return an error if the files in the txtar archive are not in order.
This should maintain backward compatibility while also effectively adding optional opt-in linting capabilities.
Is this of interest? Would you accept a PR that implements this?