fix leak
[m6w6/ext-psi] / tests / parser / validate007.phpt
diff --git a/tests/parser/validate007.phpt b/tests/parser/validate007.phpt
new file mode 100644 (file)
index 0000000..8c49b7c
--- /dev/null
@@ -0,0 +1,45 @@
+--TEST--
+validate types
+--SKIPIF--
+<?php 
+extension_loaded("psi") or die("skip - need ext/psi");
+?>
+--FILE--
+===TEST===
+<?php 
+
+function validate($check, $psi) {
+       if ($check !== psi_validate_string($psi)) {
+               printf("Assertion failed!\nExpected: %s\n\n%s\n\n",
+                               $check ? "true" : "false", $psi);
+       }
+}
+
+validate(true,
+<<<PSI
+struct a {
+       int i;
+}
+struct b {
+       long l;
+}
+typedef struct b b;
+union v {
+       struct a a;
+       b b;
+       struct {
+               double d;
+       } s;
+       union {
+               long l;
+               double d;
+       } u;
+}
+PSI
+);
+
+?>
+===DONE===
+--EXPECTF--
+===TEST===
+===DONE===