diff options
author | Brad Richardson <everythingfunctional@protonmail.com> | 2021-03-24 07:02:25 -0500 |
---|---|---|
committer | Brad Richardson <everythingfunctional@protonmail.com> | 2021-03-24 07:02:25 -0500 |
commit | a5673ab45dab5e3dc09851bf143946ccf6f53218 (patch) | |
tree | ba5a4a3aa5906d21fdd47f0b246697c00faa19fd | |
parent | ccc55fff1abf2e4ae516cf01aabb97f9184e97e4 (diff) | |
download | fpm-a5673ab45dab5e3dc09851bf143946ccf6f53218.tar.gz fpm-a5673ab45dab5e3dc09851bf143946ccf6f53218.zip |
test: for program using module in a different subdirectory
-rw-r--r-- | fpm/test/fpm_test/test_module_dependencies.f90 | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/fpm/test/fpm_test/test_module_dependencies.f90 b/fpm/test/fpm_test/test_module_dependencies.f90 index 40ad963..4f2aa27 100644 --- a/fpm/test/fpm_test/test_module_dependencies.f90 +++ b/fpm/test/fpm_test/test_module_dependencies.f90 @@ -40,7 +40,9 @@ contains & new_unittest("invalid-library-use", & test_invalid_library_use, should_fail=.true.), & & new_unittest("subdirectory-module-use", & - test_subdirectory_module_use) & + test_subdirectory_module_use), & + & new_unittest("invalid-subdirectory-module-use", & + test_invalid_subdirectory_module_use, should_fail=.true.) & ] end subroutine collect_module_dependencies @@ -367,7 +369,7 @@ contains end subroutine test_invalid_library_use - !> Check program using a non-library module in a different directory + !> Check program using a non-library module in a sub-directory subroutine test_subdirectory_module_use(error) !> Error handling @@ -392,6 +394,30 @@ contains end subroutine test_subdirectory_module_use + !> Check program using a non-library module in a differente sub-directory + subroutine test_invalid_subdirectory_module_use(error) + + !> Error handling + type(error_t), allocatable, intent(out) :: error + + type(fpm_model_t) :: model + type(build_target_ptr), allocatable :: targets(:) + + model%output_directory = '' + allocate(model%packages(1)) + allocate(model%packages(1)%sources(2)) + + model%packages(1)%sources(1) = new_test_source(FPM_UNIT_MODULE,file_name="app/diff_dir/app_mod.f90", & + scope = FPM_SCOPE_APP, & + provides=[string_t('app_mod')]) + + model%packages(1)%sources(2) = new_test_source(FPM_UNIT_PROGRAM,file_name="app/prog_dir/my_program.f90", & + scope=FPM_SCOPE_APP, & + uses=[string_t('app_mod')]) + + call targets_from_sources(targets,model,error) + + end subroutine test_invalid_subdirectory_module_use !> Helper to create a new srcfile_t function new_test_source(type,file_name, scope, uses, provides) result(src) |