MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestVariableVariable

Function TestVariableVariable

node/expr/t_variable_test.go:67–123  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestVariableVariable(t *testing.T) {
68 src := `<? $$a;`
69
70 expected := &node.Root{
71 Position: &position.Position{
72 StartLine: 1,
73 EndLine: 1,
74 StartPos: 3,
75 EndPos: 7,
76 },
77 Stmts: []node.Node{
78 &stmt.Expression{
79 Position: &position.Position{
80 StartLine: 1,
81 EndLine: 1,
82 StartPos: 3,
83 EndPos: 7,
84 },
85 Expr: &expr.Variable{
86 Position: &position.Position{
87 StartLine: 1,
88 EndLine: 1,
89 StartPos: 3,
90 EndPos: 6,
91 },
92 VarName: &expr.Variable{
93 Position: &position.Position{
94 StartLine: 1,
95 EndLine: 1,
96 StartPos: 4,
97 EndPos: 6,
98 },
99 VarName: &node.Identifier{
100 Position: &position.Position{
101 StartLine: 1,
102 EndLine: 1,
103 StartPos: 4,
104 EndPos: 6,
105 },
106 Value: "a",
107 },
108 },
109 },
110 },
111 },
112 }
113
114 php7parser := php7.NewParser([]byte(src), "7.4")
115 php7parser.Parse()
116 actual := php7parser.GetRootNode()
117 assert.DeepEqual(t, expected, actual)
118
119 php5parser := php5.NewParser([]byte(src), "5.6")
120 php5parser.Parse()
121 actual = php5parser.GetRootNode()
122 assert.DeepEqual(t, expected, actual)
123}

Callers

nothing calls this directly

Calls 4

ParseMethod · 0.95
GetRootNodeMethod · 0.95
NewParserFunction · 0.92
NewParserFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…