end_of_file_fixer: detect line ending

Instead of writing \n we try to detect the line ending used in the file.
We use the first line ending sequence we find.
This commit is contained in:
Bernhard Walle 2023-04-19 11:29:31 +02:00
parent b0f11fe246
commit 336f2ed6d1
2 changed files with 26 additions and 2 deletions

View file

@ -21,6 +21,9 @@ TESTS = (
(b'foo\r\n\r\n\r\n', 1, b'foo\r\n'),
(b'foo\r', 0, b'foo\r'),
(b'foo\r\r\r\r', 1, b'foo\r'),
(b'foo\r\nbar', 1, b'foo\r\nbar\r\n'),
(b'foo\nbar', 1, b'foo\nbar\n'),
(b'foo\rbar', 1, b'foo\rbar\r'),
)