I'd prefer to start simple and don't mix DOS, UNIX and \r line endings in these tests. test one thing at a  time: e.g. Unix-style lie endings and the possibly add complication in other code block(s) or better yet in other test case(s).

For instance, written like this, these tests fail on Windows.