(t *testing.T)
| 131 | } |
| 132 | |
| 133 | func TestRequire(t *testing.T) { |
| 134 | src := `<? require $a;` |
| 135 | |
| 136 | expected := &node.Root{ |
| 137 | Position: &position.Position{ |
| 138 | StartLine: 1, |
| 139 | EndLine: 1, |
| 140 | StartPos: 3, |
| 141 | EndPos: 14, |
| 142 | }, |
| 143 | Stmts: []node.Node{ |
| 144 | &stmt.Expression{ |
| 145 | Position: &position.Position{ |
| 146 | StartLine: 1, |
| 147 | EndLine: 1, |
| 148 | StartPos: 3, |
| 149 | EndPos: 14, |
| 150 | }, |
| 151 | Expr: &expr.Require{ |
| 152 | Position: &position.Position{ |
| 153 | StartLine: 1, |
| 154 | EndLine: 1, |
| 155 | StartPos: 3, |
| 156 | EndPos: 13, |
| 157 | }, |
| 158 | Expr: &expr.Variable{ |
| 159 | Position: &position.Position{ |
| 160 | StartLine: 1, |
| 161 | EndLine: 1, |
| 162 | StartPos: 11, |
| 163 | EndPos: 13, |
| 164 | }, |
| 165 | VarName: &node.Identifier{ |
| 166 | Position: &position.Position{ |
| 167 | StartLine: 1, |
| 168 | EndLine: 1, |
| 169 | StartPos: 11, |
| 170 | EndPos: 13, |
| 171 | }, |
| 172 | Value: "a", |
| 173 | }, |
| 174 | }, |
| 175 | }, |
| 176 | }, |
| 177 | }, |
| 178 | } |
| 179 | |
| 180 | php7parser := php7.NewParser([]byte(src), "7.4") |
| 181 | php7parser.Parse() |
| 182 | actual := php7parser.GetRootNode() |
| 183 | assert.DeepEqual(t, expected, actual) |
| 184 | |
| 185 | php5parser := php5.NewParser([]byte(src), "5.6") |
| 186 | php5parser.Parse() |
| 187 | actual = php5parser.GetRootNode() |
| 188 | assert.DeepEqual(t, expected, actual) |
| 189 | } |
| 190 |
nothing calls this directly
no test coverage detected
searching dependent graphs…