Improved javascript regex regocnizing for extracting js messages
In a JS library that I use, there was regex with a / inside a character class [a-z]. The babel JS lexer thought this closed the regex, but JavaScript allows this as a normal match character within a character class, and does not close the regex. I updated the regex so that it will cover this exception.
This could also possibly fix these issues, or set the stage for further improvements regarding these issues:
- https://github.com/python-babel/babel/issues/640
- https://github.com/python-babel/babel/issues/616
How do I add unit tests for this? I haven't found clear documentation about this.
Hi @akx, have you had time to look at this? It would be nice if this can be merged.
Hey @akx , could you please give me some guidance about how/where I should add unit tests for this? I haven't found clear documentation about this.
@akx Got it now, I wasn't familiar with tox, but now I am, a little.
I added the unit test:
https://github.com/gitaarik/babel/blob/javascript-lexer-regex-parse-fix/tests/messages/test_js_extract.py#L156-L182
I would really appreciate it if this can be merged soon and that a new release could be made. Then the build process of our project can be greatly simplified :).
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
65de3dc) 89.82% compared to head (b37389a) 89.82%.
Additional details and impacted files
@@ Coverage Diff @@
## master #791 +/- ##
=======================================
Coverage 89.82% 89.82%
=======================================
Files 25 25
Lines 4391 4391
=======================================
Hits 3944 3944
Misses 447 447
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'm not completely understanding this Codecov result, and what, if anything, is wrong.
@akx Is what you requested done now? can this be merged?