Turn feature test into a proper unit test

pull/1788/head
Bálint Aradi 8 years ago
parent 37ce7f01cf
commit 3d88ce70f4
  1. 18
      test cases/fortran/7 generated/meson.build
  2. 2
      test cases/fortran/7 generated/mod1.fpp
  3. 2
      test cases/fortran/7 generated/mod2.fpp
  4. 9
      test cases/fortran/7 generated/prog.f90

@ -4,15 +4,19 @@
project('generated', 'fortran') project('generated', 'fortran')
conf_data = configuration_data() conf_data = configuration_data()
conf_data.set('ONE', 1)
conf_data.set('TWO', 2)
sources_fortran_basenames = ['mod2', 'mod1'] templates_basenames = ['mod2', 'mod1']
preproc_sources_fortran = [] generated_sources = []
foreach fsource_basename : sources_fortran_basenames foreach template_basename : templates_basenames
infilename = '@0@.fpp'.format(fsource_basename) infilename = '@0@.fpp'.format(template_basename)
outfilename = '@0@.f90'.format(fsource_basename) outfilename = '@0@.f90'.format(template_basename)
outfile = configure_file( outfile = configure_file(
input : infilename, output : outfilename, configuration : conf_data) input : infilename, output : outfilename, configuration : conf_data)
preproc_sources_fortran += [outfile] generated_sources += [outfile]
endforeach endforeach
mylib = static_library('mylib', preproc_sources_fortran) sources = ['prog.f90'] + generated_sources
exe = executable('generated', sources)
test('generated', exe)

@ -1,6 +1,6 @@
module mod1 module mod1
implicit none implicit none
integer, parameter :: modval1 = 1 integer, parameter :: modval1 = @ONE@
end module mod1 end module mod1

@ -2,6 +2,6 @@ module mod2
use mod1 use mod1
implicit none implicit none
integer, parameter :: modval2 = 2 integer, parameter :: modval2 = @TWO@
end module mod2 end module mod2

@ -0,0 +1,9 @@
program prog
use mod2
implicit none
if (modval1 + modval2 /= 3) then
stop 1
end if
end program prog
Loading…
Cancel
Save