@@ -40,7 +40,9 @@ subroutine collect_module_dependencies(testsuite)
40
40
& new_unittest(" invalid-library-use" , &
41
41
test_invalid_library_use, should_fail= .true. ), &
42
42
& new_unittest(" subdirectory-module-use" , &
43
- test_subdirectory_module_use) &
43
+ test_subdirectory_module_use), &
44
+ & new_unittest(" invalid-subdirectory-module-use" , &
45
+ test_invalid_subdirectory_module_use, should_fail= .true. ) &
44
46
]
45
47
46
48
end subroutine collect_module_dependencies
@@ -367,7 +369,7 @@ subroutine test_invalid_library_use(error)
367
369
end subroutine test_invalid_library_use
368
370
369
371
370
- ! > Check program using a non-library module in a different directory
372
+ ! > Check program using a non-library module in a sub- directory
371
373
subroutine test_subdirectory_module_use (error )
372
374
373
375
! > Error handling
@@ -392,6 +394,30 @@ subroutine test_subdirectory_module_use(error)
392
394
393
395
end subroutine test_subdirectory_module_use
394
396
397
+ ! > Check program using a non-library module in a differente sub-directory
398
+ subroutine test_invalid_subdirectory_module_use (error )
399
+
400
+ ! > Error handling
401
+ type (error_t), allocatable , intent (out ) :: error
402
+
403
+ type (fpm_model_t) :: model
404
+ type (build_target_ptr), allocatable :: targets(:)
405
+
406
+ model% output_directory = ' '
407
+ allocate (model% packages(1 ))
408
+ allocate (model% packages(1 )% sources(2 ))
409
+
410
+ model% packages(1 )% sources(1 ) = new_test_source(FPM_UNIT_MODULE,file_name= " app/diff_dir/app_mod.f90" , &
411
+ scope = FPM_SCOPE_APP, &
412
+ provides= [string_t(' app_mod' )])
413
+
414
+ model% packages(1 )% sources(2 ) = new_test_source(FPM_UNIT_PROGRAM,file_name= " app/prog_dir/my_program.f90" , &
415
+ scope= FPM_SCOPE_APP, &
416
+ uses= [string_t(' app_mod' )])
417
+
418
+ call targets_from_sources(targets,model,error)
419
+
420
+ end subroutine test_invalid_subdirectory_module_use
395
421
396
422
! > Helper to create a new srcfile_t
397
423
function new_test_source (type ,file_name , scope , uses , provides ) result(src)
0 commit comments