git/t/t4018
Steven Jeuris ec0e3075d2 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 <steven.jeuris@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-04-05 15:21:43 -07:00
..
bash-arithmetic-function userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-bashism-style-compact userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-bashism-style-function userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-bashism-style-whitespace userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-conditional-function userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-missing-parentheses userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-mixed-style-compact userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-mixed-style-function userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-nested-functions userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-other-characters userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-posix-style-compact userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-posix-style-function userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-posix-style-whitespace userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-subshell-function userdiff: support Bash 2020-10-22 10:29:30 -07:00
bash-trailing-comment userdiff: support Bash 2020-10-22 10:29:30 -07:00
cpp-c++-function
cpp-class-constructor
cpp-class-constructor-mem-init
cpp-class-definition
cpp-class-definition-derived
cpp-class-destructor
cpp-function-returning-global-type
cpp-function-returning-nested
cpp-function-returning-pointer
cpp-function-returning-reference
cpp-gnu-style-function
cpp-namespace-definition
cpp-operator-definition
cpp-skip-access-specifiers
cpp-skip-comment-block
cpp-skip-labels
cpp-struct-definition
cpp-struct-single-line
cpp-template-function-definition
cpp-union-definition
cpp-void-c-function
csharp-exclude-assignments userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-control-statements userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-exceptions userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-generic-method-calls userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-init-dispose userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-iterations userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-method-calls userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-other userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-array userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-explicit userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-generics userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-generics-alternate-spaces userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-modifiers userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-multiline userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-params userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-special-chars userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-with-spacing userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-property userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-property-braces-same-line userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
css-attribute-value-selector userdiff: expand detected chunk headers for css 2020-10-08 10:21:11 -07:00
css-block-level-@-statements userdiff: expand detected chunk headers for css 2020-10-08 10:21:11 -07:00
css-brace-in-col-1
css-class-selector userdiff: expand detected chunk headers for css 2020-10-08 10:21:11 -07:00
css-colon-eol
css-colon-selector
css-common
css-id-selector userdiff: expand detected chunk headers for css 2020-10-08 10:21:11 -07:00
css-long-selector-list
css-prop-sans-indent
css-root-selector userdiff: expand detected chunk headers for css 2020-10-08 10:21:11 -07:00
css-short-selector-list
css-trailing-space
custom1-pattern
custom2-match-to-end-of-line
custom3-alternation-in-pattern
dts-labels userdiff: add a builtin pattern for dts files 2019-08-21 15:09:34 -07:00
dts-node-unitless userdiff: add a builtin pattern for dts files 2019-08-21 15:09:34 -07:00
dts-nodes userdiff: add a builtin pattern for dts files 2019-08-21 15:09:34 -07:00
dts-nodes-boolean-prop userdiff: fix some corner cases in dts regex 2019-10-21 17:44:12 +09:00
dts-nodes-comment1 userdiff: add a builtin pattern for dts files 2019-08-21 15:09:34 -07:00
dts-nodes-comment2 userdiff: add a builtin pattern for dts files 2019-08-21 15:09:34 -07:00
dts-nodes-multiline-prop userdiff: fix some corner cases in dts regex 2019-10-21 17:44:12 +09:00
dts-reference userdiff: add a builtin pattern for dts files 2019-08-21 15:09:34 -07:00
dts-root userdiff: fix some corner cases in dts regex 2019-10-21 17:44:12 +09:00
dts-root-comment userdiff: fix some corner cases in dts regex 2019-10-21 17:44:12 +09:00
elixir-do-not-pick-end userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-ex-unit-test userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-function userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-macro userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-module userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-module-func userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-nested-module userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-private-function userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-protocol userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
elixir-protocol-implementation userdiff: add Elixir to supported userdiff languages 2019-11-10 15:26:26 +09:00
fortran-block-data userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fortran-comment userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fortran-comment-keyword userdiff: improve Fortran xfuncname regex 2020-08-13 11:21:18 -07:00
fortran-comment-legacy userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fortran-comment-legacy-star userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fortran-external-function userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fortran-external-subroutine userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fortran-module userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fortran-module-procedure userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fortran-program userdiff: add tests for Fortran xfuncname regex 2020-08-13 11:21:17 -07:00
fountain-scene
golang-complex-function
golang-func
golang-interface
golang-long-func
golang-struct
java-class-brace-on-separate-line userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-class-member-function userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-class-space-before-type-parameters userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-class-type-parameters userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-class-type-parameters-implements userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-enum-constant userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-interface-type-parameters userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-interface-type-parameters-extends userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-method-return-generic-bounded userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-method-return-generic-wildcard userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-nested-field userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-non-sealed userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-record userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-record-space-before-components userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-record-type-parameters userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-sealed userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters-implements-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
kotlin-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-enum-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-fun userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-inheritace-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-inline-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-interface userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-nested-fun userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-public-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-sealed-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
markdown-heading-indented userdiff: support Markdown 2020-05-02 18:04:12 -07:00
markdown-heading-non-headings userdiff: support Markdown 2020-05-02 18:04:12 -07:00
matlab-class-definition
matlab-function
matlab-octave-section-1
matlab-octave-section-2
matlab-section
perl-skip-end-of-heredoc
perl-skip-forward-decl
perl-skip-sub-in-pod
perl-sub-definition
perl-sub-definition-kr-brace
php-abstract-class
php-abstract-method userdiff: PHP: catch "abstract" and "final" functions 2020-10-07 08:45:43 -07:00
php-class
php-enum userdiff: support enum keyword in PHP hunk header 2021-08-31 12:13:36 -07:00
php-final-class
php-final-method userdiff: PHP: catch "abstract" and "final" functions 2020-10-07 08:45:43 -07:00
php-function
php-interface
php-method
php-trait
python-async-def userdiff: support Python async functions 2019-11-20 16:31:43 +09:00
python-class userdiff: support Python async functions 2019-11-20 16:31:43 +09:00
python-def userdiff: support Python async functions 2019-11-20 16:31:43 +09:00
python-indented-async-def userdiff: support Python async functions 2019-11-20 16:31:43 +09:00
python-indented-class userdiff: support Python async functions 2019-11-20 16:31:43 +09:00
python-indented-def userdiff: support Python async functions 2019-11-20 16:31:43 +09:00
README userdiff: remove support for "broken" tests 2021-04-08 12:19:10 -07:00
rust-fn
rust-impl
rust-macro-rules userdiff: recognize 'macro_rules!' as starting a Rust function block 2020-10-07 08:48:20 -07:00
rust-struct
rust-trait
scheme-class userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-def userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-def-variant userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-define-slash-public userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-define-syntax userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-define-variant userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-library userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-local-define userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-module userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-top-level-define userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00
scheme-user-defined-define userdiff: add support for Scheme 2021-04-08 13:56:09 -07:00

How to write RIGHT test cases
=============================

Insert the word "ChangeMe" (exactly this form) at a distance of
at least two lines from the line that must appear in the hunk header.

The text that must appear in the hunk header must contain the word
"right", but in all upper-case, like in the title above.

This text is a bit twisted and out of order, but it is itself a
test case for the default hunk header pattern. Know what you are doing
if you change it.

BTW, this tests that the head line goes to the hunk header, not the line
of equal signs.