Add test cases for #582

Add test cases for removing trailing \r for Windows text file