Skip to content

Commit 2ad62b9

Browse files
committed
add a couple more if clause tests
1 parent e3e92ff commit 2ad62b9

File tree

4 files changed

+267
-0
lines changed

4 files changed

+267
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
if ($awesome) :
4+
;
5+
;
6+
elseif ($awesome) :
7+
;
8+
elseif ($a) {
9+
;
10+
}
11+
12+
endif;
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{
2+
"SourceFileNode": {
3+
"scriptSectionList": [
4+
{
5+
"ScriptSection": {
6+
"text": {
7+
"kind": "ScriptSectionPrependedText",
8+
"textLength": 0
9+
},
10+
"startTag": {
11+
"kind": "ScriptSectionStartTag",
12+
"textLength": 6
13+
},
14+
"statementList": [
15+
{
16+
"IfStatementNode": {
17+
"ifKeyword": {
18+
"kind": "IfKeyword",
19+
"textLength": 2
20+
},
21+
"openParen": {
22+
"kind": "OpenParenToken",
23+
"textLength": 1
24+
},
25+
"expression": {
26+
"Expression": {
27+
"children": [
28+
{
29+
"kind": "VariableName",
30+
"textLength": 8
31+
}
32+
]
33+
}
34+
},
35+
"closeParen": {
36+
"kind": "CloseParenToken",
37+
"textLength": 1
38+
},
39+
"colon": {
40+
"kind": "ColonToken",
41+
"textLength": 1
42+
},
43+
"statements": [
44+
{
45+
"EmptyStatement": {
46+
"children": [
47+
{
48+
"kind": "SemicolonToken",
49+
"textLength": 1
50+
}
51+
]
52+
}
53+
},
54+
{
55+
"EmptyStatement": {
56+
"children": [
57+
{
58+
"kind": "SemicolonToken",
59+
"textLength": 1
60+
}
61+
]
62+
}
63+
}
64+
],
65+
"elseIfClauses": [
66+
{
67+
"ElseIfClauseNode": {
68+
"elseIfKeyword": [
69+
{
70+
"kind": "ElseIfKeyword",
71+
"textLength": 6
72+
}
73+
],
74+
"openParen": {
75+
"kind": "OpenParenToken",
76+
"textLength": 1
77+
},
78+
"expression": {
79+
"Expression": {
80+
"children": [
81+
{
82+
"kind": "VariableName",
83+
"textLength": 8
84+
}
85+
]
86+
}
87+
},
88+
"closeParen": {
89+
"kind": "CloseParenToken",
90+
"textLength": 1
91+
},
92+
"colon": {
93+
"kind": "ColonToken",
94+
"textLength": 1
95+
},
96+
"statements": [
97+
{
98+
"EmptyStatement": {
99+
"children": [
100+
{
101+
"kind": "SemicolonToken",
102+
"textLength": 1
103+
}
104+
]
105+
}
106+
}
107+
]
108+
}
109+
},
110+
{
111+
"ElseIfClauseNode": {
112+
"elseIfKeyword": [
113+
{
114+
"kind": "ElseIfKeyword",
115+
"textLength": 6
116+
}
117+
],
118+
"openParen": {
119+
"kind": "OpenParenToken",
120+
"textLength": 1
121+
},
122+
"expression": {
123+
"Expression": {
124+
"children": [
125+
{
126+
"kind": "VariableName",
127+
"textLength": 2
128+
}
129+
]
130+
}
131+
},
132+
"closeParen": {
133+
"kind": "CloseParenToken",
134+
"textLength": 1
135+
},
136+
"colon": null,
137+
"statements": {
138+
"CompoundStatementNode": {
139+
"children": [
140+
{
141+
"kind": "OpenBraceToken",
142+
"textLength": 1
143+
},
144+
{
145+
"EmptyStatement": {
146+
"children": [
147+
{
148+
"kind": "SemicolonToken",
149+
"textLength": 1
150+
}
151+
]
152+
}
153+
},
154+
{
155+
"kind": "CloseBraceToken",
156+
"textLength": 1
157+
}
158+
]
159+
}
160+
}
161+
}
162+
}
163+
],
164+
"elseClause": null,
165+
"endifKeyword": {
166+
"kind": "EndIfKeyword",
167+
"textLength": 5
168+
},
169+
"semicolon": {
170+
"kind": "SemicolonToken",
171+
"textLength": 1
172+
}
173+
}
174+
}
175+
],
176+
"endTag": null
177+
}
178+
}
179+
],
180+
"endOfFileToken": {
181+
"kind": "EndOfFileToken",
182+
"textLength": 0
183+
}
184+
}
185+
}

tests/cases/parser/ifStatement2_5.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
if ($awesome) :
4+
endif;
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"SourceFileNode": {
3+
"scriptSectionList": [
4+
{
5+
"ScriptSection": {
6+
"text": {
7+
"kind": "ScriptSectionPrependedText",
8+
"textLength": 0
9+
},
10+
"startTag": {
11+
"kind": "ScriptSectionStartTag",
12+
"textLength": 6
13+
},
14+
"statementList": [
15+
{
16+
"IfStatementNode": {
17+
"ifKeyword": {
18+
"kind": "IfKeyword",
19+
"textLength": 2
20+
},
21+
"openParen": {
22+
"kind": "OpenParenToken",
23+
"textLength": 1
24+
},
25+
"expression": {
26+
"Expression": {
27+
"children": [
28+
{
29+
"kind": "VariableName",
30+
"textLength": 8
31+
}
32+
]
33+
}
34+
},
35+
"closeParen": {
36+
"kind": "CloseParenToken",
37+
"textLength": 1
38+
},
39+
"colon": {
40+
"kind": "ColonToken",
41+
"textLength": 1
42+
},
43+
"statements": [],
44+
"elseIfClauses": [],
45+
"elseClause": null,
46+
"endifKeyword": {
47+
"kind": "EndIfKeyword",
48+
"textLength": 5
49+
},
50+
"semicolon": {
51+
"kind": "SemicolonToken",
52+
"textLength": 1
53+
}
54+
}
55+
}
56+
],
57+
"endTag": null
58+
}
59+
}
60+
],
61+
"endOfFileToken": {
62+
"kind": "EndOfFileToken",
63+
"textLength": 0
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)