PHP 8 compatibility
[m6w6/ext-psi] / tests / parser / validate001.phpt
1 --TEST--
2 validate types
3 --FILE--
4 ===TEST===
5 <?php
6
7 function validate($check, $psi) {
8 if ($check !== psi_validate_string($psi)) {
9 printf("Assertion failed!\nExpected: %s\n\n%s\n\n",
10 $check ? "true" : "false", $psi);
11 }
12 }
13
14 validate(true, "typedef void *bar;");
15 validate(true, "typedef long foo;");
16 validate(true, "typedef struct foo bar;");
17 validate(true, "typedef struct {int a;} foo;");
18 validate(true, "struct a::(8,8); \ntypedef struct a a_t;");
19 validate(true, "typedef struct a a_t; \nstruct a::(8,8);");
20
21 validate(true,
22 <<<PSI
23 enum {
24 A,
25 B,
26 C
27 }
28 PSI
29 );
30
31 validate(true, "typedef int foo(int bar);");
32 validate(true, "typedef int (foo)(int bar);");
33 validate(true, "typedef int (*foo)(int bar);");
34 validate(true, "typedef int *(*foo)(int bar);");
35 validate(true, "typedef int *(*bar)(int baz); \ntypedef int *(*foo)(bar bar);");
36 validate(true, "typedef int bar(int baz); \ntypedef int *(*foo)(bar bar);");
37
38 ?>
39 ===DONE===
40 --EXPECTF--
41 ===TEST===
42 ===DONE===