To make sure it is equaly handled in all working copies,
which is relevant for the test data later on.
Move test_utils module into the route to allow usage also in other tests
and to have all this similar functions (iteration over files
in a directory) in the same module to share code between them.
Extract one helper function form existing test to avoid duplicated code.
New helper function allows to use proper typed variable
for charsets from the file name.
Currently failing for UTF-16 at the Euro-sign (€) fix in next commit.
Wrong direction of the bit shift leads to 0x00 for the higher byte.
Refactor some function in the test_utils to avoid duplicated code
for the function for the end_of_line tests.
A seperate function increases the testability of the code.
Currently failing with CRLF on CRLF-LF.md, becauce check still found
errors afterwards. Fix in next commit.
Previous implementation could not find the error, which was found
by the Integration Test for the fix command. It does not performe
any checks, as the single chars inside the strings were not extracted
correctly. Now, it works on the chars and consider the different cases
of how the line endings can be replaced.
Test fails for the previous implementation because it replace the CR
or the LF inside CRLF when CRLF is the expected end of line.
Run the REUSE commands in the current working directory and
do not cd to the diretory of the justfile.
All methods to access the test files in a struct TestFileHelper,
which holds the name of the subdirectory with the requested test fields.
Currently, create the struct only from EditorConfig Property,
but later maybe also from other sources like a general string.
Use the TestFileHelper to reduce the number of parameter for helper
function and load the test_utils module for the Integration Tests
on a central place (only one place with the file path).
As each Integration Test module is its own crate, not every crate uses
every helper function (e.g., the charset.rs have no need
for the functions in the end_of_line module in test_utils).
This unused states in this separate crates lead to warnings
which can be ignored as the code is used from some other crate.
Assert equal on the list of expect and detected files with errors
to detect also if too much files with errors were found.
Furthermore, a panic message would now contain the whole list of
expected and detected files.
Only some small parts extracted to keep flexibility for test specific
code if necessary for further tests.
The helper function for the handler structs are only used in them.
Therefore, it seems more logical to me to have them as private function
/ methods inside the structs.