Skip to content
Closed
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
23 changes: 23 additions & 0 deletions tests/test_kotlin_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,3 +753,26 @@ def test_kotlin_annotation_class_literal(tmp_path):
if e["relation"] == "references" and e.get("context") == "attribute"}
assert (order, customer) in attrs
assert (order, order_line) in attrs


def test_kotlin_annotation_fully_qualified_class_literal(tmp_path):
r = _extract(tmp_path, {
"Order.kt": "@Ann(target = com.example.Customer::class)\nclass Order\nclass Customer\n",
})
order = _find(r, "Order")
customer = _find(r, "Customer")
attrs = {(e["source"], e["target"]) for e in r["edges"]
if e["relation"] == "references" and e.get("context") == "attribute"}
assert (order, customer) in attrs


def test_kotlin_annotation_builtin_class_literal_is_filtered(tmp_path):
r = _extract(tmp_path, {
"Order.kt": "@Ann(target = String::class)\nclass Order\n",
})
order = _find(r, "Order")
attrs = [e for e in r["edges"] if e["source"] == order
and e["relation"] == "references" and e.get("context") == "attribute"]
annotation = _find(r, "Ann")
assert any(e["target"] == annotation for e in attrs)
assert not any(n["label"] == "String" for n in r["nodes"])
Loading