Skip to content

Commit b79e692

Browse files
phil-blaingitster
authored andcommitted
userdiff: add tests for Fortran xfuncname regex
The Fortran userdiff patterns, introduced in 909a549 (userdiff.c: add builtin fortran regex patterns, 2010-09-10), predate the test infrastructure for xfuncname patterns, introduced in bfa7d01 (t4018: an infrastructure to test hunk headers, 2014-03-21). Add tests for the Fortran xfuncname patterns. The test 't/t4018/fortran-comment-keyword' documents a shortcoming of the regex that is fixed in a subsequent commit. While at it, add descriptive comments for the different parts of the regex. Signed-off-by: Philippe Blain <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 47ae905 commit b79e692

11 files changed

+100
-0
lines changed

t/t4018/fortran-block-data

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BLOCK DATA RIGHT
2+
3+
COMMON /B/ C, ChangeMe
4+
DATA C, ChangeMe / 2.0, 6.0 /
5+
END

t/t4018/fortran-comment

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module a
2+
3+
contains
4+
5+
! subroutine wrong
6+
subroutine RIGHT
7+
! subroutine wrong
8+
9+
real ChangeMe
10+
11+
end subroutine RIGHT
12+
13+
end module a

t/t4018/fortran-comment-keyword

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module a
2+
3+
contains
4+
5+
subroutine RIGHT (funcA, funcB)
6+
7+
real funcA ! grid function a
8+
real funcB ! grid function b
9+
10+
real ChangeMe
11+
integer broken
12+
13+
end subroutine RIGHT
14+
15+
end module a

t/t4018/fortran-comment-legacy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module a
2+
3+
contains
4+
5+
C subroutine wrong
6+
subroutine RIGHT
7+
C subroutine wrong
8+
9+
real ChangeMe
10+
11+
end subroutine RIGHT
12+
13+
end module a

t/t4018/fortran-comment-legacy-star

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module a
2+
3+
contains
4+
5+
* subroutine wrong
6+
subroutine RIGHT
7+
* subroutine wrong
8+
9+
real ChangeMe
10+
11+
end subroutine RIGHT
12+
13+
end module a

t/t4018/fortran-external-function

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function RIGHT(a, b) result(c)
2+
3+
integer, intent(in) :: ChangeMe
4+
integer, intent(in) :: b
5+
integer, intent(out) :: c
6+
7+
c = a+b
8+
9+
end function RIGHT

t/t4018/fortran-external-subroutine

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
subroutine RIGHT
2+
3+
real ChangeMe
4+
5+
end subroutine RIGHT

t/t4018/fortran-module

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module RIGHT
2+
3+
use ChangeMe
4+
5+
end module RIGHT

t/t4018/fortran-module-procedure

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module RIGHT
2+
3+
implicit none
4+
private
5+
6+
interface letters ! generic interface
7+
module procedure aaaa, &
8+
bbbb, &
9+
ChangeMe, &
10+
dddd
11+
end interface
12+
13+
end module RIGHT

t/t4018/fortran-program

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
program RIGHT
2+
3+
call ChangeMe
4+
5+
end program RIGHT

0 commit comments

Comments
 (0)