From 438fd434fd51cc2bd17bbdc8a2eb945493a6baa7 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 30 Jun 2023 22:09:33 -0400 Subject: [PATCH] tests: Add more coverage for parenthesis handling. Add a couple extra test cases which cover some special behaviours that are apparently missed by the existing tests. --- tests/decl-bad.at | 4 +++- tests/decl-good.at | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/decl-bad.at b/tests/decl-bad.at index c8b225e..dc21ea1 100644 --- a/tests/decl-bad.at +++ b/tests/decl-bad.at @@ -74,7 +74,9 @@ SIMPLE_BADDECL([Reject ... with no formal parameters], [declare f as function (...) returning void]) SIMPLE_BADDECL([Reject identifier lists with extra parentheses], - [explain int f((x))]) + [explain int f((x))], + [explain int f(())], + [explain int (())]) SIMPLE_BADDECL([Reject parameter types with extra parentheses], [explain int ((int))]) diff --git a/tests/decl-good.at b/tests/decl-good.at index 1c94872..8acf26a 100644 --- a/tests/decl-good.at +++ b/tests/decl-good.at @@ -85,6 +85,13 @@ SIMPLE_DECLS( SIMPLE_DECLS( [[int (x*)], [type function (pointer to x) returning int], [int (x *)]]) +SIMPLE_DECLS( + [[int (x)()], [declare x as function returning int], [int x()]]) + +dnl Check that function reduction does not occur in english parses +SIMPLE_DECLS( + [[int (x)], [type function (x) returning int], [], [declare x as int]]) + SIMPLE_DECLS( [[int x@<:@@:>@], [declare x as array of int]], [[int @<:@@:>@], [type array of int]]) -- 2.43.2