some progress but eh
This commit is contained in:
@@ -28,7 +28,7 @@ class Tags:
|
||||
def _update_cache(self):
|
||||
self._cache = {}
|
||||
with self.TAGS_PATH.open('r') as f:
|
||||
lines = (l for l in f.readlines() if not l.startswith('!_'))
|
||||
lines = (l for l in f.readlines() if not l.startswith('!_') and not l.startswith('__anon'))
|
||||
for line in lines:
|
||||
symbol, file, location, type, *_ = line.split('\t')
|
||||
location = location.removesuffix(';"')
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
from ctags_ls.tags import Tags
|
||||
from ctags_ls.tags import Tag, Tags
|
||||
import pytest
|
||||
|
||||
|
||||
# TODO: generate the tags file dynamically as preperation to the test.
|
||||
def test_parsing():
|
||||
tags_path = Path(__file__).parent.resolve() / 'tags'
|
||||
tags = Tags(tags_path=tags_path)
|
||||
for tags in tags.symbols.values():
|
||||
for tag in tags:
|
||||
tags_path = Path(__file__).parent.resolve() / 'tags'
|
||||
tags = (tag for tags in Tags(tags_path=tags_path).symbols.values() for tag in tags)
|
||||
|
||||
@pytest.mark.parametrize("tag", tags)
|
||||
def test_tag(tag: Tag):
|
||||
assert len(tag.type) == 1
|
||||
assert tag.file.is_file()
|
||||
text = tag.file.read_text()
|
||||
@@ -17,3 +17,4 @@ def test_parsing():
|
||||
assert next(tag.location.finditer(text), None) is not None, f'{tag.location.pattern} has no matches in {tag.file}'
|
||||
else:
|
||||
assert text.count('\n') >= tag.location
|
||||
assert tag.symbol in text.splitlines()[tag.location-1]
|
||||
|
||||
Reference in New Issue
Block a user