(t *testing.T)
| 189 | } |
| 190 | |
| 191 | func TestRequireOnce(t *testing.T) { |
| 192 | src := `<? require_once $a;` |
| 193 | |
| 194 | expected := &node.Root{ |
| 195 | Position: &position.Position{ |
| 196 | StartLine: 1, |
| 197 | EndLine: 1, |
| 198 | StartPos: 3, |
| 199 | EndPos: 19, |
| 200 | }, |
| 201 | Stmts: []node.Node{ |
| 202 | &stmt.Expression{ |
| 203 | Position: &position.Position{ |
| 204 | StartLine: 1, |
| 205 | EndLine: 1, |
| 206 | StartPos: 3, |
| 207 | EndPos: 19, |
| 208 | }, |
| 209 | Expr: &expr.RequireOnce{ |
| 210 | Position: &position.Position{ |
| 211 | StartLine: 1, |
| 212 | EndLine: 1, |
| 213 | StartPos: 3, |
| 214 | EndPos: 18, |
| 215 | }, |
| 216 | Expr: &expr.Variable{ |
| 217 | Position: &position.Position{ |
| 218 | StartLine: 1, |
| 219 | EndLine: 1, |
| 220 | StartPos: 16, |
| 221 | EndPos: 18, |
| 222 | }, |
| 223 | VarName: &node.Identifier{ |
| 224 | Position: &position.Position{ |
| 225 | StartLine: 1, |
| 226 | EndLine: 1, |
| 227 | StartPos: 16, |
| 228 | EndPos: 18, |
| 229 | }, |
| 230 | Value: "a", |
| 231 | }, |
| 232 | }, |
| 233 | }, |
| 234 | }, |
| 235 | }, |
| 236 | } |
| 237 | |
| 238 | php7parser := php7.NewParser([]byte(src), "7.4") |
| 239 | php7parser.Parse() |
| 240 | actual := php7parser.GetRootNode() |
| 241 | assert.DeepEqual(t, expected, actual) |
| 242 | |
| 243 | php5parser := php5.NewParser([]byte(src), "5.6") |
| 244 | php5parser.Parse() |
| 245 | actual = php5parser.GetRootNode() |
| 246 | assert.DeepEqual(t, expected, actual) |
| 247 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…