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

[JENKINS-71810] Token Macro tests fail on Java 21 #191

Merged
merged 1 commit into from Aug 11, 2023

Conversation

basil
Copy link
Member

@basil basil commented Aug 11, 2023

See JENKINS-71810. Java 21 changed the date format to use a narrow no-break space, so the regular expression used in the tests now fails to match. Changed the test to use the \h character class, which matches

A horizontal whitespace character: [ \t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]

Testing done

Ran the tests on Java 11, 17, and 21. Before this PR, Java 21 failed. After this PR, all Java versions are passing.

Bonus

While I was here, I updated the test to use Hamcrest matchers for a more readable error message if the test fails.

@basil basil requested a review from slide August 11, 2023 19:01
@slide slide merged commit f35bf26 into jenkinsci:main Aug 11, 2023
16 checks passed
@basil basil deleted the JENKINS-71810 branch August 11, 2023 21:29
MarkEWaite added a commit to MarkEWaite/schedule-build-plugin that referenced this pull request Aug 12, 2023
Java 21 changed the date format to use a narrow no-break space, so the
regular expression used in the tests now fails to match. Changed the
test to use the '\h' character class, which matches.

jenkinsci/token-macro-plugin#191 uses the same
technique to handle test compatibility between Java 11, Java 17, and
Java 21.
MarkEWaite added a commit to jenkinsci/schedule-build-plugin that referenced this pull request Aug 13, 2023
Java 21 changed the date format to use a narrow no-break space, so the
regular expression used in the tests now fails to match. Changed the
test to use the '\h' character class, which matches.

jenkinsci/token-macro-plugin#191 uses the same
technique to handle test compatibility between Java 11, Java 17, and
Java 21.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants