-
Notifications
You must be signed in to change notification settings - Fork 112
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
Fix tests for Windows EOL check #1236
base: master
Are you sure you want to change the base?
Conversation
@yegor256 When I run the test locally on Windows, it passes, but on Linux, it fails. In the screenshots, you can see that even the license text is parsed differently. |
@pnatashap maybe you know how to help? |
@k3p7i3 @yegor256 the reason is by default files after checkout will have os-dependent end-of-line symbol (but stored as linux styled in git). So the best variant is to change symbol in case of non-windows os (tests are run on ubuntu and mac) before run validation (so we will check all variants). also there is an option to enable test only for windows (@EnabledOnOs(WINDOWS)) |
@pnatashap Thanks for the advice! I tried to change the end-of-line symbol, but it didn't work out for some reason (at least in my local linux environment). So I used the second option. |
@yegor256 please take a look |
final String message = "Line does not match expected header line of ' *'"; | ||
final String name = "HeaderCheck"; | ||
MatcherAssert.assertThat( | ||
results, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add reason for assertThat
MatcherAssert.assertThat( | ||
results, | ||
Matchers.contains( | ||
new ViolationMatcher(message, file, "3", name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A can not match test name and validation in it:
test is about windowEndsOfLine
validation is about HeaderCheck.
Matchers.contains( | ||
new ViolationMatcher( | ||
"Expected line ending for file is LF(\\n), but CRLF(\\r\\n) is detected", | ||
file, "1", "NewlineAtEndOfFileCheck" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks strange for me, that file has 10 lines of code and we are expecting NewlineAtEndOfFileCheck at line 1
@k3p7i3 what's up with this one? we continue? |
Fixed tests for Windows EOL check.
Also, refactored CheckstyleValidatorTest a little bit to make it more flexible for tests with their own licences.
Closes: #1127