Skip to content

Commit

Permalink
Fortran: add a few more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
aphirst authored and b4n committed Feb 23, 2014
1 parent d8954bb commit 5965b5e
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/ctags/Makefile.am
Expand Up @@ -20,6 +20,7 @@ test_sources = \
attributes.cs \
auto.f \
bit_field.c \
block.f90 \
bracematch.js \
bug1020715.cpp \
bug1020715.c \
Expand Down Expand Up @@ -140,6 +141,7 @@ test_sources = \
initialization.f90 \
interface_indexers.cs \
interface_properties.cs \
interfaces.f90 \
internal.cs \
intro_orig.tex \
intro.tex \
Expand Down
51 changes: 51 additions & 0 deletions tests/ctags/block.f90
@@ -0,0 +1,51 @@
module Blocks
implicit none

integer :: i

contains

function MyFunc(thing)
integer, intent(in) :: thing
integer :: myfunc

block
! these obviously won't show up, because variables inside functions inside modules don't anyway
! and that's fine
integer :: tempint
tempint = 1
if (tempint == 1) then
tempint = 2
end if
myfunc = tempint
end block

end function MyFunc

end module Blocks

program Main
use Blocks

implicit none

! these variable declarations should definitely show up in the symbol list
integer :: otherint, moreint

otherint = 3

block
! These shouldn't, because...
integer :: newtempint

newtempint = 2
block
! ...the damn things can be arbitrarily nested!
integer :: newer_int

newer_int = 3
end block
newtempint = 2 * newtempint
end block

end program Main
7 changes: 7 additions & 0 deletions tests/ctags/block.f90.tags
@@ -0,0 +1,7 @@
# format=tagmanager
Blocks�256�0
Main�2048�0
MyFunc�16�Blocks�0
i�16384�Blocks�0
moreint�16384�Main�0
otherint�16384�Main�0
45 changes: 45 additions & 0 deletions tests/ctags/interfaces.f90
@@ -0,0 +1,45 @@
module HasInterfaces
! INTERFACE blocks can have names
! usually only used for when overloading, but good practice anyway!
interface MyFunc
function Func1(arg)
integer :: arg
end function Func1

function Func2(arg)
integer :: arg
end function Func2
end interface MyFunc

! without a name we just use a generic one
interface
subroutine CHEEV(...)
! ...
end subroutine CHEEV
end interface

contains

function Func1(arg)
integer :: arg, func1
func1 = arg
end function Func1

function Func2(arg)
integer :: arg, func2
func2 = arg
end function Func2

end module HasInterfaces

program Main
use HasInterfaces

! can also occur in PROGRAMs
interface MySubroutine
subroutine Sub1(arg)
! ...
end subroutine Sub1
end interface MySubroutine

end program Main
8 changes: 8 additions & 0 deletions tests/ctags/interfaces.f90.tags
@@ -0,0 +1,8 @@
# format=tagmanager
Func1�16�HasInterfaces�0
Func2�16�HasInterfaces�0
HasInterfaces�256�0
Interface#0�32�HasInterfaces�0
Main�2048�0
MyFunc�32�HasInterfaces�0
MySubroutine�32�Main�0

0 comments on commit 5965b5e

Please sign in to comment.