Skip to content

Commit c66ea70

Browse files
committed
#120 - Add test cases for mixed type
1 parent bd500e6 commit c66ea70

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--TEST--
2+
Parameter type 'mixed'
3+
--SKIPIF--
4+
<?php include(__DIR__ . '/../skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
$code =<<<ZEP
8+
function test(mixed value) { }
9+
ZEP;
10+
11+
$ir = zephir_parse_file($code, '(eval code)');
12+
var_dump($ir);
13+
?>
14+
--EXPECT--
15+
array(1) {
16+
[0]=>
17+
array(6) {
18+
["type"]=>
19+
string(8) "function"
20+
["name"]=>
21+
string(4) "test"
22+
["parameters"]=>
23+
array(1) {
24+
[0]=>
25+
array(9) {
26+
["type"]=>
27+
string(9) "parameter"
28+
["name"]=>
29+
string(5) "value"
30+
["const"]=>
31+
int(0)
32+
["data-type"]=>
33+
string(5) "mixed"
34+
["mandatory"]=>
35+
int(0)
36+
["reference"]=>
37+
int(0)
38+
["file"]=>
39+
string(11) "(eval code)"
40+
["line"]=>
41+
int(1)
42+
["char"]=>
43+
int(27)
44+
}
45+
}
46+
["file"]=>
47+
string(11) "(eval code)"
48+
["line"]=>
49+
int(1)
50+
["char"]=>
51+
int(9)
52+
}
53+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
--TEST--
2+
Function definition with void
3+
--SKIPIF--
4+
<?php include(__DIR__ . '/../skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
$code =<<<ZEP
8+
function test() -> mixed { }
9+
ZEP;
10+
11+
$ir = zephir_parse_file($code, '(eval code)');
12+
var_dump($ir);
13+
?>
14+
--EXPECT--
15+
array(1) {
16+
[0]=>
17+
array(6) {
18+
["type"]=>
19+
string(8) "function"
20+
["name"]=>
21+
string(4) "test"
22+
["return-type"]=>
23+
array(6) {
24+
["type"]=>
25+
string(11) "return-type"
26+
["list"]=>
27+
array(1) {
28+
[0]=>
29+
array(6) {
30+
["type"]=>
31+
string(21) "return-type-parameter"
32+
["data-type"]=>
33+
string(5) "mixed"
34+
["mandatory"]=>
35+
int(0)
36+
["file"]=>
37+
string(11) "(eval code)"
38+
["line"]=>
39+
int(1)
40+
["char"]=>
41+
int(27)
42+
}
43+
}
44+
["void"]=>
45+
int(0)
46+
["file"]=>
47+
string(11) "(eval code)"
48+
["line"]=>
49+
int(1)
50+
["char"]=>
51+
int(27)
52+
}
53+
["file"]=>
54+
string(11) "(eval code)"
55+
["line"]=>
56+
int(1)
57+
["char"]=>
58+
int(9)
59+
}
60+
}

0 commit comments

Comments
 (0)