(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestYieldVal(t *testing.T) { |
| 60 | src := `<? yield $a;` |
| 61 | |
| 62 | expected := &node.Root{ |
| 63 | Position: &position.Position{ |
| 64 | StartLine: 1, |
| 65 | EndLine: 1, |
| 66 | StartPos: 3, |
| 67 | EndPos: 12, |
| 68 | }, |
| 69 | Stmts: []node.Node{ |
| 70 | &stmt.Expression{ |
| 71 | Position: &position.Position{ |
| 72 | StartLine: 1, |
| 73 | EndLine: 1, |
| 74 | StartPos: 3, |
| 75 | EndPos: 12, |
| 76 | }, |
| 77 | Expr: &expr.Yield{ |
| 78 | Position: &position.Position{ |
| 79 | StartLine: 1, |
| 80 | EndLine: 1, |
| 81 | StartPos: 3, |
| 82 | EndPos: 11, |
| 83 | }, |
| 84 | Value: &expr.Variable{ |
| 85 | Position: &position.Position{ |
| 86 | StartLine: 1, |
| 87 | EndLine: 1, |
| 88 | StartPos: 9, |
| 89 | EndPos: 11, |
| 90 | }, |
| 91 | VarName: &node.Identifier{ |
| 92 | Position: &position.Position{ |
| 93 | StartLine: 1, |
| 94 | EndLine: 1, |
| 95 | StartPos: 9, |
| 96 | EndPos: 11, |
| 97 | }, |
| 98 | Value: "a", |
| 99 | }, |
| 100 | }, |
| 101 | }, |
| 102 | }, |
| 103 | }, |
| 104 | } |
| 105 | |
| 106 | php7parser := php7.NewParser([]byte(src), "7.4") |
| 107 | php7parser.Parse() |
| 108 | actual := php7parser.GetRootNode() |
| 109 | assert.DeepEqual(t, expected, actual) |
| 110 | |
| 111 | php5parser := php5.NewParser([]byte(src), "5.6") |
| 112 | php5parser.Parse() |
| 113 | actual = php5parser.GetRootNode() |
| 114 | assert.DeepEqual(t, expected, actual) |
| 115 | } |
| 116 |
nothing calls this directly
no test coverage detected
searching dependent graphs…