mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
css parser: Show line numbers for errors.
This is a fairly major overhaul of the CSS parser to support line numbers in error messages. Basically, instead of passing "slices" of tokens around, we pass indexes into the token arrays to all of our sub-parsers, which allows them to have access to previous tokens in certain cases. This is particularly important for errors where stuff is missing (vs. being wrong). In testing this out I found a few more places to catch errors.
This commit is contained in:
@@ -193,6 +193,16 @@ class ParserTestSadPath(unittest.TestCase):
|
||||
error = 'Missing selector'
|
||||
self._assert_error(my_css, error)
|
||||
|
||||
def test_missing_value(self):
|
||||
# type: () -> None
|
||||
my_css = '''
|
||||
h1
|
||||
{
|
||||
bottom:
|
||||
}'''
|
||||
error = 'Missing value'
|
||||
self._assert_error(my_css, error)
|
||||
|
||||
def test_disallow_comments_in_selectors(self):
|
||||
# type: () -> None
|
||||
my_css = '''
|
||||
|
||||
Reference in New Issue
Block a user