MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / test_powershell_this_method_call_resolves

Function test_powershell_this_method_call_resolves

tests/test_languages.py:3077–3091  ·  view source on GitHub ↗

`$this.Square(3)` inside a class method is a call to a sibling method and must link the two. The invocation parses as an `invokation_expression`, but only the bare-command form was walked, so every method call was dropped from the call graph (#3992).

(tmp_path)

Source from the content-addressed store, hash-verified

3075
3076
3077def test_powershell_this_method_call_resolves(tmp_path):
3078 """`$this.Square(3)` inside a class method is a call to a sibling method and
3079 must link the two. The invocation parses as an `invokation_expression`, but
3080 only the bare-command form was walked, so every method call was dropped from
3081 the call graph (#3992)."""
3082 f = tmp_path / "calc.ps1"
3083 f.write_text(
3084 "class Calc {\n"
3085 " [int] Square([int]$x) { return $x * $x }\n"
3086 " [int] Run() { return $this.Square(3) }\n"
3087 "}\n"
3088 )
3089 r = extract_powershell(f)
3090 assert "error" not in r
3091 assert ("Run", "Square") in _edge_labels(r, "calls")
3092
3093
3094def test_powershell_static_method_call_resolves(tmp_path):

Callers

nothing calls this directly

Calls 2

extract_powershellFunction · 0.90
_edge_labelsFunction · 0.70

Tested by

no test coverage detected