RFR: Expect carriage return to be part of lines when testing on Windows.
Erik Duveblad via github.com
duke at openjdk.java.net
Fri Aug 23 08:57:56 UTC 2019
On Fri, 23 Aug 2019 08:47:20 GMT, Jorn Vernee via github.com <duke at openjdk.java.net> wrote:
> One more patch to address failing `vcs` tests on Windows.
> The tests in `RepositoryTest` use `Files::write` to create some test files, but this also means the files will have Windows line endings (i.e. CRLF). When these are parsed by the skara tooling the LF part is dropped as a delimiter, but the CR part ends up being part of the line. This is all correct and as expected, since patch files are supposed to have unix line endings, so the carriage return ends up as part of the content.
> The problem comes when testing what is written to the file. The tests are not expecting the Windows line endings to be there, so a lot of them fail.
> This PR changes the tests to expect the Windows line endings as well. Or rather, it tries to stick what's in the system line separator (minus a trailing '\n', since that is dropped as a delimiter) at the end of the checked line.
> With this patch, I have all the `vcs` tests passing locally.
> - eec50c80: Expect carriage return to be part of lines when testing on Windows.
> Pull request:
> Fetch command:
> git fetch https://git.openjdk.java.net/skara pull/74/head:pull/74
First of all, thank so much @JornVernee for getting the `vcs` tests to pass on Windows!
Regarding your patch, what do you think about the static method `assertLinesEquals` instead of having to use `suffixPlatformLineEndings` everywhere? This way the tests reads a bit nicer, like `assertLinesEquals(List.of("Hello, readme!"), hunk.target().lines())`
More information about the skara-dev