maint: improve new line detection so tests pass on windows and unix