Closed kytrinyx closed 6 years ago
I've reworked this to go on top of the changes that went into master this morning, and it's ready for review.
I realized that we need to fix the ordering of the maintainer config; this is done in #133. Then the final refactoring that gets rid of the ordered map is in #134.
I want to refactor the fmt command to rely on the default ordering based on Struct fields rather than the OrderedMap implementation, but I didn't trust the tests enough to make the change.
This makes a series of smaller tweaks that provide a better entry point for the tests.
The new tests run the full command passing a "root" directory. The code now allows for passing a separate "out" directory where the reformatted configs will be written. By default the out directory is the same as the in directory, but the tests override this with a temporary directory. We then read and compare the input file and the output file.
Perhaps the most important change, though, is that the tests now run whatever formatting and ordering that the
runFmt
command uses, instead of manually passing those to the formatFile function, which means that the implementation could have been quite badly wrong without our knowing it.I will do the larger refactoring to remove the ordered map implementation in a subsequent PR.