Permalink
Browse files

Fortran: add a few more test cases

  • Loading branch information...
1 parent d8954bb commit 5965b5ebd3797b846ff3b92e9a5079d0834537f1 @aphirst aphirst committed with b4n Feb 23, 2014
Showing with 113 additions and 0 deletions.
  1. +2 −0 tests/ctags/Makefile.am
  2. +51 −0 tests/ctags/block.f90
  3. +7 −0 tests/ctags/block.f90.tags
  4. +45 −0 tests/ctags/interfaces.f90
  5. +8 −0 tests/ctags/interfaces.f90.tags
View
@@ -20,6 +20,7 @@ test_sources = \
attributes.cs \
auto.f \
bit_field.c \
+ block.f90 \
bracematch.js \
bug1020715.cpp \
bug1020715.c \
@@ -140,6 +141,7 @@ test_sources = \
initialization.f90 \
interface_indexers.cs \
interface_properties.cs \
+ interfaces.f90 \
internal.cs \
intro_orig.tex \
intro.tex \
View
@@ -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
@@ -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
View
@@ -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
@@ -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.