22 lines
640 B
Python
22 lines
640 B
Python
import re
|
|
|
|
# Test the exact regex from todo_finder.py
|
|
pattern = re.compile(r'(?:#|//|/\*\*|\*/)\s*TODO[:\s]*(.*?)(?:\n|$)')
|
|
|
|
test_lines = [
|
|
"# TODO: Implement this feature\n",
|
|
"# FIXME: Need to handle edge case\n",
|
|
"# TODO @alex: Review this logic\n",
|
|
"# This has a TODO in a string that shouldn't match\n",
|
|
"some_string = \"TODO not a real comment\"\n",
|
|
"# XXX: Hacky workaround, remove later\n",
|
|
"# HACK: Quick fix for demo\n",
|
|
]
|
|
|
|
for line in test_lines:
|
|
m = pattern.search(line)
|
|
print(f"Line: {line[:40]!r}")
|
|
print(f" Match: {m}")
|
|
if m:
|
|
print(f" Content: {m.group(1)!r}")
|
|
print() |