summaryrefslogtreecommitdiff
path: root/tests/test_html_lexer.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix backtracking string regexes in JavascriptLexer und TypescriptLexer.Georg Brandl2020-12-171-1/+3
| | | | fixes #1637
* Increase timeout.Matthäus G. Chajdas2020-12-051-4/+4
| | | | | This should fix the tests failing on PyPy. Eventually we'll need a more robust solution for this.
* Unclosed script/style tag handling Fixes #1614 (#1615)Nick Gerner2020-12-051-0/+129
Explicitly handle unclosed <script> and <style> tags which previously would result in O(n^2) work to lex as Error tokens per character up to the end of the line or end of file (whichever comes first). Now we try lexing the rest of the line as Javascript/CSS if there's no closing script/style tag. We recover on the next line in the root state if there is a newline, otherwise just keep parsing as Javascript/CSS. This is similar to how the error handling in lexer.py works except we get Javascript or CSS tokens instead of Error tokens. And we get to the end of the line much faster since we don't apply an O(n) regex for every character in the line. I added a new test suite for html lexer (there wasn't one except for coverage in test_examplefiles.py) including a trivial happy-path case and several cases around <script> and <style> fragments, including regression coverage that fails on the old logic.