(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestConstFetch(t *testing.T) { |
| 20 | src := `<? foo;` |
| 21 | |
| 22 | expected := &node.Root{ |
| 23 | Position: &position.Position{ |
| 24 | StartLine: 1, |
| 25 | EndLine: 1, |
| 26 | StartPos: 3, |
| 27 | EndPos: 7, |
| 28 | }, |
| 29 | Stmts: []node.Node{ |
| 30 | &stmt.Expression{ |
| 31 | Position: &position.Position{ |
| 32 | StartLine: 1, |
| 33 | EndLine: 1, |
| 34 | StartPos: 3, |
| 35 | EndPos: 7, |
| 36 | }, |
| 37 | Expr: &expr.ConstFetch{ |
| 38 | Position: &position.Position{ |
| 39 | StartLine: 1, |
| 40 | EndLine: 1, |
| 41 | StartPos: 3, |
| 42 | EndPos: 6, |
| 43 | }, |
| 44 | Constant: &name.Name{ |
| 45 | Position: &position.Position{ |
| 46 | StartLine: 1, |
| 47 | EndLine: 1, |
| 48 | StartPos: 3, |
| 49 | EndPos: 6, |
| 50 | }, |
| 51 | Parts: []node.Node{ |
| 52 | &name.NamePart{ |
| 53 | Position: &position.Position{ |
| 54 | StartLine: 1, |
| 55 | EndLine: 1, |
| 56 | StartPos: 3, |
| 57 | EndPos: 6, |
| 58 | }, |
| 59 | Value: "foo", |
| 60 | }, |
| 61 | }, |
| 62 | }, |
| 63 | }, |
| 64 | }, |
| 65 | }, |
| 66 | } |
| 67 | |
| 68 | php7parser := php7.NewParser([]byte(src), "7.4") |
| 69 | php7parser.Parse() |
| 70 | actual := php7parser.GetRootNode() |
| 71 | assert.DeepEqual(t, expected, actual) |
| 72 | |
| 73 | php5parser := php5.NewParser([]byte(src), "5.6") |
| 74 | php5parser.Parse() |
| 75 | actual = php5parser.GetRootNode() |
| 76 | assert.DeepEqual(t, expected, actual) |
nothing calls this directly
no test coverage detected
searching dependent graphs…