]> git.draconx.ca Git - cdecl99.git/blobdiff - tests/decl-good.at
tests: Add sanity test for variable-length arrays.
[cdecl99.git] / tests / decl-good.at
index 8acf26a686c102f7b63d28a5de5cc1ece2066285..79cc6f9187739f57de263a9da8d7c13908857360 100644 (file)
@@ -95,3 +95,26 @@ SIMPLE_DECLS(
 SIMPLE_DECLS(
   [[int x@<:@@:>@], [declare x as array of int]],
   [[int @<:@@:>@],  [type array of int]])
+
+SIMPLE_DECLS(
+  [[int x@<:@n@:>@], [declare x as variable-length array n of int]],
+  [[int x@<:@*@:>@], [declare x as variable-length array of int]],
+  [[int @<:@n@:>@],  [type variable-length array n of int]],
+  [[int @<:@*@:>@],  [type variable-length array of int]])
+
+SIMPLE_DECLS_EXPLAIN(
+  [[int ((int))], [type function (int) returning int], [int (int)]],
+  [[int (x(int))], [declare x as function (int) returning int], [int x(int)]],
+  [[int (())], [type function returning int], [int ()]])
+
+SIMPLE_DECLS_EXPLAIN(
+  [[int (x())], [declare x as function returning int], [int x()]],
+  [[int ((x)())], [declare x as function returning int], [int x()]])
+
+dnl Test that english-only keywords are not rejected as idenfitiers in C mode.
+SIMPLE_DECLS_EXPLAIN(
+  [[of array@<:@@:>@], [declare array as array of of]],
+  [[returning as(function)],
+    [declare as as function (function) returning returning]],
+  [[pointer *declare], [declare declare as pointer to pointer]],
+  [[type to], [declare to as type]])