From ec0e3075d245afa3f3a848bd7bdc6376dea85fe0 Mon Sep 17 00:00:00 2001 From: Steven Jeuris Date: Wed, 3 Apr 2024 21:42:44 +0000 Subject: userdiff: better method/property matching for C# - Support multi-line methods by not requiring closing parenthesis. - Support multiple generics (comma was missing before). - Add missing `foreach`, `lock` and `fixed` keywords to skip over. - Remove `instanceof` keyword, which isn't C#. - Also detect non-method keywords not positioned at the start of a line. - Added tests; none existed before. The overall strategy is to focus more on what isn't expected for method/property definitions, instead of what is, but is fully optional. Signed-off-by: Steven Jeuris Acked-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t4018/csharp-exclude-exceptions | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 t/t4018/csharp-exclude-exceptions (limited to 't/t4018/csharp-exclude-exceptions') diff --git a/t/t4018/csharp-exclude-exceptions b/t/t4018/csharp-exclude-exceptions new file mode 100644 index 0000000000..b1e64256cf --- /dev/null +++ b/t/t4018/csharp-exclude-exceptions @@ -0,0 +1,29 @@ +using System; + +class Example +{ + string Method(int RIGHT) + { + try + { + throw new Exception("fail"); + } + catch (Exception) + { + } + finally + { + } + try { } catch (Exception) {} + try + { + throw GetException( + ); + } + catch (Exception) { } + + return "ChangeMe"; + } + + Exception GetException() => new Exception("fail"); +} -- cgit 1.2.3-korg