Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use platform-specific line separators #267

Merged
merged 1 commit into from
Aug 28, 2019
Merged

Conversation

albertdev
Copy link
Contributor

I noticed that when I log an assertion error created by Hamcrest that it uses a single line feed character (Unix style end-of-line). Since the rest of my log uses carriage return / line feed pairs (Windows style end-of-line) this will confuse some editors like Vim or Eclipse which generally expect a file to use the same style throughout.

Rather than hardcoding one or the other, the System.lineSeparator() function will return the end of line separator appropriate for the current runtime, i.e. "\r\n" on Windows and "\n" on Unix. This way it will adapt to the Java runtime's platform. And should for some reason a user prefer the other style, they should be able to set the line.separator property at startup.

@tumbarumba
Copy link
Member

I've just fixed a problem with TravisCI that stopped the checks running. Can you please rebase this PR?

The `System.lineSeparator()` function will return the end of line
separator appropriate for the current runtime, i.e. "\r\n" on Windows
and "\n" on Unix.
@albertdev
Copy link
Contributor Author

@tumbarumba Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants