(t *testing.T)
| 73 | } |
| 74 | |
| 75 | func TestIncludeOnce(t *testing.T) { |
| 76 | src := `<? include_once $a;` |
| 77 | |
| 78 | expected := &node.Root{ |
| 79 | Position: &position.Position{ |
| 80 | StartLine: 1, |
| 81 | EndLine: 1, |
| 82 | StartPos: 3, |
| 83 | EndPos: 19, |
| 84 | }, |
| 85 | Stmts: []node.Node{ |
| 86 | &stmt.Expression{ |
| 87 | Position: &position.Position{ |
| 88 | StartLine: 1, |
| 89 | EndLine: 1, |
| 90 | StartPos: 3, |
| 91 | EndPos: 19, |
| 92 | }, |
| 93 | Expr: &expr.IncludeOnce{ |
| 94 | Position: &position.Position{ |
| 95 | StartLine: 1, |
| 96 | EndLine: 1, |
| 97 | StartPos: 3, |
| 98 | EndPos: 18, |
| 99 | }, |
| 100 | Expr: &expr.Variable{ |
| 101 | Position: &position.Position{ |
| 102 | StartLine: 1, |
| 103 | EndLine: 1, |
| 104 | StartPos: 16, |
| 105 | EndPos: 18, |
| 106 | }, |
| 107 | VarName: &node.Identifier{ |
| 108 | Position: &position.Position{ |
| 109 | StartLine: 1, |
| 110 | EndLine: 1, |
| 111 | StartPos: 16, |
| 112 | EndPos: 18, |
| 113 | }, |
| 114 | Value: "a", |
| 115 | }, |
| 116 | }, |
| 117 | }, |
| 118 | }, |
| 119 | }, |
| 120 | } |
| 121 | |
| 122 | php7parser := php7.NewParser([]byte(src), "7.4") |
| 123 | php7parser.Parse() |
| 124 | actual := php7parser.GetRootNode() |
| 125 | assert.DeepEqual(t, expected, actual) |
| 126 | |
| 127 | php5parser := php5.NewParser([]byte(src), "5.6") |
| 128 | php5parser.Parse() |
| 129 | actual = php5parser.GetRootNode() |
| 130 | assert.DeepEqual(t, expected, actual) |
| 131 | } |
| 132 |
nothing calls this directly
no test coverage detected
searching dependent graphs…