(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestArrayItem(t *testing.T) { |
| 60 | src := `<? array(1);` |
| 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.Array{ |
| 78 | Position: &position.Position{ |
| 79 | StartLine: 1, |
| 80 | EndLine: 1, |
| 81 | StartPos: 3, |
| 82 | EndPos: 11, |
| 83 | }, |
| 84 | Items: []node.Node{ |
| 85 | &expr.ArrayItem{ |
| 86 | Position: &position.Position{ |
| 87 | StartLine: 1, |
| 88 | EndLine: 1, |
| 89 | StartPos: 9, |
| 90 | EndPos: 10, |
| 91 | }, |
| 92 | Val: &scalar.Lnumber{ |
| 93 | Position: &position.Position{ |
| 94 | StartLine: 1, |
| 95 | EndLine: 1, |
| 96 | StartPos: 9, |
| 97 | EndPos: 10, |
| 98 | }, |
| 99 | Value: "1", |
| 100 | }, |
| 101 | }, |
| 102 | }, |
| 103 | }, |
| 104 | }, |
| 105 | }, |
| 106 | } |
| 107 | |
| 108 | php7parser := php7.NewParser([]byte(src), "7.4") |
| 109 | php7parser.Parse() |
| 110 | actual := php7parser.GetRootNode() |
| 111 | assert.DeepEqual(t, expected, actual) |
| 112 | |
| 113 | php5parser := php5.NewParser([]byte(src), "5.6") |
| 114 | php5parser.Parse() |
| 115 | actual = php5parser.GetRootNode() |
| 116 | assert.DeepEqual(t, expected, actual) |
nothing calls this directly
no test coverage detected
searching dependent graphs…