diff options
author | William Deegan <bill@baddogconsulting.com> | 2019-04-25 12:25:57 -0400 |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2019-04-25 12:25:57 -0400 |
commit | e820fbfd1c89ef3ef5a0e59fcdbc055b9e80e687 (patch) | |
tree | ae12b08bdee6db37c3320e44d0f2b1ec34f69ba4 /test/fixture | |
parent | 9ddd2ab49faddd45ae5d1d0253d5f5135f348099 (diff) | |
download | scons-git-e820fbfd1c89ef3ef5a0e59fcdbc055b9e80e687.tar.gz |
Fix Issue #3135 - Also add tests to check that emitter is properly processing interface module declarations
Diffstat (limited to 'test/fixture')
-rw-r--r-- | test/fixture/fortran_unittests/test_1.f90 | 46 | ||||
-rw-r--r-- | test/fixture/fortran_unittests/test_2.f90 | 46 | ||||
-rw-r--r-- | test/fixture/fortran_unittests/test_submodules.f90 | 15 |
3 files changed, 107 insertions, 0 deletions
diff --git a/test/fixture/fortran_unittests/test_1.f90 b/test/fixture/fortran_unittests/test_1.f90 new file mode 100644 index 000000000..25ba9d6e6 --- /dev/null +++ b/test/fixture/fortran_unittests/test_1.f90 @@ -0,0 +1,46 @@ +module test_1 + + type test_type_1 + integer :: n + contains + procedure :: set_n + procedure :: get_n + end type test_type_1 + + +interface + + module subroutine set_n ( this, n ) + class(test_type_1), intent(inout) :: this + integer, intent(in) :: n + end subroutine + + module function get_n ( this ) + class(test_type_1), intent(in) :: this + integer :: get_n + end function get_n + +end interface + +end module test_1 + + +submodule(test_1) test_1_impl + +contains + + module procedure set_n + + implicit none + + this%n = n + end procedure set_n + + module procedure get_n + + implicit none + + get_n = this%n + end procedure get_n + +end submodule test_1_impl diff --git a/test/fixture/fortran_unittests/test_2.f90 b/test/fixture/fortran_unittests/test_2.f90 new file mode 100644 index 000000000..7a39b0daf --- /dev/null +++ b/test/fixture/fortran_unittests/test_2.f90 @@ -0,0 +1,46 @@ +module test_2 + + type test_type_2 + integer :: m + contains + procedure :: set_m + procedure :: get_m + end type test_type_2 + + +interface + + module subroutine set_m ( this, m ) + class(test_type_2), intent(inout) :: this + integer, intent(in) :: m + end subroutine + + module function get_m ( this ) + class(test_type_2), intent(in) :: this + integer :: get_m + end function get_m + +end interface + +end module test_2 + + +submodule(test_2) test_2_impl + +contains + + module procedure set_m + + implicit none + + this%m = m + end procedure set_m + + module procedure get_m + + implicit none + + get_m = this%m + end procedure get_m + +end submodule test_2_impl diff --git a/test/fixture/fortran_unittests/test_submodules.f90 b/test/fixture/fortran_unittests/test_submodules.f90 new file mode 100644 index 000000000..5deec37ad --- /dev/null +++ b/test/fixture/fortran_unittests/test_submodules.f90 @@ -0,0 +1,15 @@ +program test_submodules + + use test_1 + use test_2 + + type(test_type_1) :: var1 + type(test_type_2) :: var2 + + call var1%set_n(42) + call var2%set_m(21) + + print*,'var1%n = ', var1%get_n() + print*,'var2%m = ', var2%get_m() + +end program test_submodules |