MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestArray

Function TestArray

node/expr/t_array_test.go:17–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func 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
59func TestArrayItem(t *testing.T) {
60 src := `<? array(1);`

Callers

nothing calls this directly

Calls 4

ParseMethod · 0.95
GetRootNodeMethod · 0.95
NewParserFunction · 0.92
NewParserFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…