Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tools/test_error_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,30 @@ class Sample {

self.assertEqual([], discover(root))

def test_discovery_ignores_text_blocks_and_character_literals(self):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
source = root / "sample/src/main/java/io/teaql/Sample.java"
source.parent.mkdir(parents=True)
source.write_text(
"class Sample {\n"
' String example = """\n'
' prefix "quoted" throw new TextBlockException("TEXT_BLOCK");\n'
' """;\n'
" char quote = '\"';\n"
" void run() {\n"
' throw new RealException("REAL");\n'
" }\n"
"}\n",
encoding="utf-8",
)

results = discover(root)

self.assertEqual(1, len(results))
self.assertEqual("RealException", results[0].exception)
self.assertEqual(7, results[0].line)


if __name__ == "__main__":
unittest.main()
Loading