(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func TestArray(t *testing.T) { |
| 18 | src := `<? array();` |
| 19 | |
| 20 | expected := &node.Root{ |
| 21 | Position: &position.Position{ |
| 22 | StartLine: 1, |
| 23 | EndLine: 1, |
| 24 | StartPos: 3, |
| 25 | EndPos: 11, |
| 26 | }, |
| 27 | Stmts: []node.Node{ |
| 28 | &stmt.Expression{ |
| 29 | Position: &position.Position{ |
| 30 | StartLine: 1, |
| 31 | EndLine: 1, |
| 32 | StartPos: 3, |
| 33 | EndPos: 11, |
| 34 | }, |
| 35 | Expr: &expr.Array{ |
| 36 | Position: &position.Position{ |
| 37 | StartLine: 1, |
| 38 | EndLine: 1, |
| 39 | StartPos: 3, |
| 40 | EndPos: 10, |
| 41 | }, |
| 42 | Items: []node.Node{}, |
| 43 | }, |
| 44 | }, |
| 45 | }, |
| 46 | } |
| 47 | |
| 48 | php7parser := php7.NewParser([]byte(src), "7.4") |
| 49 | php7parser.Parse() |
| 50 | actual := php7parser.GetRootNode() |
| 51 | assert.DeepEqual(t, expected, actual) |
| 52 | |
| 53 | php5parser := php5.NewParser([]byte(src), "5.6") |
| 54 | php5parser.Parse() |
| 55 | actual = php5parser.GetRootNode() |
| 56 | assert.DeepEqual(t, expected, actual) |
| 57 | } |
| 58 | |
| 59 | func TestArrayItem(t *testing.T) { |
| 60 | src := `<? array(1);` |
nothing calls this directly
no test coverage detected
searching dependent graphs…