Skip to content

Commit 81af9da

Browse files
committed
Added test for while without parentheses
1 parent 20587d8 commit 81af9da

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

tests/cf/while01.phpt

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
--TEST--
2+
The while without parentheses
3+
--SKIPIF--
4+
<?php include(__DIR__ . '/../skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
8+
$code =<<<ZEP
9+
namespace Acme;
10+
11+
function test() {
12+
while result { }
13+
}
14+
ZEP;
15+
16+
$ir = zephir_parse_file($code, '(eval code)');
17+
18+
var_dump($ir);
19+
--EXPECT--
20+
array(2) {
21+
[0]=>
22+
array(5) {
23+
["type"]=>
24+
string(9) "namespace"
25+
["name"]=>
26+
string(4) "Acme"
27+
["file"]=>
28+
string(11) "(eval code)"
29+
["line"]=>
30+
int(3)
31+
["char"]=>
32+
int(8)
33+
}
34+
[1]=>
35+
array(6) {
36+
["type"]=>
37+
string(8) "function"
38+
["name"]=>
39+
string(4) "test"
40+
["statements"]=>
41+
array(1) {
42+
[0]=>
43+
array(5) {
44+
["type"]=>
45+
string(5) "while"
46+
["expr"]=>
47+
array(5) {
48+
["type"]=>
49+
string(8) "variable"
50+
["value"]=>
51+
string(6) "result"
52+
["file"]=>
53+
string(11) "(eval code)"
54+
["line"]=>
55+
int(4)
56+
["char"]=>
57+
int(16)
58+
}
59+
["file"]=>
60+
string(11) "(eval code)"
61+
["line"]=>
62+
int(5)
63+
["char"]=>
64+
int(1)
65+
}
66+
}
67+
["file"]=>
68+
string(11) "(eval code)"
69+
["line"]=>
70+
int(3)
71+
["char"]=>
72+
int(8)
73+
}
74+
}

0 commit comments

Comments
 (0)