add glob_err test
[m6w6/ext-psi] / tests / parser / validate001.phpt
index f9869a830b1231f300143926057db8c442b721e6..378db8d86cfc02c695995812279bc0b543c75c46 100644 (file)
@@ -11,7 +11,8 @@ function validate($check, $psi) {
        $file = __DIR__."/001.psi";
        file_put_contents($file, $psi);
        if ($check !== psi_validate($file)) {
-               echo "Assertion failed!\n";
+               printf("Assertion failed!\nExpected: %s\n\n%s\n\n",
+                               $check ? "true" : "false", $psi);
        }
 }
 
@@ -21,9 +22,9 @@ validate(false, "typedef long int;");
 validate(true, "typedef long foo;");
 validate(false, "typedef struct foo bar;");
 validate(true, "typedef struct {int a;} foo;");
-validate(false, "struct a; \n typedef struct a a_t;");
-validate(true, "struct a::(8,8); \n typedef struct a a_t;");
-validate(true, "typedef struct a a_t; \n struct a::(8,8);");
+validate(false, "struct a; \ntypedef struct a a_t;");
+validate(true, "struct a::(8,8); \ntypedef struct a a_t;");
+validate(true, "typedef struct a a_t; \nstruct a::(8,8);");
 
 validate(true,
 <<<PSI
@@ -72,8 +73,8 @@ validate(true, "typedef int (foo)(int bar);");
 validate(true, "typedef int (*foo)(int bar);");
 validate(true, "typedef int *(*foo)(int bar);");
 validate(false, "typedef int *(*foo)(int *(*bar)(int baz));");
-validate(true, "typedef int *(*bar)(int baz); \n typedef int *(*foo)(bar bar);");
-validate(false, "typedef int bar(int baz); \n typedef int *(*foo)(bar bar);");
+validate(true, "typedef int *(*bar)(int baz); \ntypedef int *(*foo)(bar bar);");
+validate(true, "typedef int bar(int baz); \ntypedef int *(*foo)(bar bar);");
 
 ?>
 ===DONE===
@@ -84,9 +85,9 @@ validate(false, "typedef int bar(int baz); \n typedef int *(*foo)(bar bar);");
 --EXPECTF--
 ===TEST===
 
-Warning: PSI syntax error: Unexpected token ';' in %s001.psi on line 1
+Warning: PSI syntax error: Unexpected token ';' at pos 17 in %s001.psi on line 1
 
-Warning: PSI syntax error: Unexpected token 'int' in %s001.psi on line 1
+Warning: PSI syntax error: Unexpected token 'int' at pos 14 in %s001.psi on line 1
 
 Warning: Type 'bar' cannot be aliased to struct 'foo' in %s001.psi on line 1
 
@@ -94,5 +95,5 @@ Warning: Cannot compute size of empty struct 'a' in %s001.psi on line 1
 
 Warning: Unknown variable 'X' in numeric expression in %s001.psi on line 4
 
-Warning: PSI syntax error: Unexpected token '(' in %s001.psi on line 1
+Warning: PSI syntax error: Unexpected token '(' at pos 26 in %s001.psi on line 1
 ===DONE===