some progress but eh

This commit is contained in:
Ivar Fatland
2026-05-03 16:56:40 +02:00
parent 685387f77f
commit 4cf6720f2f
2 changed files with 16 additions and 15 deletions
+1 -1
View File
@@ -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(';"')
+7 -6
View File
@@ -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 = (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]