I added a PR to make this test platform independent https://github.com/hibernate/hibernate-orm/pull/802
Note that this is effectively reverting the change in my PR above. I don't think either one of us is exactly right, but the problem is a bit more complex. Jocki's comment above sounds right to me.
The problem is that git has a config option to checkout LFs as CRLFs and check in CRLFs as LFs. This is supposed to make things easier on Windows, but TBH I think it just makes things more confusing (like this ticket) and don't use it. Every text editor on Windows (apart from Notepad) is capable of dealing with Unix-style line endings. IDEs like IntelliJ won't convert LFs to CRLFs on save unless you ask it to (it will use Windows-style line endings by default when creating new files, which is one to watch out for).
So the problem here isn't really inconsistency between Unix and Windows (which is what both my PR and Cody's are attempting to fix) but inconsistencies between different developers' setups on Windows. I think the correct fix is to tell git not to mangle the file endings for this text fixture (as suggested in Jocki's comment above) and make the expecting string in the test match the contents of the fixture (as in my PR). The alternative would be to change the test to match either kind of newline (e.g. using a regex) but I think that's less desirable. In any case, neither hardcoding the test to use Unix-style linefeeds nor making it use environment-specific new lines will make it work on all Windows environments.
Cheers, Harry
|