(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func TestForeachWithRef(t *testing.T) { |
| 18 | t.Helper() |
| 19 | src := `<? foreach ($a as $k => &$v) {}` |
| 20 | |
| 21 | expected := &node.Root{ |
| 22 | Position: &position.Position{ |
| 23 | StartLine: 1, |
| 24 | EndLine: 1, |
| 25 | StartPos: 3, |
| 26 | EndPos: 31, |
| 27 | }, |
| 28 | Stmts: []node.Node{ |
| 29 | &stmt.Foreach{ |
| 30 | Position: &position.Position{ |
| 31 | StartLine: 1, |
| 32 | EndLine: 1, |
| 33 | StartPos: 3, |
| 34 | EndPos: 31, |
| 35 | }, |
| 36 | Expr: &expr.Variable{ |
| 37 | Position: &position.Position{ |
| 38 | StartLine: 1, |
| 39 | EndLine: 1, |
| 40 | StartPos: 12, |
| 41 | EndPos: 14, |
| 42 | }, |
| 43 | VarName: &node.Identifier{ |
| 44 | Position: &position.Position{ |
| 45 | StartLine: 1, |
| 46 | EndLine: 1, |
| 47 | StartPos: 12, |
| 48 | EndPos: 14, |
| 49 | }, |
| 50 | Value: "a", |
| 51 | }, |
| 52 | }, |
| 53 | Key: &expr.Variable{ |
| 54 | Position: &position.Position{ |
| 55 | StartLine: 1, |
| 56 | EndLine: 1, |
| 57 | StartPos: 18, |
| 58 | EndPos: 20, |
| 59 | }, |
| 60 | VarName: &node.Identifier{ |
| 61 | Position: &position.Position{ |
| 62 | StartLine: 1, |
| 63 | EndLine: 1, |
| 64 | StartPos: 18, |
| 65 | EndPos: 20, |
| 66 | }, |
| 67 | Value: "k", |
| 68 | }, |
| 69 | }, |
| 70 | Variable: &expr.Reference{ |
| 71 | Position: &position.Position{ |
| 72 | StartLine: 1, |
| 73 | EndLine: 1, |
| 74 | StartPos: 24, |
nothing calls this directly
no test coverage detected
searching dependent graphs…