-
Notifications
You must be signed in to change notification settings - Fork 509
Attempt to fix seemingly test-related bug on Windows #175
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
Conversation
|
I don't like the If the formatter is producing I think the appropriate fix is for |
Okey dokey, I've reverted the corresponding changes. :)
Hmm, I wonder if I've misunderstood you somewhere, because when I revert my initial commit and change Do you have any further thoughts on this? |
|
You can normalize line endings with abandon in step tests, because Formatter does that for you when the steps are actually being used. Ideally, the test infrastructure does this automatically (e.g. StepHarness). If something is being tested outside the infrastructure, that's fine. If slapping a |
|
I'm very sorry @nedtwigg, for some reason I'm struggling to understand what you're saying. Would you mind rewording things for me? Just FYI, I'm attempting to refactor the SQL tests ATM to use |
Actually, never mind. It's not the right time of day for me to tackle this, as it's pretty late in the evening where I live, so I'll tackle this another day. :) |
|
Have a look at #180 - all tests pass on windows in that PR. |
|
Wow, looks very good to me @nedtwigg. Many thanks for having a go at it. :) I'll close this PR then, as I believe it's outdated now. |
When
ResourceHarness.assertFileContentsis run on the DBeaver SQL formatter tests, it causes the tests to fail on Windows. This is because the files formatted by the DBeaver SQL formatter end up with CRLF line endings, whereas they're expected to have LF line endings.However, I could not for the life of me figure out how to change the formatter itself to produce the correct line endings. So I experimented with AssertJ's assertions and discovered that the tests pass on Windows when
Assertions.assertThat(actualFile).withCharset(UTF_8).hasContent(expectedContents)is used instead ofResourceHarness.assertFileContents's old implementation.It's not clear to me if the bug is in
ResourceHarness.assertFileContents, AssertJ or in the SQL formatter. However, I've made an educated guess that, if the bug is in the tests and not in the SQL formatter, then it's more likely to be inResourceHarness.assertFileContentsthan AssertJ, considering that AssertJ is more thoroughly tested than our own test helpers. Considering this and that the tests start passing on my Windows machine again when AssertJ was used, I think it's probably a bug withassertFileContents's old impl.I also took the liberty of renaming one of our test helpers,
ResourceHarness.assertFile, toassertThatNewFileto make it a bit clearer what happens when an assertion is chained off it.